Instructions to use allenai/olmicro-2.7b-base with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Transformers
How to use allenai/olmicro-2.7b-base with Transformers:
# Use a pipeline as a high-level helper from transformers import pipeline pipe = pipeline("text-generation", model="allenai/olmicro-2.7b-base", trust_remote_code=True)# pip install -U transformers accelerate # Load model directly from transformers import AutoModelForCausalLM model = AutoModelForCausalLM.from_pretrained("allenai/olmicro-2.7b-base", trust_remote_code=True, device_map="auto") - Notebooks
- Google Colab
- Kaggle
- Local Apps Settings
- vLLM
How to use allenai/olmicro-2.7b-base with vLLM:
Install from pip and serve model
# Install vLLM from pip: pip install vllm # Start the vLLM server: vllm serve "allenai/olmicro-2.7b-base" # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:8000/v1/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "allenai/olmicro-2.7b-base", "prompt": "Once upon a time,", "max_tokens": 512, "temperature": 0.5 }'Use Docker
docker model run hf.co/allenai/olmicro-2.7b-base
- SGLang
How to use allenai/olmicro-2.7b-base 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/olmicro-2.7b-base" \ --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/olmicro-2.7b-base", "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/olmicro-2.7b-base" \ --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/olmicro-2.7b-base", "prompt": "Once upon a time,", "max_tokens": 512, "temperature": 0.5 }' - Docker Model Runner
How to use allenai/olmicro-2.7b-base with Docker Model Runner:
docker model run hf.co/allenai/olmicro-2.7b-base
Download config.json from allenai/olmicro-2.7b-base: direct link, hf CLI and curl.
- Browser
- Download file 2.03 kB
-
https://huggingface.co/allenai/olmicro-2.7b-base/resolve/main/config.json
- Command line
-
hf download hf://allenai/olmicro-2.7b-base/config.json
-
curl -L -o config.json https://huggingface.co/allenai/olmicro-2.7b-base/resolve/main/config.json
2.03 kB
| { | |
| "architectures": [ | |
| "OlmicroForCausalLM" | |
| ], | |
| "attention_bias": false, | |
| "attention_dropout": 0.0, | |
| "bos_token_id": null, | |
| "embed_scale": 39.191835884530846, | |
| "embedding_norm_eps": 1e-06, | |
| "eos_token_id": 100257, | |
| "head_dim": 128, | |
| "hidden_act": "silu", | |
| "hidden_size": 1536, | |
| "initializer_range": 0.02, | |
| "intermediate_size": 12288, | |
| "layer_types": [ | |
| "linear_attention", | |
| "linear_attention", | |
| "linear_attention", | |
| "linear_attention", | |
| "full_attention", | |
| "linear_attention", | |
| "linear_attention", | |
| "linear_attention", | |
| "linear_attention", | |
| "full_attention", | |
| "linear_attention", | |
| "linear_attention", | |
| "linear_attention", | |
| "linear_attention", | |
| "full_attention", | |
| "linear_attention", | |
| "linear_attention", | |
| "linear_attention", | |
| "linear_attention", | |
| "full_attention", | |
| "linear_attention", | |
| "linear_attention", | |
| "linear_attention", | |
| "linear_attention", | |
| "full_attention", | |
| "linear_attention", | |
| "linear_attention", | |
| "linear_attention", | |
| "linear_attention", | |
| "full_attention" | |
| ], | |
| "linear_a_log_max": 16.0, | |
| "linear_a_log_min": 0.0, | |
| "linear_allow_neg_eigval": true, | |
| "linear_conv_kernel_dim": 4, | |
| "linear_dt_init_floor": 0.0001, | |
| "linear_dt_max": 0.1, | |
| "linear_dt_min": 0.001, | |
| "linear_key_head_dim": 128, | |
| "linear_num_key_heads": 16, | |
| "linear_num_value_heads": 16, | |
| "linear_value_head_dim": 256, | |
| "max_position_embeddings": 65536, | |
| "model_type": "olmicro", | |
| "num_attention_heads": 16, | |
| "num_hidden_layers": 30, | |
| "num_key_value_heads": 8, | |
| "pad_token_id": 100277, | |
| "rms_norm_eps": 1e-06, | |
| "rope_parameters": { | |
| "rope_theta": null | |
| }, | |
| "tie_word_embeddings": false, | |
| "transformers_version": "5.12.1", | |
| "use_attention_gate": true, | |
| "use_cache": true, | |
| "use_head_qk_norm": true, | |
| "vocab_size": 100352, | |
| "auto_map": { | |
| "AutoConfig": "configuration_olmicro.OlmicroConfig", | |
| "AutoModel": "modeling_olmicro.OlmicroModel", | |
| "AutoModelForCausalLM": "modeling_olmicro.OlmicroForCausalLM" | |
| } | |
| } | |