Instructions to use mlabonne/dummy-llama-2 with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Transformers
How to use mlabonne/dummy-llama-2 with Transformers:
# Use a pipeline as a high-level helper from transformers import pipeline pipe = pipeline("text-generation", model="mlabonne/dummy-llama-2")# Load model directly from transformers import AutoTokenizer, AutoModelForCausalLM tokenizer = AutoTokenizer.from_pretrained("mlabonne/dummy-llama-2") model = AutoModelForCausalLM.from_pretrained("mlabonne/dummy-llama-2") - Notebooks
- Google Colab
- Kaggle
- Local Apps
- vLLM
How to use mlabonne/dummy-llama-2 with vLLM:
Install from pip and serve model
# Install vLLM from pip: pip install vllm # Start the vLLM server: vllm serve "mlabonne/dummy-llama-2" # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:8000/v1/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "mlabonne/dummy-llama-2", "prompt": "Once upon a time,", "max_tokens": 512, "temperature": 0.5 }'Use Docker
docker model run hf.co/mlabonne/dummy-llama-2
- SGLang
How to use mlabonne/dummy-llama-2 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 "mlabonne/dummy-llama-2" \ --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": "mlabonne/dummy-llama-2", "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 "mlabonne/dummy-llama-2" \ --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": "mlabonne/dummy-llama-2", "prompt": "Once upon a time,", "max_tokens": 512, "temperature": 0.5 }' - Docker Model Runner
How to use mlabonne/dummy-llama-2 with Docker Model Runner:
docker model run hf.co/mlabonne/dummy-llama-2
dummy-llama-2
This is a dummy version of the model based on meta-llama/Llama-2-7b-hf.
π§© Dummy
dummy-llama-2 has a size of 929.07 MB instead of the original 13476.98 MB (compression factor of 14.51) but keeps the base model's functionality.
The purpose of this dummy version is to be used for debugging, so you don't have to download the entire original model. Do not use it for inference.
π» Usage
# pip install transformers accelerate
from transformers import AutoModelForCausalLM, AutoTokenizer
import torch
model = "dummy-llama-2"
tokenizer = AutoTokenizer.from_pretrained(model)
model = AutoModelForCausalLM.from_pretrained(
model,
low_cpu_mem_usage=True,
return_dict=True,
torch_dtype=torch.float16,
device_map={"": 0},
)
- Downloads last month
- 13