Instructions to use mlabonne/Meta-Llama-3-120B-Instruct with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Transformers
How to use mlabonne/Meta-Llama-3-120B-Instruct with Transformers:
# Use a pipeline as a high-level helper from transformers import pipeline pipe = pipeline("text-generation", model="mlabonne/Meta-Llama-3-120B-Instruct") messages = [ {"role": "user", "content": "Who are you?"}, ] pipe(messages)# Load model directly from transformers import AutoTokenizer, AutoModelForCausalLM tokenizer = AutoTokenizer.from_pretrained("mlabonne/Meta-Llama-3-120B-Instruct") model = AutoModelForCausalLM.from_pretrained("mlabonne/Meta-Llama-3-120B-Instruct", device_map="auto") messages = [ {"role": "user", "content": "Who are you?"}, ] inputs = tokenizer.apply_chat_template( messages, add_generation_prompt=True, tokenize=True, return_dict=True, return_tensors="pt", ).to(model.device) outputs = model.generate(**inputs, max_new_tokens=40) print(tokenizer.decode(outputs[0][inputs["input_ids"].shape[-1]:])) - Notebooks
- Google Colab
- Kaggle
- Local Apps Settings
- vLLM
How to use mlabonne/Meta-Llama-3-120B-Instruct with vLLM:
Install from pip and serve model
# Install vLLM from pip: pip install vllm # Start the vLLM server: vllm serve "mlabonne/Meta-Llama-3-120B-Instruct" # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:8000/v1/chat/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "mlabonne/Meta-Llama-3-120B-Instruct", "messages": [ { "role": "user", "content": "What is the capital of France?" } ] }'Use Docker
docker model run hf.co/mlabonne/Meta-Llama-3-120B-Instruct
- SGLang
How to use mlabonne/Meta-Llama-3-120B-Instruct 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/Meta-Llama-3-120B-Instruct" \ --host 0.0.0.0 \ --port 30000 # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:30000/v1/chat/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "mlabonne/Meta-Llama-3-120B-Instruct", "messages": [ { "role": "user", "content": "What is the capital of France?" } ] }'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/Meta-Llama-3-120B-Instruct" \ --host 0.0.0.0 \ --port 30000 # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:30000/v1/chat/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "mlabonne/Meta-Llama-3-120B-Instruct", "messages": [ { "role": "user", "content": "What is the capital of France?" } ] }' - Docker Model Runner
How to use mlabonne/Meta-Llama-3-120B-Instruct with Docker Model Runner:
docker model run hf.co/mlabonne/Meta-Llama-3-120B-Instruct
Attention, stupid question
Does combining models into one actually make a lot of sense? Are we really getting +50B parameters that really affect the work or is everything not as smooth as it might seem? For some reason, it seems to me that combining them is not very effective, since the models have similar neurons. How is this problem solved during model merging? Correct me if I'm wrong somewhere. I'm just guessing a lot, but I don't really know anything.
I wouldn't be surprised if I get a response along the lines of "I don't know, it just works the way I think it does."
In general, efficiently combining models results in compressing the information contained in the weights, which explains the performance boost we observe.
In this case, the self-merge provides extra layers for additional processing, allowing the model to refine the inputs even more. Because it hasn't been fine-tuned, results can be quite chaotic. Typically, this doesn't work well with small models. I can't give a good explanation for why it works for this specific merge, but it looks like the extra processing helps in creative tasks but can degrade the quality for other prompts (like reasoning).
I just wanted to say, this model is amazing! I've been building an assistant with it and comparing it along the way to 70B and there is something about this one that is magical. The outputs are different, the style, the personality. Even when it comes to reasoning I've noticed that its seeming desire to want to solve the problem often more than makes up for whatever quirks it has.