Instructions to use allenai/OLMo-1B with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Transformers
How to use allenai/OLMo-1B with Transformers:
# Use a pipeline as a high-level helper from transformers import pipeline pipe = pipeline("text-generation", model="allenai/OLMo-1B", trust_remote_code=True)# Load model directly from transformers import AutoModelForCausalLM model = AutoModelForCausalLM.from_pretrained("allenai/OLMo-1B", trust_remote_code=True, device_map="auto") - Notebooks
- Google Colab
- Kaggle
- Local Apps Settings
- vLLM
How to use allenai/OLMo-1B with vLLM:
Install from pip and serve model
# Install vLLM from pip: pip install vllm # Start the vLLM server: vllm serve "allenai/OLMo-1B" # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:8000/v1/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "allenai/OLMo-1B", "prompt": "Once upon a time,", "max_tokens": 512, "temperature": 0.5 }'Use Docker
docker model run hf.co/allenai/OLMo-1B
- SGLang
How to use allenai/OLMo-1B 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-1B" \ --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": "allenai/OLMo-1B", "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 "allenai/OLMo-1B" \ --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": "allenai/OLMo-1B", "prompt": "Once upon a time,", "max_tokens": 512, "temperature": 0.5 }' - Docker Model Runner
How to use allenai/OLMo-1B with Docker Model Runner:
docker model run hf.co/allenai/OLMo-1B
Do not find weights for classifier head (a Liner layer) in 'pytorch_model.bin'
#6
by ExcitingMe - opened
I printed out all state dict and didn't find the weights for classifier head. I'm wondering why is it the case.
model.transformer.wte.weight: [50304, 2048]
model.transformer.blocks.0.attn_out.weight: [2048, 2048]
model.transformer.blocks.0.ff_out.weight: [2048, 8192]
model.transformer.blocks.0.att_proj.weight: [6144, 2048]
model.transformer.blocks.0.ff_proj.weight: [16384, 2048]
model.transformer.blocks.1.attn_out.weight: [2048, 2048]
model.transformer.blocks.1.ff_out.weight: [2048, 8192]
model.transformer.blocks.1.att_proj.weight: [6144, 2048]
model.transformer.blocks.1.ff_proj.weight: [16384, 2048]
model.transformer.blocks.2.attn_out.weight: [2048, 2048]
model.transformer.blocks.2.ff_out.weight: [2048, 8192]
model.transformer.blocks.2.att_proj.weight: [6144, 2048]
model.transformer.blocks.2.ff_proj.weight: [16384, 2048]
model.transformer.blocks.3.attn_out.weight: [2048, 2048]
model.transformer.blocks.3.ff_out.weight: [2048, 8192]
model.transformer.blocks.3.att_proj.weight: [6144, 2048]
model.transformer.blocks.3.ff_proj.weight: [16384, 2048]
model.transformer.blocks.4.attn_out.weight: [2048, 2048]
model.transformer.blocks.4.ff_out.weight: [2048, 8192]
model.transformer.blocks.4.att_proj.weight: [6144, 2048]
model.transformer.blocks.4.ff_proj.weight: [16384, 2048]
model.transformer.blocks.5.attn_out.weight: [2048, 2048]
model.transformer.blocks.5.ff_out.weight: [2048, 8192]
model.transformer.blocks.5.att_proj.weight: [6144, 2048]
model.transformer.blocks.5.ff_proj.weight: [16384, 2048]
model.transformer.blocks.6.attn_out.weight: [2048, 2048]
model.transformer.blocks.6.ff_out.weight: [2048, 8192]
model.transformer.blocks.6.att_proj.weight: [6144, 2048]
model.transformer.blocks.6.ff_proj.weight: [16384, 2048]
model.transformer.blocks.7.attn_out.weight: [2048, 2048]
model.transformer.blocks.7.ff_out.weight: [2048, 8192]
model.transformer.blocks.7.att_proj.weight: [6144, 2048]
model.transformer.blocks.7.ff_proj.weight: [16384, 2048]
model.transformer.blocks.8.attn_out.weight: [2048, 2048]
model.transformer.blocks.8.ff_out.weight: [2048, 8192]
model.transformer.blocks.8.att_proj.weight: [6144, 2048]
model.transformer.blocks.8.ff_proj.weight: [16384, 2048]
model.transformer.blocks.9.attn_out.weight: [2048, 2048]
model.transformer.blocks.9.ff_out.weight: [2048, 8192]
model.transformer.blocks.9.att_proj.weight: [6144, 2048]
model.transformer.blocks.9.ff_proj.weight: [16384, 2048]
model.transformer.blocks.10.attn_out.weight: [2048, 2048]
model.transformer.blocks.10.ff_out.weight: [2048, 8192]
model.transformer.blocks.10.att_proj.weight: [6144, 2048]
model.transformer.blocks.10.ff_proj.weight: [16384, 2048]
model.transformer.blocks.11.attn_out.weight: [2048, 2048]
model.transformer.blocks.11.ff_out.weight: [2048, 8192]
model.transformer.blocks.11.att_proj.weight: [6144, 2048]
model.transformer.blocks.11.ff_proj.weight: [16384, 2048]
model.transformer.blocks.12.attn_out.weight: [2048, 2048]
model.transformer.blocks.12.ff_out.weight: [2048, 8192]
model.transformer.blocks.12.att_proj.weight: [6144, 2048]
model.transformer.blocks.12.ff_proj.weight: [16384, 2048]
model.transformer.blocks.13.attn_out.weight: [2048, 2048]
model.transformer.blocks.13.ff_out.weight: [2048, 8192]
model.transformer.blocks.13.att_proj.weight: [6144, 2048]
model.transformer.blocks.13.ff_proj.weight: [16384, 2048]
model.transformer.blocks.14.attn_out.weight: [2048, 2048]
model.transformer.blocks.14.ff_out.weight: [2048, 8192]
model.transformer.blocks.14.att_proj.weight: [6144, 2048]
model.transformer.blocks.14.ff_proj.weight: [16384, 2048]
model.transformer.blocks.15.attn_out.weight: [2048, 2048]
model.transformer.blocks.15.ff_out.weight: [2048, 8192]
model.transformer.blocks.15.att_proj.weight: [6144, 2048]
model.transformer.blocks.15.ff_proj.weight: [16384, 2048]
The model is using weight tying: it shares its embedding layer weight with the classification head.
I got it, thx.
ExcitingMe changed discussion status to closed