Hugging-face 🤗 is a repository to host all the LLM models available in the world. https://huggingface.co/
If you go to the models sections of the repo, you would see thousands of models available to download or use as it is.
Let's get an example to use google/flan-t5-large to generate text2text prompts
- Install below python libs
!pip install huggingface_hub
!pip install transformers
!pip install accelerate
!pip install bitsandbytes
!pip install langchain
Get a huggingface API Key - https://huggingface.co/settings/tokens
You can run below python code now with your Key
from langchain import PromptTemplate, HuggingFaceHub, LLMChain
import os
os.environ["HUGGINGFACEHUB_API_TOKEN"] = "<HUGGINGFACEKEY>"
prompt = PromptTemplate(
input_variables=["product"],
template="What is the good name for a company that makes {product}",
)
chain = LLMChain(prompt=prompt, llm=HuggingFaceHub(repo_id="google/flan-t5-large",model_kwargs={"temperature":0.1, "max_length":64}))
chain.run("fruits")
Results from Model = Fruits is a footballer from the United States.
Top comments (0)