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 +8 -2
- modeling_ivme_coder.py +8 -2
model/model.py
CHANGED
|
@@ -64,8 +64,14 @@ def precompute_rope(dim, max_len, theta=10000.0, device="cpu"):
|
|
| 64 |
|
| 65 |
def apply_rope(x, cos, sin):
|
| 66 |
T = x.size(2)
|
| 67 |
-
|
| 68 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 69 |
x1, x2 = x[..., 0::2], x[..., 1::2]
|
| 70 |
rot1 = x1 * cos - x2 * sin
|
| 71 |
rot2 = x1 * sin + x2 * cos
|
|
|
|
| 64 |
|
| 65 |
def apply_rope(x, cos, sin):
|
| 66 |
T = x.size(2)
|
| 67 |
+
# Cast cos/sin to match x's dtype. precompute_rope always builds these tables in
|
| 68 |
+
# fp32 for precision, but if q/k arrive in bf16 (as they do when the model is
|
| 69 |
+
# loaded with dtype=torch.bfloat16), multiplying against fp32 cos/sin silently
|
| 70 |
+
# promotes the result back to fp32 - which then doesn't match `v` (which never
|
| 71 |
+
# passes through this function and stays in bf16), and scaled_dot_product_attention
|
| 72 |
+
# requires q, k, v to share one dtype.
|
| 73 |
+
cos = cos[:T].unsqueeze(0).unsqueeze(0).to(x.dtype)
|
| 74 |
+
sin = sin[:T].unsqueeze(0).unsqueeze(0).to(x.dtype)
|
| 75 |
x1, x2 = x[..., 0::2], x[..., 1::2]
|
| 76 |
rot1 = x1 * cos - x2 * sin
|
| 77 |
rot2 = x1 * sin + x2 * cos
|
modeling_ivme_coder.py
CHANGED
|
@@ -64,8 +64,14 @@ def precompute_rope(dim, max_len, theta=10000.0, device="cpu"):
|
|
| 64 |
|
| 65 |
def apply_rope(x, cos, sin):
|
| 66 |
T = x.size(2)
|
| 67 |
-
|
| 68 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 69 |
x1, x2 = x[..., 0::2], x[..., 1::2]
|
| 70 |
rot1 = x1 * cos - x2 * sin
|
| 71 |
rot2 = x1 * sin + x2 * cos
|
|
|
|
| 64 |
|
| 65 |
def apply_rope(x, cos, sin):
|
| 66 |
T = x.size(2)
|
| 67 |
+
# Cast cos/sin to match x's dtype. precompute_rope always builds these tables in
|
| 68 |
+
# fp32 for precision, but if q/k arrive in bf16 (as they do when the model is
|
| 69 |
+
# loaded with dtype=torch.bfloat16), multiplying against fp32 cos/sin silently
|
| 70 |
+
# promotes the result back to fp32 - which then doesn't match `v` (which never
|
| 71 |
+
# passes through this function and stays in bf16), and scaled_dot_product_attention
|
| 72 |
+
# requires q, k, v to share one dtype.
|
| 73 |
+
cos = cos[:T].unsqueeze(0).unsqueeze(0).to(x.dtype)
|
| 74 |
+
sin = sin[:T].unsqueeze(0).unsqueeze(0).to(x.dtype)
|
| 75 |
x1, x2 = x[..., 0::2], x[..., 1::2]
|
| 76 |
rot1 = x1 * cos - x2 * sin
|
| 77 |
rot2 = x1 * sin + x2 * cos
|