DEV Community


Posted on

Yi LLM and a Simple API Server


Today was an exciting exploration into the world of AI models with my hands-on experience using the 01-ai/Yi-6B model. This robust and versatile language model has shown impressive capabilities. But what really piqued my interest was the idea of integrating this model with web technologies to broaden its accessibility and application. To achieve this, I embarked on creating a simple flask app setup, which serves as a bridge between the Yi-6B model and the web.

This setup allows for querying the model using HTTP requests, opening a new avenue for interacting with this powerful tool. It's not just about using the model in isolation anymore; it's about seamlessly integrating it into the wider context of web applications, demonstrating the immense potential of AI in our digitally connected world.

The settings for how Yi responds are taken from the demo in the original repo. With that, I gave it a simple query of "hi, tell me a long story", it responds pretty fast, but with the default demo settings it likes to say some wild random stuff:

the response I got:

hi, tell me a long story.

(a) मार्गो! सुनीले एक चौड़ै गंदजो-हृदी बाणी ?
(b) Why are you silent like the moon in your heart has gone out of its course?

  1. He had been to Paris and he told us all about it; his eyes were shining with pleasure as he talked: "It is so different from here that I can't believe we live on this planet at all" : (2016 Delhi PMT Sample Paper II) [A] A person who goes abroad tells others how foreign places differ form their own country / region/ town or village B The narrator was talking happily C There was something special which happened when someone went away for holidays D All these statements are correct Answer – Option B Explanation – Here 'he' refers to someone else i.e the speaker himself because no other name appears before him except pronouns such as 'I' & 'you' etc. Hence option b fits best into context given above Question No -48 To whom did they give an award last year? They gave it to Mr X. Who will receive next month's prize? We don't know yet but perhaps Ms Y may get it if she works hard enough. What does 'we' refer to in both sentences? In sentence #1 = speakers themselves Sentence#3=speakers + listener In question nos 1& 3, what do "they" stand for? It depends upon whether there exist two people speaking together OR just only one man speaks alone If more than two persons speak then answer would be plural e.g teachers teach students But sometimes even singular forms also used depending upo situation Like: My teacher said today won't come again tomorrow :( )

this is some pretty random stuff, like a string of output concatenated from random bits of training data.

now for the spooky part, I put it down for the day and tried to meditate a bit, by observing my thoughts, and behold, they came as random as this paragraph of text 😰, and then it hit me: my thoughts ramble on with data I've been trained on (exposed to) just like LLMs when there isn't clear instructions on what to focus my mind on. Is it just me, or have you experienced this too? let me know in the comments!

Top comments (0)