Instructions to use allenai/Olmo-3-7B-Think with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Transformers
How to use allenai/Olmo-3-7B-Think with Transformers:
# Use a pipeline as a high-level helper from transformers import pipeline pipe = pipeline("text-generation", model="allenai/Olmo-3-7B-Think") messages = [ {"role": "user", "content": "Who are you?"}, ] pipe(messages)# Load model directly from transformers import AutoTokenizer, AutoModelForCausalLM tokenizer = AutoTokenizer.from_pretrained("allenai/Olmo-3-7B-Think") model = AutoModelForCausalLM.from_pretrained("allenai/Olmo-3-7B-Think") 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
- vLLM
How to use allenai/Olmo-3-7B-Think with vLLM:
Install from pip and serve model
# Install vLLM from pip: pip install vllm # Start the vLLM server: vllm serve "allenai/Olmo-3-7B-Think" # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:8000/v1/chat/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "allenai/Olmo-3-7B-Think", "messages": [ { "role": "user", "content": "What is the capital of France?" } ] }'Use Docker
docker model run hf.co/allenai/Olmo-3-7B-Think
- SGLang
How to use allenai/Olmo-3-7B-Think 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 "allenai/Olmo-3-7B-Think" \ --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": "allenai/Olmo-3-7B-Think", "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 "allenai/Olmo-3-7B-Think" \ --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": "allenai/Olmo-3-7B-Think", "messages": [ { "role": "user", "content": "What is the capital of France?" } ] }' - Docker Model Runner
How to use allenai/Olmo-3-7B-Think with Docker Model Runner:
docker model run hf.co/allenai/Olmo-3-7B-Think
Define "do_sample" explicitly in generation_config.json
Hi again :)
I also got the following error when loading the model:
model = AutoModelForCausalLM.from_pretrained(MODEL_ID, dtype=torch.bfloat16, low_cpu_mem_usage=True, device_map="cuda", local_files_only=True)
Loading checkpoint shards: 100%|ββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ| 3/3 [00:10<00:00, 3.42s/it]
The following generation flags are not valid and may be ignored: ['temperature', 'top_p']. SetTRANSFORMERS_VERBOSITY=infofor more details.
When trying to save the model, it says that the default value for "do_sample" is false when not explicitly defined.
model.save_pretrained(SAVE_DIR, safe_serialization=True, max_shard_size="10GB")
2025-11-28T17:19:45.738718+0100 | get_model_compressor | INFO - skip_sparsity_compression_stats set to True. Skipping sparsity compression statistic calculations. No sparsity compressor will be applied.
Compressing model: 224it [00:05, 40.05it/s]
Traceback (most recent call last):
File "/home/thibaut/tools/llm-compressor/.venv/lib/python3.12/site-packages/transformers/generation/configuration_utils.py", line 723, in save_pretrained
self.validate(strict=True)
File "/home/thibaut/tools/llm-compressor/.venv/lib/python3.12/site-packages/transformers/generation/configuration_utils.py", line 684, in validate
raise ValueError("GenerationConfig is invalid: \n" + info_message)
ValueError: GenerationConfig is invalid:temperature:do_sampleis set toFalse. However,temperatureis set to0.6-- this flag is only used in sample-based generation modes. You should setdo_sample=Trueor unsettemperature.top_p:do_sampleis set toFalse. However,top_pis set to0.95-- this flag is only used in sample-based generation modes. You should setdo_sample=Trueor unsettop_p.
If you're using a pretrained model, note that some of these attributes may be set through the model'sgeneration_config.jsonfile.
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "", line 1, in
File "/home/thibaut/tools/llm-compressor/.venv/lib/python3.12/site-packages/llmcompressor/transformers/compression/compressed_tensors_utils.py", line 96, in save_pretrained_wrapper
original_save_pretrained.get(model, model_class)(
File "/home/thibaut/tools/llm-compressor/.venv/lib/python3.12/site-packages/transformers/modeling_utils.py", line 3930, in save_pretrained
model_to_save.generation_config.save_pretrained(save_directory)
File "/home/thibaut/tools/llm-compressor/.venv/lib/python3.12/site-packages/transformers/generation/configuration_utils.py", line 725, in save_pretrained
raise ValueError(str(exc) + "\n\nFix these issues to save the configuration.")
ValueError: GenerationConfig is invalid:temperature:do_sampleis set toFalse. However,temperatureis set to0.6-- this flag is only used in sample-based generation modes. You should setdo_sample=Trueor unsettemperature.top_p:do_sampleis set toFalse. However,top_pis set to0.95-- this flag is only used in sample-based generation modes. You should setdo_sample=Trueor unsettop_p.
If you're using a pretrained model, note that some of these attributes may be set through the model'sgeneration_config.jsonfile.
Fix these issues to save the configuration.
Hi there, thanks for the PR! Merged :)