Text Generation
Transformers
Safetensors
English
olmicro
olmo
hybrid
gated-deltanet
sft
chat
conversational
custom_code
Run this model with HF Jobs
Run salyamq/olmicro-2.7b-instruct on Hugging Face's managed compute, monitor its progress, and retrieve the results when it's done.
Paste one of these prompts into your coding agent:
Fine-tune on my dataset
Use HF Jobs and TRL to fine-tune https://huggingface.co/salyamq/olmicro-2.7b-instruct. Ask me which dataset to train on, then push the fine-tuned model to a new model repo. Run `hf jobs --help` first to learn the CLI.
Run batch inference
Use HF Jobs to run batch inference with https://huggingface.co/salyamq/olmicro-2.7b-instruct on the inputs in a mounted HF Bucket. Ask me which Bucket to use, then write the outputs back to it and keep each input ID. Run `hf jobs --help` first to learn the CLI.
Evaluate on a benchmark
Use HF Jobs to evaluate https://huggingface.co/salyamq/olmicro-2.7b-instruct. Ask me which benchmark to run, then save the scores and the per-example results to a new dataset repo. Run `hf jobs --help` first to learn the CLI.
Quantize for lower memory use
Use HF Jobs to create a 4-bit version of https://huggingface.co/salyamq/olmicro-2.7b-instruct. Push it to a new model repo, then reload it from there and report its memory footprint. Run `hf jobs --help` first to learn the CLI.
Instructions to use salyamq/olmicro-2.7b-instruct with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Transformers
How to use salyamq/olmicro-2.7b-instruct with Transformers:
# Use a pipeline as a high-level helper from transformers import pipeline pipe = pipeline("text-generation", model="salyamq/olmicro-2.7b-instruct", trust_remote_code=True) messages = [ {"role": "user", "content": "Who are you?"}, ] pipe(messages)# pip install -U transformers accelerate # Load model directly from transformers import AutoModelForCausalLM model = AutoModelForCausalLM.from_pretrained("salyamq/olmicro-2.7b-instruct", trust_remote_code=True, device_map="auto") - Notebooks
- Google Colab
- Kaggle
- Local Apps Settings
- vLLM
How to use salyamq/olmicro-2.7b-instruct with vLLM:
Install from pip and serve model
# Install vLLM from pip: pip install vllm # Start the vLLM server: vllm serve "salyamq/olmicro-2.7b-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": "salyamq/olmicro-2.7b-instruct", "messages": [ { "role": "user", "content": "What is the capital of France?" } ] }'Use Docker
docker model run hf.co/salyamq/olmicro-2.7b-instruct
- SGLang
How to use salyamq/olmicro-2.7b-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 "salyamq/olmicro-2.7b-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": "salyamq/olmicro-2.7b-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 "salyamq/olmicro-2.7b-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": "salyamq/olmicro-2.7b-instruct", "messages": [ { "role": "user", "content": "What is the capital of France?" } ] }' - Docker Model Runner
How to use salyamq/olmicro-2.7b-instruct with Docker Model Runner:
docker model run hf.co/salyamq/olmicro-2.7b-instruct
Download configuration_olmicro.py from salyamq/olmicro-2.7b-instruct: direct link, hf CLI and curl.
- Browser
- Download file 8.6 kB
-
https://huggingface.co/salyamq/olmicro-2.7b-instruct/resolve/main/configuration_olmicro.py
- Command line
-
hf download hf://salyamq/olmicro-2.7b-instruct/configuration_olmicro.py
-
curl -L -o configuration_olmicro.py https://huggingface.co/salyamq/olmicro-2.7b-instruct/resolve/main/configuration_olmicro.py
8.6 kB
| # π¨π¨π¨π¨π¨π¨π¨π¨π¨π¨π¨π¨π¨π¨π¨π¨π¨π¨π¨π¨π¨π¨π¨π¨π¨π¨π¨π¨π¨π¨π¨π¨π¨π¨π¨π¨π¨π¨π¨π¨π¨π¨π¨π¨π¨π¨π¨π¨ | |
| # This file was automatically generated from src/transformers/models/olmicro/modular_olmicro.py. | |
| # Do NOT edit this file manually as any edits will be overwritten by the generation of | |
| # the file from the modular. If any change should be done, please apply the change to the | |
| # modular_olmicro.py file directly. One of our CI enforces this. | |
| # π¨π¨π¨π¨π¨π¨π¨π¨π¨π¨π¨π¨π¨π¨π¨π¨π¨π¨π¨π¨π¨π¨π¨π¨π¨π¨π¨π¨π¨π¨π¨π¨π¨π¨π¨π¨π¨π¨π¨π¨π¨π¨π¨π¨π¨π¨π¨π¨ | |
| # Copyright 2026 the HuggingFace Team. All rights reserved. | |
| # | |
| # Licensed under the Apache License, Version 2.0 (the "License"); | |
| # you may not use this file except in compliance with the License. | |
| # You may obtain a copy of the License at | |
| # | |
| # http://www.apache.org/licenses/LICENSE-2.0 | |
| # | |
| # Unless required by applicable law or agreed to in writing, software | |
| # distributed under the License is distributed on an "AS IS" BASIS, | |
| # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | |
| # See the License for the specific language governing permissions and | |
| # limitations under the License. | |
| import math | |
| from huggingface_hub.dataclasses import strict | |
| from transformers.configuration_utils import PreTrainedConfig | |
| from transformers.modeling_rope_utils import RopeParameters | |
| from transformers.utils import auto_docstring | |
| from transformers.utils.type_validators import interval | |
| class OlmicroConfig(PreTrainedConfig): | |
| r""" | |
| embed_scale (`float`, *optional*): | |
| Scaling factor applied to embeddings. Defaults to `sqrt(hidden_size)` if not set. | |
| embedding_norm_eps (`float`, *optional*, defaults to 1e-6): | |
| Epsilon for the RMSNorm applied after embedding scaling. | |
| use_attention_gate (`bool`, *optional*, defaults to `True`): | |
| Whether to apply an elementwise sigmoid gate on the full attention output (before o_proj). | |
| use_head_qk_norm (`bool`, *optional*, defaults to `True`): | |
| Whether to use per-head QK normalization (norm of size head_dim per head) instead of | |
| full-dim norm (norm of size num_heads * head_dim). | |
| linear_num_key_heads (`int`, *optional*): | |
| Number of key heads for the linear attention layers. Defaults to `num_attention_heads`. | |
| linear_num_value_heads (`int`, *optional*): | |
| Number of value heads for the linear attention layers. Defaults to `num_attention_heads`. | |
| linear_key_head_dim (`int`, *optional*): | |
| Dimension of each key head in linear attention layers. Defaults to `head_dim`. | |
| linear_value_head_dim (`int`, *optional*): | |
| Dimension of each value head in linear attention layers. Defaults to `2 * linear_key_head_dim`. | |
| linear_a_log_min (`float`, *optional*, defaults to 0.0): | |
| Minimum value for uniform initialization of A_log in GatedDeltaNet layers. | |
| linear_a_log_max (`float`, *optional*, defaults to 16.0): | |
| Maximum value for uniform initialization of A_log in GatedDeltaNet layers. | |
| linear_dt_min (`float`, *optional*, defaults to 0.001): | |
| Minimum value for dt initialization in GatedDeltaNet layers. | |
| linear_dt_max (`float`, *optional*, defaults to 0.1): | |
| Maximum value for dt initialization in GatedDeltaNet layers. | |
| linear_dt_init_floor (`float`, *optional*, defaults to 0.0001): | |
| Floor value for clamping dt during initialization in GatedDeltaNet layers. | |
| linear_conv_kernel_dim (`int`, *optional*, defaults to 4): | |
| Kernel size for the short convolution applied to queries, keys, and values in linear attention layers. | |
| linear_allow_neg_eigval (`bool`, *optional*, defaults to `True`): | |
| Whether to allow negative eigenvalues in the GatedDeltaNet recurrence. | |
| Example: | |
| ```python | |
| >>> from transformers import OlmicroModel, OlmicroConfig | |
| >>> # Initializing an Olmicro style configuration | |
| >>> configuration = OlmicroConfig() | |
| >>> # Initializing a model from the Olmicro style configuration | |
| >>> model = OlmicroModel(configuration) | |
| >>> # Accessing the model configuration | |
| >>> configuration = model.config | |
| ``` | |
| """ | |
| model_type = "olmicro" | |
| keys_to_ignore_at_inference = ["past_key_values"] | |
| base_model_tp_plan = { | |
| "layers.*.self_attn.q_proj": "colwise_gather_output", # we need to replicate here due to the added norm on q and k | |
| "layers.*.self_attn.k_proj": "colwise_gather_output", # we need to replicate here due to the added norm on q and k | |
| "layers.*.self_attn.v_proj": "colwise_gather_output", # we need to replicate here due to the added norm on q and k | |
| "layers.*.self_attn.o_proj": "rowwise_split_input", # input is replicated due to the added norm on q and k | |
| "layers.*.mlp.gate_proj": "colwise", | |
| "layers.*.mlp.up_proj": "colwise", | |
| "layers.*.mlp.down_proj": "rowwise", | |
| } | |
| base_model_pp_plan = { | |
| "embed_tokens": (["input_ids"], ["inputs_embeds"]), | |
| "layers": (["hidden_states", "attention_mask"], ["hidden_states"]), | |
| "norm": (["hidden_states"], ["hidden_states"]), | |
| } | |
| vocab_size: int = 100352 | |
| # Override defaults from parent | |
| hidden_size: int = 640 | |
| intermediate_size: int = 5120 | |
| num_hidden_layers: int = 10 | |
| num_attention_heads: int = 8 | |
| num_key_value_heads: int = 8 | |
| hidden_act: str = "silu" | |
| max_position_embeddings: int = 8192 | |
| initializer_range: float = interval(min=0.0, max=1.0)(default=0.02) | |
| rms_norm_eps: float = 1e-6 | |
| use_cache: bool = True | |
| pad_token_id: int | None = 100277 | |
| bos_token_id: int | None = None | |
| eos_token_id: int | list[int] | None = 100257 | |
| tie_word_embeddings: bool = False | |
| rope_parameters: RopeParameters | dict | None = None | |
| attention_bias: bool = False | |
| attention_dropout: int | float | None = 0.0 | |
| layer_types: list[str] | None = None | |
| linear_num_key_heads: int | None = None | |
| linear_num_value_heads: int | None = None | |
| linear_key_head_dim: int | None = None | |
| linear_value_head_dim: int | None = None | |
| linear_a_log_min: float = 0.0 | |
| linear_a_log_max: float = 16.0 | |
| linear_dt_min: float = 0.001 | |
| linear_dt_max: float = 0.1 | |
| linear_dt_init_floor: float = 1e-4 | |
| linear_conv_kernel_dim: int = 4 | |
| linear_allow_neg_eigval: bool = True | |
| # New attributes | |
| embed_scale: float | None = None | |
| embedding_norm_eps: float = 1e-6 | |
| use_attention_gate: bool = True | |
| use_head_qk_norm: bool = True | |
| head_dim: int = 128 | |
| def __post_init__(self, **kwargs): | |
| if self.layer_types is None: | |
| # Default: 4 GDN layers + 1 full attention, repeating (4:1 ratio) | |
| self.layer_types = ["linear_attention"] * int(self.num_hidden_layers) | |
| for i in range(int(self.num_hidden_layers)): | |
| if i % 5 == 4: | |
| self.layer_types[i] = "full_attention" | |
| # Ensure at least one full attention layer | |
| if "full_attention" not in self.layer_types: | |
| self.layer_types[-1] = "full_attention" | |
| if self.embed_scale is None: | |
| self.embed_scale = math.sqrt(self.hidden_size) | |
| if self.linear_num_key_heads is None: | |
| self.linear_num_key_heads = self.num_attention_heads | |
| if self.linear_num_value_heads is None: | |
| self.linear_num_value_heads = self.num_attention_heads | |
| if self.linear_key_head_dim is None: | |
| self.linear_key_head_dim = self.head_dim | |
| if self.linear_value_head_dim is None: | |
| self.linear_value_head_dim = 2 * self.linear_key_head_dim | |
| super().__post_init__(**kwargs) | |
| def validate_architecture(self): | |
| """Part of `@strict`-powered validation. Validates the architecture of the config.""" | |
| if "linear_attention" not in self.layer_types: | |
| raise ValueError("Olmicro expects at least one 'linear_attention' layer.") | |
| if all(t == "linear_attention" for t in self.layer_types): | |
| raise ValueError("Olmicro expects at least one attention layer.") | |
| def convert_rope_params_to_dict(self, **kwargs): | |
| # NoPE model: skip RoPE parameter standardization entirely to prevent | |
| # Transformers from filling in default rope_theta/rope_type values. | |
| return kwargs | |
| __all__ = ["OlmicroConfig"] | |