Instructions to use cccczshao/CALM-M with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Transformers
How to use cccczshao/CALM-M with Transformers:
# Use a pipeline as a high-level helper from transformers import pipeline pipe = pipeline("text-generation", model="cccczshao/CALM-M")# Load model directly from transformers import EnergyTransformer model = EnergyTransformer.from_pretrained("cccczshao/CALM-M", dtype="auto") - Notebooks
- Google Colab
- Kaggle
- Local Apps
- vLLM
How to use cccczshao/CALM-M with vLLM:
Install from pip and serve model
# Install vLLM from pip: pip install vllm # Start the vLLM server: vllm serve "cccczshao/CALM-M" # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:8000/v1/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "cccczshao/CALM-M", "prompt": "Once upon a time,", "max_tokens": 512, "temperature": 0.5 }'Use Docker
docker model run hf.co/cccczshao/CALM-M
- SGLang
How to use cccczshao/CALM-M 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 "cccczshao/CALM-M" \ --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": "cccczshao/CALM-M", "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 "cccczshao/CALM-M" \ --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": "cccczshao/CALM-M", "prompt": "Once upon a time,", "max_tokens": 512, "temperature": 0.5 }' - Docker Model Runner
How to use cccczshao/CALM-M with Docker Model Runner:
docker model run hf.co/cccczshao/CALM-M
Update README.md
Browse files
README.md
CHANGED
|
@@ -12,13 +12,13 @@ tags:
|
|
| 12 |
- language modeling
|
| 13 |
pipeline_tag: text-generation
|
| 14 |
---
|
| 15 |
-
|
| 16 |
# Continuous Autoregressive Language Models
|
| 17 |
|
| 18 |
[](https://arxiv.org/abs/2510.27688)
|
| 19 |
[](https://github.com/shaochenze/calm)
|
| 20 |
[](https://huggingface.co/collections/cccczshao/calm)
|
| 21 |
-
[. Simply set `trust_remote_code=True` when loading the models through the Transformers library.
|
| 49 |
-
|
| 50 |
-
```python
|
| 51 |
-
from transformers import pipeline, AutoTokenizer
|
| 52 |
-
import torch
|
| 53 |
-
|
| 54 |
-
model_name = "cccczshao/CALM-M" # Example model from the collection
|
| 55 |
-
pipe = pipeline(
|
| 56 |
-
"text-generation",
|
| 57 |
-
model_name,
|
| 58 |
-
tokenizer=AutoTokenizer.from_pretrained(model_name),
|
| 59 |
-
torch_dtype=torch.bfloat16,
|
| 60 |
-
device_map="auto",
|
| 61 |
-
trust_remote_code=True,
|
| 62 |
-
)
|
| 63 |
-
print(pipe("The key to life is", max_new_tokens=20, do_sample=True)[0]["generated_text"])
|
| 64 |
-
```
|
| 65 |
|
| 66 |
## Contact
|
| 67 |
|
|
|
|
| 12 |
- language modeling
|
| 13 |
pipeline_tag: text-generation
|
| 14 |
---
|
|
|
|
| 15 |
# Continuous Autoregressive Language Models
|
| 16 |
|
| 17 |
[](https://arxiv.org/abs/2510.27688)
|
| 18 |
[](https://github.com/shaochenze/calm)
|
| 19 |
[](https://huggingface.co/collections/cccczshao/calm)
|
| 20 |
+
[](https://shaochenze.github.io/blog/2025/CALM/)
|
| 21 |
+
|
| 22 |
|
| 23 |
## Model Description
|
| 24 |
|
|
|
|
| 26 |
|
| 27 |
This is achieved through a two-stage process:
|
| 28 |
|
| 29 |
+
1. **A high-fidelity autoencoder** learns to compress K tokens into a single vector and reconstruct them with near-perfect accuracy.
|
| 30 |
+
2. **A continuous-domain language model** then performs autoregressive prediction in this vector space.
|
| 31 |
|
| 32 |
### Key Features
|
| 33 |
|
| 34 |
+
* 🚀 **Ultra-Efficient by Design:** Dramatically improves training and inference efficiency by reducing the number of autoregressive steps by a factor of K.
|
| 35 |
+
* 💡 **A New Scaling Axis:** Introduces a new scaling dimension for LLMs—semantic bandwidth (K). Instead of just scaling parameters and data, you can now scale the amount of information processed in a single step.
|
| 36 |
+
* 🛠️ **A Comprehensive Likelihood-Free Toolkit:** Operating in a continuous domain requires new tools. This repository provides the full suite of algorithms that make CALM possible:
|
| 37 |
+
|
| 38 |
+
* **A Robust Autoencoder** to learn high-fidelity continuous representations of token chunks.
|
| 39 |
+
* **Energy-Based Training**, a principled and likelihood-free method for generative modeling.
|
| 40 |
+
* **BrierLM**, a new metric for calibrated, likelihood-free evaluation of language models.
|
| 41 |
+
* **Temperature Sampling** for controlled, high-quality text generation using only a black-box sampler.
|
| 42 |
|
| 43 |
## How to use
|
| 44 |
|
| 45 |
+
See our [GitHub README](https://github.com/shaochenze/calm), where we provide scripts for training and evaluation.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 46 |
|
| 47 |
## Contact
|
| 48 |
|