Instructions to use ilsp/CoRM with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Transformers
How to use ilsp/CoRM with Transformers:
# Use a pipeline as a high-level helper from transformers import pipeline pipe = pipeline("text-generation", model="ilsp/CoRM")# pip install -U transformers accelerate # Load model directly from transformers import AutoModel model = AutoModel.from_pretrained("ilsp/CoRM", device_map="auto") - Notebooks
- Google Colab
- Kaggle
- Local Apps Settings
- vLLM
How to use ilsp/CoRM with vLLM:
Install from pip and serve model
# Install vLLM from pip: pip install vllm # Start the vLLM server: vllm serve "ilsp/CoRM" # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:8000/v1/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "ilsp/CoRM", "prompt": "Once upon a time,", "max_tokens": 512, "temperature": 0.5 }'Use Docker
docker model run hf.co/ilsp/CoRM
- SGLang
How to use ilsp/CoRM 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 "ilsp/CoRM" \ --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": "ilsp/CoRM", "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 "ilsp/CoRM" \ --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": "ilsp/CoRM", "prompt": "Once upon a time,", "max_tokens": 512, "temperature": 0.5 }' - Docker Model Runner
How to use ilsp/CoRM with Docker Model Runner:
docker model run hf.co/ilsp/CoRM
Upload README.md with huggingface_hub
Browse files
README.md
ADDED
|
@@ -0,0 +1,39 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
---
|
| 2 |
+
license: apache-2.0
|
| 3 |
+
library_name: transformers
|
| 4 |
+
pipeline_tag: text-generation
|
| 5 |
+
tags:
|
| 6 |
+
- mixture-of-experts
|
| 7 |
+
- moe
|
| 8 |
+
- corm
|
| 9 |
+
---
|
| 10 |
+
|
| 11 |
+
# CoRM
|
| 12 |
+
|
| 13 |
+
Checkpoints for the paper [Beyond Magnitude: Contrastive Routing for Modular Mixture-of-Experts](https://arxiv.org/abs/2609.01100).
|
| 14 |
+
|
| 15 |
+
| Model | Active Params | Total Params | Routing | Link |
|
| 16 |
+
|---|---|---|---|---|
|
| 17 |
+
| CoRM-182M | 182M | 777M | Top-1 | [link](https://huggingface.co/ilsp/CoRM-182M-top1) |
|
| 18 |
+
| CoRM-182M | 266M | 777M | Top-2 | [link](https://huggingface.co/ilsp/CoRM-182M-top2) |
|
| 19 |
+
| CoRM-469M | 469M | 2.58B | Top-1 | [link](https://huggingface.co/ilsp/CoRM-469M-top1) |
|
| 20 |
+
|
| 21 |
+
## Usage
|
| 22 |
+
|
| 23 |
+
These models use custom modeling code, so `trust_remote_code=True` is required.
|
| 24 |
+
|
| 25 |
+
```python
|
| 26 |
+
from transformers import AutoModelForCausalLM, AutoTokenizer
|
| 27 |
+
|
| 28 |
+
model_id = "ilsp/CoRM-182M-top1"
|
| 29 |
+
tokenizer = AutoTokenizer.from_pretrained(model_id)
|
| 30 |
+
model = AutoModelForCausalLM.from_pretrained(model_id, trust_remote_code=True)
|
| 31 |
+
|
| 32 |
+
inputs = tokenizer("The capital of Greece is", return_tensors="pt")
|
| 33 |
+
outputs = model.generate(**inputs, max_new_tokens=32)
|
| 34 |
+
print(tokenizer.decode(outputs[0], skip_special_tokens=True))
|
| 35 |
+
```
|
| 36 |
+
|
| 37 |
+
## Citation
|
| 38 |
+
|
| 39 |
+
<!-- TODO: add BibTeX. -->
|