Text Generation
Transformers
Safetensors
English
ivme
language-model
transformer
rope
swiglu
muon
from-scratch
tiny
small
decoder-only
custom_code
Instructions to use IvmeLabs/Ivme-Conversate-v2-Base with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Transformers
How to use IvmeLabs/Ivme-Conversate-v2-Base with Transformers:
# Use a pipeline as a high-level helper from transformers import pipeline pipe = pipeline("text-generation", model="IvmeLabs/Ivme-Conversate-v2-Base", trust_remote_code=True)# Load model directly from transformers import AutoModelForCausalLM model = AutoModelForCausalLM.from_pretrained("IvmeLabs/Ivme-Conversate-v2-Base", trust_remote_code=True, device_map="auto") - Notebooks
- Google Colab
- Kaggle
- Local Apps Settings
- vLLM
How to use IvmeLabs/Ivme-Conversate-v2-Base with vLLM:
Install from pip and serve model
# Install vLLM from pip: pip install vllm # Start the vLLM server: vllm serve "IvmeLabs/Ivme-Conversate-v2-Base" # 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-Conversate-v2-Base", "prompt": "Once upon a time,", "max_tokens": 512, "temperature": 0.5 }'Use Docker
docker model run hf.co/IvmeLabs/Ivme-Conversate-v2-Base
- SGLang
How to use IvmeLabs/Ivme-Conversate-v2-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 "IvmeLabs/Ivme-Conversate-v2-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": "IvmeLabs/Ivme-Conversate-v2-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 "IvmeLabs/Ivme-Conversate-v2-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": "IvmeLabs/Ivme-Conversate-v2-Base", "prompt": "Once upon a time,", "max_tokens": 512, "temperature": 0.5 }' - Docker Model Runner
How to use IvmeLabs/Ivme-Conversate-v2-Base with Docker Model Runner:
docker model run hf.co/IvmeLabs/Ivme-Conversate-v2-Base
Update README.md
Browse files
README.md
CHANGED
|
@@ -97,9 +97,17 @@ None of the benchmarks above directly test whether the model's writing holds tog
|
|
| 97 |
|
| 98 |
**Prompt:** "Once upon a time, there was a"
|
| 99 |
|
| 100 |
-
> Once upon a time, there was a
|
| 101 |
|
| 102 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 103 |
|
| 104 |
---
|
| 105 |
|
|
@@ -148,6 +156,71 @@ Custom byte-level BPE tokenizer trained from scratch on a sample of the pretrain
|
|
| 148 |
|
| 149 |
---
|
| 150 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 151 |
## Limitations
|
| 152 |
|
| 153 |
- Base model only, not instruction tuned, will not follow instructions or answer questions
|
|
|
|
| 97 |
|
| 98 |
**Prompt:** "Once upon a time, there was a"
|
| 99 |
|
| 100 |
+
> Once upon a time, there was a wise old turtle named Timmy who lived on the coast of South America. In this magical place, no matter how big or large, people could look up at the sea and talk to each other.
|
| 101 |
|
| 102 |
+
Timmy asked, "What do you mean, Timmy?"
|
| 103 |
+
|
| 104 |
+
The turtle replied, "Well, I think you might see people talking about ocean creatures. They are like little waves that carry their voices. Sometimes they say they're too big or small to hear."
|
| 105 |
+
|
| 106 |
+
After a few moments, Timmy had an idea. "Can we go on a boat-boat tour? I can't believe all the kids in the village are doing that!"
|
| 107 |
+
|
| 108 |
+
As they sailed further, they saw many beautiful islands and vibrant colors. Each island had its unique culture and traditions. When they reached the top, they saw a group of kids playing and splashing around.
|
| 109 |
+
|
| 110 |
+
"Wow, lookgies!" said Timmy. "They live in a big ocean full of colorful fish and
|
| 111 |
|
| 112 |
---
|
| 113 |
|
|
|
|
| 156 |
|
| 157 |
---
|
| 158 |
|
| 159 |
+
## Inference
|
| 160 |
+
|
| 161 |
+
Here's a basic inference code you can run to immediately start using İvme-Conversate-v2-Base
|
| 162 |
+
|
| 163 |
+
```python
|
| 164 |
+
import sys
|
| 165 |
+
import torch
|
| 166 |
+
from tokenizers import Tokenizer
|
| 167 |
+
from huggingface_hub import hf_hub_download, snapshot_download
|
| 168 |
+
|
| 169 |
+
repo_id = "IvmeLabs/Ivme-Conversate-v2-Base"
|
| 170 |
+
|
| 171 |
+
# Download just the model/ folder (architecture code) into the HF cache,
|
| 172 |
+
# then add it to sys.path so `from model import ...` works without the
|
| 173 |
+
# user needing to manually copy any files.
|
| 174 |
+
repo_local_dir = snapshot_download(repo_id, allow_patterns=["model/*"])
|
| 175 |
+
sys.path.append(repo_local_dir)
|
| 176 |
+
|
| 177 |
+
from model import IvmeConfig, IvmeConversateV2
|
| 178 |
+
|
| 179 |
+
ckpt_path = hf_hub_download(repo_id, "ckpt_final.pt")
|
| 180 |
+
tokenizer_path = hf_hub_download(repo_id, "tokenizer.json")
|
| 181 |
+
|
| 182 |
+
tokenizer = Tokenizer.from_file(tokenizer_path)
|
| 183 |
+
|
| 184 |
+
# IvmeConfig is a plain dataclass saved into the checkpoint. Trust this only
|
| 185 |
+
# because it's our own checkpoint, produced by our own training code.
|
| 186 |
+
torch.serialization.add_safe_globals([IvmeConfig])
|
| 187 |
+
ckpt = torch.load(ckpt_path, map_location="cuda")
|
| 188 |
+
cfg = ckpt["config"]
|
| 189 |
+
|
| 190 |
+
model = IvmeConversateV2(cfg)
|
| 191 |
+
|
| 192 |
+
# Use EMA weights (smoothed), not the raw training weights, for inference.
|
| 193 |
+
# Strip torch.compile's "_orig_mod." prefix if the checkpoint was compiled.
|
| 194 |
+
state_dict = ckpt["ema_state_dict"]
|
| 195 |
+
state_dict = {k.removeprefix("_orig_mod."): v for k, v in state_dict.items()}
|
| 196 |
+
model.load_state_dict(state_dict)
|
| 197 |
+
|
| 198 |
+
model.cuda().eval()
|
| 199 |
+
|
| 200 |
+
prompt = "Once upon a time, there was a"
|
| 201 |
+
ids = tokenizer.encode(prompt).ids
|
| 202 |
+
idx = torch.tensor([ids], dtype=torch.long, device="cuda")
|
| 203 |
+
|
| 204 |
+
eot_id = tokenizer.token_to_id("<|endoftext|>")
|
| 205 |
+
with torch.no_grad():
|
| 206 |
+
for _ in range(200):
|
| 207 |
+
idx_cond = idx if idx.size(1) <= cfg.context_len else idx[:, -cfg.context_len:]
|
| 208 |
+
logits, _ = model(idx_cond)
|
| 209 |
+
logits = logits[:, -1, :] / 0.8 # temperature
|
| 210 |
+
|
| 211 |
+
v, _ = torch.topk(logits, 50)
|
| 212 |
+
logits[logits < v[:, [-1]]] = -float("inf")
|
| 213 |
+
|
| 214 |
+
probs = torch.softmax(logits, dim=-1)
|
| 215 |
+
next_id = torch.multinomial(probs, num_samples=1)
|
| 216 |
+
idx = torch.cat([idx, next_id], dim=1)
|
| 217 |
+
|
| 218 |
+
if next_id.item() == eot_id:
|
| 219 |
+
break
|
| 220 |
+
|
| 221 |
+
print(tokenizer.decode(idx[0].tolist()))
|
| 222 |
+
```
|
| 223 |
+
|
| 224 |
## Limitations
|
| 225 |
|
| 226 |
- Base model only, not instruction tuned, will not follow instructions or answer questions
|