Instructions to use futranbg/llama2_langchain_7b_chat_GGUF with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- llama-cpp-python
How to use futranbg/llama2_langchain_7b_chat_GGUF with llama-cpp-python:
# !pip install llama-cpp-python from llama_cpp import Llama llm = Llama.from_pretrained( repo_id="futranbg/llama2_langchain_7b_chat_GGUF", filename="llama-2-7b-langchain-chat-q4_0.gguf", )
output = llm( "Once upon a time,", max_tokens=512, echo=True ) print(output)
- Notebooks
- Google Colab
- Kaggle
- Local Apps Settings
- llama.cpp
How to use futranbg/llama2_langchain_7b_chat_GGUF with llama.cpp:
Install from brew
brew install llama.cpp # Start a local OpenAI-compatible server with a web UI: llama-server -hf futranbg/llama2_langchain_7b_chat_GGUF:Q4_0 # Run inference directly in the terminal: llama-cli -hf futranbg/llama2_langchain_7b_chat_GGUF:Q4_0
Install from WinGet (Windows)
winget install llama.cpp # Start a local OpenAI-compatible server with a web UI: llama-server -hf futranbg/llama2_langchain_7b_chat_GGUF:Q4_0 # Run inference directly in the terminal: llama-cli -hf futranbg/llama2_langchain_7b_chat_GGUF:Q4_0
Use pre-built binary
# Download pre-built binary from: # https://github.com/ggerganov/llama.cpp/releases # Start a local OpenAI-compatible server with a web UI: ./llama-server -hf futranbg/llama2_langchain_7b_chat_GGUF:Q4_0 # Run inference directly in the terminal: ./llama-cli -hf futranbg/llama2_langchain_7b_chat_GGUF:Q4_0
Build from source code
git clone https://github.com/ggerganov/llama.cpp.git cd llama.cpp cmake -B build cmake --build build -j --target llama-server llama-cli # Start a local OpenAI-compatible server with a web UI: ./build/bin/llama-server -hf futranbg/llama2_langchain_7b_chat_GGUF:Q4_0 # Run inference directly in the terminal: ./build/bin/llama-cli -hf futranbg/llama2_langchain_7b_chat_GGUF:Q4_0
Use Docker
docker model run hf.co/futranbg/llama2_langchain_7b_chat_GGUF:Q4_0
- LM Studio
- Jan
- vLLM
How to use futranbg/llama2_langchain_7b_chat_GGUF with vLLM:
Install from pip and serve model
# Install vLLM from pip: pip install vllm # Start the vLLM server: vllm serve "futranbg/llama2_langchain_7b_chat_GGUF" # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:8000/v1/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "futranbg/llama2_langchain_7b_chat_GGUF", "prompt": "Once upon a time,", "max_tokens": 512, "temperature": 0.5 }'Use Docker
docker model run hf.co/futranbg/llama2_langchain_7b_chat_GGUF:Q4_0
- Ollama
How to use futranbg/llama2_langchain_7b_chat_GGUF with Ollama:
ollama run hf.co/futranbg/llama2_langchain_7b_chat_GGUF:Q4_0
- Unsloth Studio
How to use futranbg/llama2_langchain_7b_chat_GGUF with Unsloth Studio:
Install Unsloth Studio (macOS, Linux, WSL)
curl -fsSL https://unsloth.ai/install.sh | sh # Run unsloth studio unsloth studio -H 0.0.0.0 -p 8888 # Then open http://localhost:8888 in your browser # Search for futranbg/llama2_langchain_7b_chat_GGUF to start chatting
Install Unsloth Studio (Windows)
irm https://unsloth.ai/install.ps1 | iex # Run unsloth studio unsloth studio -H 0.0.0.0 -p 8888 # Then open http://localhost:8888 in your browser # Search for futranbg/llama2_langchain_7b_chat_GGUF to start chatting
Using HuggingFace Spaces for Unsloth
# No setup required # Open https://huggingface.co/spaces/unsloth/studio in your browser # Search for futranbg/llama2_langchain_7b_chat_GGUF to start chatting
- Docker Model Runner
How to use futranbg/llama2_langchain_7b_chat_GGUF with Docker Model Runner:
docker model run hf.co/futranbg/llama2_langchain_7b_chat_GGUF:Q4_0
- Lemonade
How to use futranbg/llama2_langchain_7b_chat_GGUF with Lemonade:
Pull the model
# Download Lemonade from https://lemonade-server.ai/ lemonade pull futranbg/llama2_langchain_7b_chat_GGUF:Q4_0
Run and chat with the model
lemonade run user.llama2_langchain_7b_chat_GGUF-Q4_0
List all available models
lemonade list
output = llm(
"Once upon a time,",
max_tokens=512,
echo=True
)
print(output)lama-2-7b-langchain-chat - GGUF
- Criador do Modelo: Photolens
- Modelo Original: llama-2-7b-langchain-chat
Arquivos Incluídos
| Nome | Método Quant | Bits | Tamanho | Desc |
|---|---|---|---|---|
| llama-2-7b-langchain-chat-q4_0.gguf | q4_0 | 4 | 3.56 GB | Quantização em 4-bit. |
| llama-2-7b-langchain-chat-q4_1.gguf | q4_1 | 4 | 3.95 GB | Quantização em 4-bit. Acurácia maior que q4_0 mas não tão boa quanto q5_0. Inferência mais rápida que os modelos q5. |
| llama-2-7b-langchain-chat-q5_0.gguf | q5_0 | 5 | 4.33 GB | Quantização em 5-bit. Melhor acurácia, maior uso de recursos, inferência mais lenta. |
| llama-2-7b-langchain-chat-q5_1.gguf | q5_1 | 5 | 4.72 GB | Quantização em 5-bit. Ainda Melhor acurácia, maior uso de recursos, inferência mais lenta. |
| llama-2-7b-langchain-chat-q8_0.gguf | q8_0 | 8 | 6.67 GB | Quantização em 8-bit. Quase indistinguível do float16. Usa muitos recursos e é mais lento. |
Observação: os valores de RAM acima não pressupõem descarregamento de GPU. Se as camadas forem descarregadas para a GPU, isso reduzirá o uso de RAM e usará VRAM.
Como executar com llama.cpp
Usei o seguinte comando. Ajuste para suas necessidades:
./main -m ./models/llama-2-7b-langchain-chat/llama-2-7b-langchain-chat-q5_1.gguf --color --temp 0.5 -n 256 -p "<s>[INST] Há muito tempo atrás, numa galáxia distante [/INST] Assistant Message </s>"
Para compreender os parâmetros, veja a documentação do llama.cpp
Sobre o formato GGUF
GGUF é um novo formato introduzido pela equipe llama.cpp em 21 de agosto de 2023. É um substituto para o GGML, que não é mais suportado pelo llama.cpp.
O principal benefício do GGUF é que ele é um formato extensível e à prova de futuro que armazena mais informações sobre o modelo como metadados. Ele também inclui código de tokenização significativamente melhorado, incluindo pela primeira vez suporte total para tokens especiais. Isso deve melhorar o desempenho, especialmente com modelos que usam novos tokens especiais e implementam modelos de prompt personalizados.
Aqui está uma lista de clientes e bibliotecas que são conhecidos por suportar GGUF:
- llama.cpp.
- text-generation-webui, a interface web mais amplamente utilizada. Suporta GGUF com aceleração GPU via backend ctransformers - backend llama-cpp-python deve funcionar em breve também.
- KoboldCpp, agora suporta GGUF a partir da versão 1.41! Uma poderosa interface web GGML, com aceleração total da GPU. Especialmente bom para contar histórias.
- LM Studio, versão 0.2.2 e posteriores suportam GGUF. Uma GUI local totalmente equipada com aceleração GPU em ambos Windows (NVidia e AMD) e macOS.
- LoLLMS Web UI, agora deve funcionar, escolha o backend c_transformers. Uma ótima interface web com muitos recursos interessantes. Suporta aceleração GPU CUDA.
- ctransformers, agora suporta GGUF a partir da versão 0.2.24! Uma biblioteca Python com aceleração GPU, suporte LangChain e servidor AI compatível com OpenAI.
- llama-cpp-python, suporta GGUF a partir da versão 0.1.79. Uma biblioteca Python com aceleração GPU, suporte LangChain e servidor API compatível com OpenAI.
- candle, adicionou suporte GGUF em 22 de agosto. Candle é um framework ML Rust com foco em desempenho, incluindo suporte GPU e facilidade de uso.
- LocalAI, adicionou suporte GGUF em 23 de agosto. LocalAI provê uma API Rest para modelos LLM e de geração de imagens.
Template
<s>[INST] Prompter Message [/INST] Assistant Message </s>
- Downloads last month
- 48
4-bit
5-bit
8-bit
# !pip install llama-cpp-python from llama_cpp import Llama llm = Llama.from_pretrained( repo_id="futranbg/llama2_langchain_7b_chat_GGUF", filename="", )