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, dtype="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
π€ TRM-textV2: Recurrent Shared Transformer
TRM-textV2 is a high-efficiency language model featuring a Shared Recurrent Transformer architecture enhanced with Inverse Square Mask (ISM) logic.
π Model Highlights
- Efficient Depth: Simulates a deep network by repeating a single Transformer block (recurrence_steps=4).
- ISM Integration: Advanced prefix-answer masking for superior long-range dependency handling.
- Optimized for Stability: Trained with specific residual scaling and gate initialization to prevent loss plateaus.
π Quick Start
from transformers import AutoModelForCausalLM, AutoTokenizer
tokenizer = AutoTokenizer.from_pretrained('summerMC/TRM-textV2', trust_remote_code=True)
model = AutoModelForCausalLM.from_pretrained('summerMC/TRM-textV2', trust_remote_code=True)
# Standard Chat Template use
messages = [{'role': 'user', 'content': 'Once upon a time, a small robot'}]
inputs = tokenizer.apply_chat_template(messages, add_generation_prompt=True, return_tensors='pt')
π Training Details
- Dataset: TinyStories & FineWeb-Edu
- Architecture: 45M parameters (Effective depth equivalent to larger models)
- License: MIT
- Downloads last month
- 783
Model tree for summerMC/TRM-textV2
Unable to build the model tree, the base model loops to the model itself. Learn more.