mlabonne/guanaco-llama2-1k
Viewer • Updated • 1k • 3.5k • 162
How to use devshaheen/Llama-2-7b-chat-finetune with Transformers:
# Use a pipeline as a high-level helper
from transformers import pipeline
pipe = pipeline("text-generation", model="devshaheen/Llama-2-7b-chat-finetune") # Load model directly
from transformers import AutoTokenizer, AutoModelForCausalLM
tokenizer = AutoTokenizer.from_pretrained("devshaheen/Llama-2-7b-chat-finetune")
model = AutoModelForCausalLM.from_pretrained("devshaheen/Llama-2-7b-chat-finetune")How to use devshaheen/Llama-2-7b-chat-finetune with vLLM:
# Install vLLM from pip:
pip install vllm
# Start the vLLM server:
vllm serve "devshaheen/Llama-2-7b-chat-finetune"
# Call the server using curl (OpenAI-compatible API):
curl -X POST "http://localhost:8000/v1/completions" \
-H "Content-Type: application/json" \
--data '{
"model": "devshaheen/Llama-2-7b-chat-finetune",
"prompt": "Once upon a time,",
"max_tokens": 512,
"temperature": 0.5
}'docker model run hf.co/devshaheen/Llama-2-7b-chat-finetune
How to use devshaheen/Llama-2-7b-chat-finetune with SGLang:
# Install SGLang from pip:
pip install sglang
# Start the SGLang server:
python3 -m sglang.launch_server \
--model-path "devshaheen/Llama-2-7b-chat-finetune" \
--host 0.0.0.0 \
--port 30000
# Call the server using curl (OpenAI-compatible API):
curl -X POST "http://localhost:30000/v1/completions" \
-H "Content-Type: application/json" \
--data '{
"model": "devshaheen/Llama-2-7b-chat-finetune",
"prompt": "Once upon a time,",
"max_tokens": 512,
"temperature": 0.5
}'docker run --gpus all \
--shm-size 32g \
-p 30000:30000 \
-v ~/.cache/huggingface:/root/.cache/huggingface \
--env "HF_TOKEN=<secret>" \
--ipc=host \
lmsysorg/sglang:latest \
python3 -m sglang.launch_server \
--model-path "devshaheen/Llama-2-7b-chat-finetune" \
--host 0.0.0.0 \
--port 30000
# Call the server using curl (OpenAI-compatible API):
curl -X POST "http://localhost:30000/v1/completions" \
-H "Content-Type: application/json" \
--data '{
"model": "devshaheen/Llama-2-7b-chat-finetune",
"prompt": "Once upon a time,",
"max_tokens": 512,
"temperature": 0.5
}'How to use devshaheen/Llama-2-7b-chat-finetune with Docker Model Runner:
docker model run hf.co/devshaheen/Llama-2-7b-chat-finetune
This model is a fine-tuned version of Llama-2-7B-Chat model, optimized for instruction-following tasks. It has been trained on the mlabonne/guanaco-llama2-1k dataset and is optimized for efficient text generation across various NLP tasks, including question answering, summarization, and text completion.
You can use this fine-tuned model with the Hugging Face transformers library. Below is an example of how to load and use the model for text generation.
from transformers import AutoTokenizer, AutoModelForCausalLM
# Load pre-trained model and tokenizer
tokenizer = AutoTokenizer.from_pretrained("https://huggingface.co/devshaheen/llama-2-7b-chat-finetune")
model = AutoModelForCausalLM.from_pretrained("https://huggingface.co/devshaheen/llama-2-7b-chat-finetune")
# Example text generation
input_text = "What is the capital of France?"
inputs = tokenizer(input_text, return_tensors="pt")
outputs = model.generate(**inputs)
generated_text = tokenizer.decode(outputs[0], skip_special_tokens=True)
print(generated_text)
Base model
NousResearch/Llama-2-7b-chat-hf