diy open source ai
Go to Google Colab and start a new notebook.
pip install transformers
Pick a model. Go to the HuggingFace website and navigate to the Models section search and find microsoft/phi-1_5. Read the model card and learn about the model. For example this model is for "Text Generation".
Note the buttons on the right: You can train the model. You can deploy the model. You can use the model (transformers).
So, clicking on "Use this model" and selecting "Transformers" from the dropdown, some code pop-up. Copy the code and paste it to the Colab notebook.
You will have to add your HF_TOKEN secret. Use the left menu and navigate to the "Secrets" section.
Note if you right-click there is a "Explain code" feature.
pip install torch
Add a variable prompt and assign a prompt to it.
Run mode.generate().
Use the tokenizer.decode() to decode the response.
Print the response.
Note: the add hardware acceleration: select Edit and Notebook settings and select GPU radio button.