Text Generation
Transformers
Safetensors
English
trm_text_ism
trm-text
ism
recurrent-transformer
tiny-stories
conversational
custom_code
Instructions to use summerMC/TRM-textV2 with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Transformers
How to use summerMC/TRM-textV2 with Transformers:
# Use a pipeline as a high-level helper from transformers import pipeline pipe = pipeline("text-generation", model="summerMC/TRM-textV2", trust_remote_code=True) messages = [ {"role": "user", "content": "Who are you?"}, ] pipe(messages)# Load model directly from transformers import AutoModel model = AutoModel.from_pretrained("summerMC/TRM-textV2", trust_remote_code=True, device_map="auto") - Notebooks
- Google Colab
- Kaggle
- Local Apps Settings
- vLLM
How to use summerMC/TRM-textV2 with vLLM:
Install from pip and serve model
# Install vLLM from pip: pip install vllm # Start the vLLM server: vllm serve "summerMC/TRM-textV2" # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:8000/v1/chat/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "summerMC/TRM-textV2", "messages": [ { "role": "user", "content": "What is the capital of France?" } ] }'Use Docker
docker model run hf.co/summerMC/TRM-textV2
- SGLang
How to use summerMC/TRM-textV2 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 "summerMC/TRM-textV2" \ --host 0.0.0.0 \ --port 30000 # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:30000/v1/chat/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "summerMC/TRM-textV2", "messages": [ { "role": "user", "content": "What is the capital of France?" } ] }'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 "summerMC/TRM-textV2" \ --host 0.0.0.0 \ --port 30000 # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:30000/v1/chat/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "summerMC/TRM-textV2", "messages": [ { "role": "user", "content": "What is the capital of France?" } ] }' - Docker Model Runner
How to use summerMC/TRM-textV2 with Docker Model Runner:
docker model run hf.co/summerMC/TRM-textV2
Final Release v35: Complete model files and updated README
Browse files
README.md
CHANGED
|
@@ -1,30 +1,26 @@
|
|
| 1 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 2 |
|
| 3 |
-
|
| 4 |
|
| 5 |
-
|
| 6 |
|
| 7 |
-
|
| 8 |
-
|
| 9 |
-
|
|
|
|
| 10 |
|
| 11 |
-
|
|
|
|
|
|
|
| 12 |
|
| 13 |
-
|
| 14 |
-
|
| 15 |
-
path,
|
| 16 |
-
trust_remote_code=True,
|
| 17 |
-
torch_dtype=torch.bfloat16,
|
| 18 |
-
device_map="auto",
|
| 19 |
-
)
|
| 20 |
```
|
| 21 |
-
|
| 22 |
-
## Config
|
| 23 |
-
|
| 24 |
-
* dim: 768
|
| 25 |
-
* heads: 12
|
| 26 |
-
* head_dim: 64
|
| 27 |
-
* recurrence_steps: 4
|
| 28 |
-
* gate_style: stable
|
| 29 |
-
* max_seq_len: 512
|
| 30 |
-
|
|
|
|
| 1 |
+
---
|
| 2 |
+
language: en
|
| 3 |
+
license: mit
|
| 4 |
+
base_model: summerMC/TRM-textV2
|
| 5 |
+
tags:
|
| 6 |
+
- text-generation
|
| 7 |
+
- trm-text
|
| 8 |
+
- ism
|
| 9 |
+
---
|
| 10 |
|
| 11 |
+
# TRM-textV2: Recurrent Shared Transformer with ISM
|
| 12 |
|
| 13 |
+
This model is a Recurrent Shared Transformer trained with the Inverse Square Mask (ISM) logic. It uses a single Transformer block repeated multiple times (recurrence_steps=4) to simulate depth while maintaining a lower parameter count.
|
| 14 |
|
| 15 |
+
## Key Features
|
| 16 |
+
- **Architecture**: Shared Recurrent Transformer Block (v34).
|
| 17 |
+
- **Inference**: Supports ISM-based prefix-answer masking.
|
| 18 |
+
- **Training**: TinyStories & FineWeb optimized.
|
| 19 |
|
| 20 |
+
## Usage
|
| 21 |
+
```python
|
| 22 |
+
from transformers import AutoModelForCausalLM, AutoTokenizer
|
| 23 |
|
| 24 |
+
model = AutoModelForCausalLM.from_pretrained('summerMC/TRM-textV2', trust_remote_code=True)
|
| 25 |
+
tokenizer = AutoTokenizer.from_pretrained('summerMC/TRM-textV2')
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 26 |
```
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|