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 (1)
This information is very useful for anyone learning about Hugging Face! There are many amazing things you can do with their Datasets, Models, and Spaces.
In my opinion, the Hugging Face community is the bedrock of the platform. The community has attracted developers, researchers, and AI enthusiasts who share their knowledge, experiences, and resources to support each other in their ML journeys.
Within the Hugging Face community, users can participate in forums and discussions to exchange ideas, seek advice, and showcase their projects. You can also join their Discord channel, which has tens of thousands of members that share knowledge and help each other. Whether you’re a beginner seeking guidance or an expert looking to contribute, the community welcomes everyone of all skill levels and backgrounds.
Hugging Face also provides comprehensive support through its documentation, tutorials, and courses. Users can access guides, code examples, and step-by-step tutorials to help them get started with Hugging Face and master advanced NLP techniques. For instance, when exploring a specific task like Text Generation, you’ll find plenty of relevant information to assist and guide you in its proper usage. This includes concise explanations about the task itself, accompanied by videos, demos, and use cases. Additionally, it shows all models for that given task and their datasets available.
If you are interested in learning more about this amazing library, I recommend reading this article from my partner Nicolas Azevedo, which provides some good examples of Hugging Face: scalablepath.com/machine-learning/...