Instructions to use TheBloke/Llama-2-7B-32K-Instruct-GPTQ with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Transformers
How to use TheBloke/Llama-2-7B-32K-Instruct-GPTQ with Transformers:
# Use a pipeline as a high-level helper from transformers import pipeline pipe = pipeline("text-generation", model="TheBloke/Llama-2-7B-32K-Instruct-GPTQ", trust_remote_code=True)# Load model directly from transformers import AutoTokenizer, AutoModelForCausalLM tokenizer = AutoTokenizer.from_pretrained("TheBloke/Llama-2-7B-32K-Instruct-GPTQ", trust_remote_code=True) model = AutoModelForCausalLM.from_pretrained("TheBloke/Llama-2-7B-32K-Instruct-GPTQ", trust_remote_code=True, device_map="auto") - Notebooks
- Google Colab
- Kaggle
- Local Apps Settings
- vLLM
How to use TheBloke/Llama-2-7B-32K-Instruct-GPTQ with vLLM:
Install from pip and serve model
# Install vLLM from pip: pip install vllm # Start the vLLM server: vllm serve "TheBloke/Llama-2-7B-32K-Instruct-GPTQ" # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:8000/v1/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "TheBloke/Llama-2-7B-32K-Instruct-GPTQ", "prompt": "Once upon a time,", "max_tokens": 512, "temperature": 0.5 }'Use Docker
docker model run hf.co/TheBloke/Llama-2-7B-32K-Instruct-GPTQ
- SGLang
How to use TheBloke/Llama-2-7B-32K-Instruct-GPTQ with SGLang:
Install from pip and serve model
# Install SGLang from pip: pip install sglang # Start the SGLang server: python3 -m sglang.launch_server \ --model-path "TheBloke/Llama-2-7B-32K-Instruct-GPTQ" \ --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": "TheBloke/Llama-2-7B-32K-Instruct-GPTQ", "prompt": "Once upon a time,", "max_tokens": 512, "temperature": 0.5 }'Use Docker images
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 "TheBloke/Llama-2-7B-32K-Instruct-GPTQ" \ --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": "TheBloke/Llama-2-7B-32K-Instruct-GPTQ", "prompt": "Once upon a time,", "max_tokens": 512, "temperature": 0.5 }' - Docker Model Runner
How to use TheBloke/Llama-2-7B-32K-Instruct-GPTQ with Docker Model Runner:
docker model run hf.co/TheBloke/Llama-2-7B-32K-Instruct-GPTQ
Fine tuning this model further
Hey pal,
You're really doing a wonderful job. For me, it was really impossible to do some experiment without your help.
I understand you're extremely busy. I want to fine tune this model a bit further. Just can't figure out the right structure of the dataset formatting of this model (for fine tuning). Appreciate if you shed some light on the structure...
[
{
"prompt": "[INST]\nWrite a poem about cats\n[/INST]\n\n",
"completion": "Cats are mysterious creatures, Fur soft as silk, eyes bright as beacons, Paws pads gently treading, whiskers twitching, Always aware, lightning quick reactions, Master hunters yet gentle companions, Purring softly curved in lap's crevice, Playful yet wise, noble and wily, Our feline friends both fondness and fear elicit."
},
{
"prompt": "[INST]\nExplain how machine learning works\n[/INST]\n\n",
"completion": "Machine learning is a subset of artificial intelligence where models are trained to find patterns and make predictions or decisions without being explicitly programmed. The models learn from data to detect features and relationships. Common algorithms include neural networks, random forests, support vector machines..."
}
]