Text Generation
Transformers
Safetensors
code
ivme_coder
language-model
transformer
rope
swiglu
muon
from-scratch
tiny
small
decoder-only
python
custom_code
Instructions to use IvmeLabs/Ivme-Coder-v1 with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Transformers
How to use IvmeLabs/Ivme-Coder-v1 with Transformers:
# Use a pipeline as a high-level helper from transformers import pipeline pipe = pipeline("text-generation", model="IvmeLabs/Ivme-Coder-v1", trust_remote_code=True)# Load model directly from transformers import AutoModelForCausalLM model = AutoModelForCausalLM.from_pretrained("IvmeLabs/Ivme-Coder-v1", trust_remote_code=True, device_map="auto") - Notebooks
- Google Colab
- Kaggle
- Local Apps Settings
- vLLM
How to use IvmeLabs/Ivme-Coder-v1 with vLLM:
Install from pip and serve model
# Install vLLM from pip: pip install vllm # Start the vLLM server: vllm serve "IvmeLabs/Ivme-Coder-v1" # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:8000/v1/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "IvmeLabs/Ivme-Coder-v1", "prompt": "Once upon a time,", "max_tokens": 512, "temperature": 0.5 }'Use Docker
docker model run hf.co/IvmeLabs/Ivme-Coder-v1
- SGLang
How to use IvmeLabs/Ivme-Coder-v1 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 "IvmeLabs/Ivme-Coder-v1" \ --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": "IvmeLabs/Ivme-Coder-v1", "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 "IvmeLabs/Ivme-Coder-v1" \ --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": "IvmeLabs/Ivme-Coder-v1", "prompt": "Once upon a time,", "max_tokens": 512, "temperature": 0.5 }' - Docker Model Runner
How to use IvmeLabs/Ivme-Coder-v1 with Docker Model Runner:
docker model run hf.co/IvmeLabs/Ivme-Coder-v1
Upload Ivme-Coder-v1 (Otter 1): safetensors + custom modeling code
Browse files- model/model.py +13 -0
- modeling_ivme_coder.py +13 -0
model/model.py
CHANGED
|
@@ -129,6 +129,13 @@ class Block(nn.Module):
|
|
| 129 |
|
| 130 |
class IvmeCoderV1ForCausalLM(PreTrainedModel, GenerationMixin):
|
| 131 |
config_class = IvmeCoderConfig
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 132 |
|
| 133 |
def __init__(self, config):
|
| 134 |
super().__init__(config)
|
|
@@ -160,6 +167,12 @@ class IvmeCoderV1ForCausalLM(PreTrainedModel, GenerationMixin):
|
|
| 160 |
def set_input_embeddings(self, value):
|
| 161 |
self.tok_emb = value
|
| 162 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 163 |
def forward(self, input_ids, labels=None, use_cache=False, past_key_values=None,
|
| 164 |
attention_mask=None, **kwargs):
|
| 165 |
# attention_mask is accepted for API compatibility with tokenizer output /
|
|
|
|
| 129 |
|
| 130 |
class IvmeCoderV1ForCausalLM(PreTrainedModel, GenerationMixin):
|
| 131 |
config_class = IvmeCoderConfig
|
| 132 |
+
# Required so from_pretrained's tie-recovery logic knows how to reconnect
|
| 133 |
+
# head.weight to tok_emb.weight when head.weight is absent from the checkpoint
|
| 134 |
+
# (it's deliberately excluded from the safetensors file, since it's tied storage,
|
| 135 |
+
# not distinct data). Without this, HF's loader treats the missing key as needing
|
| 136 |
+
# fresh random initialization instead of re-tying it - which silently produces a
|
| 137 |
+
# working-looking model with a completely untrained output head.
|
| 138 |
+
_tied_weights_keys = {"head.weight": "tok_emb.weight"}
|
| 139 |
|
| 140 |
def __init__(self, config):
|
| 141 |
super().__init__(config)
|
|
|
|
| 167 |
def set_input_embeddings(self, value):
|
| 168 |
self.tok_emb = value
|
| 169 |
|
| 170 |
+
def get_output_embeddings(self):
|
| 171 |
+
return self.head
|
| 172 |
+
|
| 173 |
+
def set_output_embeddings(self, value):
|
| 174 |
+
self.head = value
|
| 175 |
+
|
| 176 |
def forward(self, input_ids, labels=None, use_cache=False, past_key_values=None,
|
| 177 |
attention_mask=None, **kwargs):
|
| 178 |
# attention_mask is accepted for API compatibility with tokenizer output /
|
modeling_ivme_coder.py
CHANGED
|
@@ -129,6 +129,13 @@ class Block(nn.Module):
|
|
| 129 |
|
| 130 |
class IvmeCoderV1ForCausalLM(PreTrainedModel, GenerationMixin):
|
| 131 |
config_class = IvmeCoderConfig
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 132 |
|
| 133 |
def __init__(self, config):
|
| 134 |
super().__init__(config)
|
|
@@ -160,6 +167,12 @@ class IvmeCoderV1ForCausalLM(PreTrainedModel, GenerationMixin):
|
|
| 160 |
def set_input_embeddings(self, value):
|
| 161 |
self.tok_emb = value
|
| 162 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 163 |
def forward(self, input_ids, labels=None, use_cache=False, past_key_values=None,
|
| 164 |
attention_mask=None, **kwargs):
|
| 165 |
# attention_mask is accepted for API compatibility with tokenizer output /
|
|
|
|
| 129 |
|
| 130 |
class IvmeCoderV1ForCausalLM(PreTrainedModel, GenerationMixin):
|
| 131 |
config_class = IvmeCoderConfig
|
| 132 |
+
# Required so from_pretrained's tie-recovery logic knows how to reconnect
|
| 133 |
+
# head.weight to tok_emb.weight when head.weight is absent from the checkpoint
|
| 134 |
+
# (it's deliberately excluded from the safetensors file, since it's tied storage,
|
| 135 |
+
# not distinct data). Without this, HF's loader treats the missing key as needing
|
| 136 |
+
# fresh random initialization instead of re-tying it - which silently produces a
|
| 137 |
+
# working-looking model with a completely untrained output head.
|
| 138 |
+
_tied_weights_keys = {"head.weight": "tok_emb.weight"}
|
| 139 |
|
| 140 |
def __init__(self, config):
|
| 141 |
super().__init__(config)
|
|
|
|
| 167 |
def set_input_embeddings(self, value):
|
| 168 |
self.tok_emb = value
|
| 169 |
|
| 170 |
+
def get_output_embeddings(self):
|
| 171 |
+
return self.head
|
| 172 |
+
|
| 173 |
+
def set_output_embeddings(self, value):
|
| 174 |
+
self.head = value
|
| 175 |
+
|
| 176 |
def forward(self, input_ids, labels=None, use_cache=False, past_key_values=None,
|
| 177 |
attention_mask=None, **kwargs):
|
| 178 |
# attention_mask is accepted for API compatibility with tokenizer output /
|