Instructions to use meta-llama/Meta-Llama-3-70B-Instruct with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Transformers
How to use meta-llama/Meta-Llama-3-70B-Instruct with Transformers:
# Use a pipeline as a high-level helper from transformers import pipeline pipe = pipeline("text-generation", model="meta-llama/Meta-Llama-3-70B-Instruct") messages = [ {"role": "user", "content": "Who are you?"}, ] pipe(messages)# Load model directly from transformers import AutoTokenizer, AutoModelForCausalLM tokenizer = AutoTokenizer.from_pretrained("meta-llama/Meta-Llama-3-70B-Instruct") model = AutoModelForCausalLM.from_pretrained("meta-llama/Meta-Llama-3-70B-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]:])) - Inference
- Notebooks
- Google Colab
- Kaggle
- Local Apps Settings
- vLLM
How to use meta-llama/Meta-Llama-3-70B-Instruct with vLLM:
Install from pip and serve model
# Install vLLM from pip: pip install vllm # Start the vLLM server: vllm serve "meta-llama/Meta-Llama-3-70B-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": "meta-llama/Meta-Llama-3-70B-Instruct", "messages": [ { "role": "user", "content": "What is the capital of France?" } ] }'Use Docker
docker model run hf.co/meta-llama/Meta-Llama-3-70B-Instruct
- SGLang
How to use meta-llama/Meta-Llama-3-70B-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 "meta-llama/Meta-Llama-3-70B-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": "meta-llama/Meta-Llama-3-70B-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 "meta-llama/Meta-Llama-3-70B-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": "meta-llama/Meta-Llama-3-70B-Instruct", "messages": [ { "role": "user", "content": "What is the capital of France?" } ] }' - Docker Model Runner
How to use meta-llama/Meta-Llama-3-70B-Instruct with Docker Model Runner:
docker model run hf.co/meta-llama/Meta-Llama-3-70B-Instruct
Issue with Deprecated Arguments in AutoTrain Advanced for LLaMA 3 (70B) - DPO
Hello Hugging Face Community,
I am currently fine-tuning a LLaMA 3 model using AutoTrain Advanced on the Hugging Face platform. However, I encountered an issue related to deprecated arguments. Here are the details of my setup and the error messages:
- Base Model: meta-llama/Meta-Llama-3-70B-Instruct
- Task: LLM DPO
- Hardware: Local/Space -> 4xL4
- Parameter Mode: Full
Error Message:
INFO | 2024-06-28 12:25:00 | autotrain.trainers.clm.train_clm_dpo:train:57 - Using PEFT, model_ref will be set to None
INFO | 2024-06-28 12:25:00 | autotrain.trainers.clm.train_clm_dpo:train:78 - model dtype: torch.float16
INFO | 2024-06-28 12:25:00 | autotrain.trainers.clm.train_clm_dpo:train:95 - creating trainer
/app/env/lib/python3.10/site-packages/huggingface_hub/utils/_deprecation.py:100: FutureWarning: Deprecated argument(s) used in '__init__': max_length, max_prompt_length. Will not be supported from version '1.0.0'.
Deprecated positional argument(s) used in DPOTrainer, please use the DPOConfig to set these arguments instead.
warnings.warn(message, FutureWarning)
ERROR | 2024-06-28 12:25:01 | autotrain.trainers.common:wrapper:120 - train has failed due to an exception: Traceback (most recent call last):
File "/app/env/lib/python3.10/site-packages/autotrain/trainers/common.py", line 117, in wrapper
return func(*args, **kwargs)
File "/app/env/lib/python3.10/site-packages/autotrain/trainers/clm/__main__.py", line 38, in train
train_dpo(config)
File "/app/env/lib/python3.10/site-packages/autotrain/trainers/clm/train_clm_dpo.py", line 103, in train
trainer = DPOTrainer(
File "/app/env/lib/python3.10/site-packages/huggingface_hub/utils/_deprecation.py", line 101, in inner_f
return f(*args, **kwargs)
File "/app/env/lib/python3.10/site-packages/trl/trainer/dpo_trainer.py", line 174, in __init__
if args.model_init_kwargs is None:
AttributeError: 'TrainingArguments' object has no attribute 'model_init_kwargs'
Request for Assistance:
I am seeking guidance on how to properly configure the DPOTrainer using the DPOConfig within the AutoTrain Advanced interface or through a custom configuration file. Specifically, how can I resolve the deprecated argument issue (max_length, max_prompt_length) and the model_init_kwargs attribute error?
Here is a screenshot of my current setup in AutoTrain Advanced:
Thank you in advance for your help!
Best regards,
Guus Bouwens
@GuusBouwensNL Did you ever find a solution to this problem? I am currently facing the same exact issue with Llama 3.1 8B DPO
downgrading trl==0.8.1 works for me
