Instructions to use nvidia/Llama-3_3-Nemotron-Super-49B-v1_5 with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Transformers
How to use nvidia/Llama-3_3-Nemotron-Super-49B-v1_5 with Transformers:
# Use a pipeline as a high-level helper from transformers import pipeline pipe = pipeline("text-generation", model="nvidia/Llama-3_3-Nemotron-Super-49B-v1_5", trust_remote_code=True) messages = [ {"role": "user", "content": "Who are you?"}, ] pipe(messages)# Load model directly from transformers import AutoModelForCausalLM model = AutoModelForCausalLM.from_pretrained("nvidia/Llama-3_3-Nemotron-Super-49B-v1_5", trust_remote_code=True, dtype="auto") - Inference
- Local Apps Settings
- vLLM
How to use nvidia/Llama-3_3-Nemotron-Super-49B-v1_5 with vLLM:
Install from pip and serve model
# Install vLLM from pip: pip install vllm # Start the vLLM server: vllm serve "nvidia/Llama-3_3-Nemotron-Super-49B-v1_5" # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:8000/v1/chat/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "nvidia/Llama-3_3-Nemotron-Super-49B-v1_5", "messages": [ { "role": "user", "content": "What is the capital of France?" } ] }'Use Docker
docker model run hf.co/nvidia/Llama-3_3-Nemotron-Super-49B-v1_5
- SGLang
How to use nvidia/Llama-3_3-Nemotron-Super-49B-v1_5 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 "nvidia/Llama-3_3-Nemotron-Super-49B-v1_5" \ --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": "nvidia/Llama-3_3-Nemotron-Super-49B-v1_5", "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 "nvidia/Llama-3_3-Nemotron-Super-49B-v1_5" \ --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": "nvidia/Llama-3_3-Nemotron-Super-49B-v1_5", "messages": [ { "role": "user", "content": "What is the capital of France?" } ] }' - Docker Model Runner
How to use nvidia/Llama-3_3-Nemotron-Super-49B-v1_5 with Docker Model Runner:
docker model run hf.co/nvidia/Llama-3_3-Nemotron-Super-49B-v1_5
cannot import name 'NEED_SETUP_CACHE_CLASSES_MAPPING'
Hi. Currently, I can load this model using HuggingFace from_pretrained with the transformers==4.44.2.
However, I need to use it with transformers>=4.53.0. When I do that, I get the following:
model = AutoModelForCausalLM.from_pretrained(
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File ".venv/lib/python3.12/site-packages/transformers/models/auto/auto_factory.py", line 586, in from_pretrained
model_class = get_class_from_dynamic_module(
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "home.venv/lib/python3.12/site-packages/transformers/dynamic_module_utils.py", line 581, in get_class_from_dynamic_module
return get_class_in_module(class_name, final_module, force_reload=force_download)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "home.venv/lib/python3.12/site-packages/transformers/dynamic_module_utils.py", line 276, in get_class_in_module
module_spec.loader.exec_module(module)
File "<frozen importlib._bootstrap_external>", line 995, in exec_module
File "<frozen importlib._bootstrap>", line 488, in _call_with_frames_removed
File "/home/.cache/huggingface/modules/transformers_modules/Llama-3_3-Nemotron-Super-49B-v1_5/modeling_decilm.py", line 30, in <module>
from transformers.generation.utils import NEED_SETUP_CACHE_CLASSES_MAPPING, GenerationMixin, GenerateOutput
ImportError: cannot import name 'NEED_SETUP_CACHE_CLASSES_MAPPING' from 'transformers.generation.utils' (home.venv/lib/python3.12/site-packages/transformers/generation/utils.py)
Is there any solution to it? Thank you.
You can just delete the NEED_SETUP_CACHE_CLASSES_MAPPING references from the code. But then there will be no caching so decoding will be slow. I did some modifications and the caching seems to be working with the latest transformers version. My code is a bit messy right now, maybe i will do a pr later this week.