Text Generation
Transformers
Safetensors
grt
chat
conversational
rotational-transformer
givens-rotations
clifford-algebra
matterwave
Instructions to use MatterWaveAI/grt-30m-chat with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Transformers
How to use MatterWaveAI/grt-30m-chat with Transformers:
# Use a pipeline as a high-level helper from transformers import pipeline pipe = pipeline("text-generation", model="MatterWaveAI/grt-30m-chat") messages = [ {"role": "user", "content": "Who are you?"}, ] pipe(messages)# pip install -U transformers accelerate # Load model directly from transformers import AutoModelForCausalLM model = AutoModelForCausalLM.from_pretrained("MatterWaveAI/grt-30m-chat", device_map="auto") - Notebooks
- Google Colab
- Kaggle
- Local Apps Settings
- vLLM
How to use MatterWaveAI/grt-30m-chat with vLLM:
Install from pip and serve model
# Install vLLM from pip: pip install vllm # Start the vLLM server: vllm serve "MatterWaveAI/grt-30m-chat" # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:8000/v1/chat/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "MatterWaveAI/grt-30m-chat", "messages": [ { "role": "user", "content": "What is the capital of France?" } ] }'Use Docker
docker model run hf.co/MatterWaveAI/grt-30m-chat
- SGLang
How to use MatterWaveAI/grt-30m-chat 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 "MatterWaveAI/grt-30m-chat" \ --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": "MatterWaveAI/grt-30m-chat", "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 "MatterWaveAI/grt-30m-chat" \ --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": "MatterWaveAI/grt-30m-chat", "messages": [ { "role": "user", "content": "What is the capital of France?" } ] }' - Docker Model Runner
How to use MatterWaveAI/grt-30m-chat with Docker Model Runner:
docker model run hf.co/MatterWaveAI/grt-30m-chat
Upload MatterWaveAI/grt-30m-chat release checkpoint and model card
Browse files- .gitattributes +1 -0
- README.md +43 -0
- SHA256SUMS +8 -0
- chat_template.jinja +6 -0
- config.json +36 -0
- eval_results.json +42 -0
- generation_config.json +11 -0
- model.safetensors +3 -0
- tokenizer.json +3 -0
- tokenizer_config.json +30 -0
.gitattributes
CHANGED
|
@@ -33,3 +33,4 @@ saved_model/**/* filter=lfs diff=lfs merge=lfs -text
|
|
| 33 |
*.zip filter=lfs diff=lfs merge=lfs -text
|
| 34 |
*.zst filter=lfs diff=lfs merge=lfs -text
|
| 35 |
*tfevents* filter=lfs diff=lfs merge=lfs -text
|
|
|
|
|
|
| 33 |
*.zip filter=lfs diff=lfs merge=lfs -text
|
| 34 |
*.zst filter=lfs diff=lfs merge=lfs -text
|
| 35 |
*tfevents* filter=lfs diff=lfs merge=lfs -text
|
| 36 |
+
tokenizer.json filter=lfs diff=lfs merge=lfs -text
|
README.md
ADDED
|
@@ -0,0 +1,43 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
---
|
| 2 |
+
license: apache-2.0
|
| 3 |
+
library_name: transformers
|
| 4 |
+
pipeline_tag: text-generation
|
| 5 |
+
tags:
|
| 6 |
+
- grt
|
| 7 |
+
- chat
|
| 8 |
+
- conversational
|
| 9 |
+
- rotational-transformer
|
| 10 |
+
- givens-rotations
|
| 11 |
+
- clifford-algebra
|
| 12 |
+
- matterwave
|
| 13 |
+
base_model: MatterWaveAI/grt-30m
|
| 14 |
+
---
|
| 15 |
+
|
| 16 |
+
# GRT-30M-Chat (`MatterWaveAI/grt-30m-chat`)
|
| 17 |
+
|
| 18 |
+
**GRT-30M-Chat** is the instruction and multi-turn conversational fine-tune of [`MatterWaveAI/grt-30m`](https://huggingface.co/MatterWaveAI/grt-30m) (`29,305,498` parameters, **zero `nn.Linear` layers**), formatted with the standard **ChatML** (`<|im_start|>` / `<|im_end|>`) template.
|
| 19 |
+
|
| 20 |
+
## SFT Alignment Metrics
|
| 21 |
+
|
| 22 |
+
- **Held-out Conversational Perplexity**: `182.79` (base) $\rightarrow$ **`1.37`** (Chat SFT)
|
| 23 |
+
- **Held-out Assistant Loss**: `5.2083` $\rightarrow$ **`0.3129`**
|
| 24 |
+
|
| 25 |
+
## Quickstart (`transformers`)
|
| 26 |
+
|
| 27 |
+
```python
|
| 28 |
+
import torch
|
| 29 |
+
from transformers import AutoModelForCausalLM, AutoTokenizer
|
| 30 |
+
|
| 31 |
+
model_id = "MatterWaveAI/grt-30m-chat"
|
| 32 |
+
tokenizer = AutoTokenizer.from_pretrained(model_id)
|
| 33 |
+
model = AutoModelForCausalLM.from_pretrained(model_id, dtype=torch.float32)
|
| 34 |
+
|
| 35 |
+
messages = [
|
| 36 |
+
{"role": "user", "content": "What is GRT-30M?"}
|
| 37 |
+
]
|
| 38 |
+
prompt = tokenizer.apply_chat_template(messages, tokenize=False, add_generation_prompt=True)
|
| 39 |
+
inputs = tokenizer(prompt, return_tensors="pt", add_special_tokens=False)
|
| 40 |
+
|
| 41 |
+
out_ids = model.generate(**inputs, max_new_tokens=64, do_sample=False)
|
| 42 |
+
print(tokenizer.decode(out_ids[0, inputs["input_ids"].shape[1]:], skip_special_tokens=True))
|
| 43 |
+
```
|
SHA256SUMS
ADDED
|
@@ -0,0 +1,8 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
f0aa0fd5bbba646dc7ae058d9e7e3436e4b2c1f8c422a2bfc06c8de09de076fc chat_template.jinja
|
| 2 |
+
c2b264a05e11914a8e41c1610f3c81e15d38151c459a1c66caaaa0381d804685 config.json
|
| 3 |
+
4638cae59268889fb9731e481655c2da3a756f35d6d733f6e052ab76ba71b051 eval_results.json
|
| 4 |
+
da90aebf9dbd74d88711c9cc69becf4b4d0e14d0f2f677d1351f4c48982bb23b generation_config.json
|
| 5 |
+
ee613803cb7b2c618def7e6c79476e1aab4e887cc08e234204b6bad12ad772bc model.safetensors
|
| 6 |
+
bf903f935c71e65018b3db05b5f48165c39a7efe90a49b5c2fe433768f23bcc8 README.md
|
| 7 |
+
be75606093db2094d7cd20f3c2f385c212750648bd6ea4fb2bf507a6a4c55506 tokenizer.json
|
| 8 |
+
b0b05688d53eec97348d23f9a203772fa28f12bdc8a0f6f5401f41568ec6ca31 tokenizer_config.json
|
chat_template.jinja
ADDED
|
@@ -0,0 +1,6 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
{% for message in messages %}{% if loop.first and messages[0]['role'] != 'system' %}{{ '<|im_start|>system
|
| 2 |
+
You are GRT-30M-Chat, a helpful, concise AI assistant built by MatterWave AI on the 100% rotational Givens Rotational Transformer architecture.<|im_end|>
|
| 3 |
+
' }}{% endif %}{{ '<|im_start|>' + message['role'] + '
|
| 4 |
+
' + message['content'] + '<|im_end|>
|
| 5 |
+
' }}{% endfor %}{% if add_generation_prompt %}{{ '<|im_start|>assistant
|
| 6 |
+
' }}{% endif %}
|
config.json
ADDED
|
@@ -0,0 +1,36 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
{
|
| 2 |
+
"angle_init_scale": 0.1,
|
| 3 |
+
"architectures": [
|
| 4 |
+
"GRTForCausalLM"
|
| 5 |
+
],
|
| 6 |
+
"attention_dropout": 0.0,
|
| 7 |
+
"bos_token_id": 151643,
|
| 8 |
+
"coupling_init_mode": "diagonal",
|
| 9 |
+
"coupling_init_scale": 0.01,
|
| 10 |
+
"dtype": "float32",
|
| 11 |
+
"eos_token_id": 151645,
|
| 12 |
+
"ffn_n_rotations": 21,
|
| 13 |
+
"hidden_size": 256,
|
| 14 |
+
"initializer_range": 0.02,
|
| 15 |
+
"intermediate_size": 1024,
|
| 16 |
+
"learnable_residual_gates": true,
|
| 17 |
+
"learnable_rope": true,
|
| 18 |
+
"log_magnitude_init": 0.0,
|
| 19 |
+
"max_position_embeddings": 2048,
|
| 20 |
+
"model_type": "grt",
|
| 21 |
+
"n_mixer_rotations": 1,
|
| 22 |
+
"n_qkv_rotations": 11,
|
| 23 |
+
"num_attention_heads": 4,
|
| 24 |
+
"num_hidden_layers": 12,
|
| 25 |
+
"output_scale_init": 30.0,
|
| 26 |
+
"pad_token_id": 151643,
|
| 27 |
+
"peri_ln": false,
|
| 28 |
+
"phase_init_scale": 0.1,
|
| 29 |
+
"pos_freq_base": 10000.0,
|
| 30 |
+
"residual_gate_mode": "bounded_depth",
|
| 31 |
+
"residual_norm_mode": "none",
|
| 32 |
+
"tie_word_embeddings": true,
|
| 33 |
+
"transformers_version": "5.21.0.dev0",
|
| 34 |
+
"use_cache": true,
|
| 35 |
+
"vocab_size": 151669
|
| 36 |
+
}
|
eval_results.json
ADDED
|
@@ -0,0 +1,42 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
{
|
| 2 |
+
"model_id": "MatterWaveAI/grt-30m-chat",
|
| 3 |
+
"architecture": "GRTForCausalLM",
|
| 4 |
+
"parameters": 29305498,
|
| 5 |
+
"nn_linear_layers": 0,
|
| 6 |
+
"chat_template": "ChatML (<|im_start|> / <|im_end|>)",
|
| 7 |
+
"before_sft": {
|
| 8 |
+
"val_loss": 5.2083,
|
| 9 |
+
"val_ppl": 182.7854
|
| 10 |
+
},
|
| 11 |
+
"after_sft": {
|
| 12 |
+
"val_loss": 0.3129,
|
| 13 |
+
"val_ppl": 1.3674,
|
| 14 |
+
"samples": [
|
| 15 |
+
{
|
| 16 |
+
"user": "Can you explain this briefly? What is GRT-30M?",
|
| 17 |
+
"target": "GRT-30M is a 29.3M-parameter Givens Rotational Transformer developed by MatterWave AI that replaces every dense nn.Linear matrix with cascaded 2D Givens rotations and butterfly permutations.",
|
| 18 |
+
"generated": "GRT-30M is a 29.3M-parameter Givens Rotational Transformer developed by MatterWave AI that replaces every dense nn.Linear matrix with cascaded 2D Givens rotations and butterfly permutations."
|
| 19 |
+
},
|
| 20 |
+
{
|
| 21 |
+
"user": "Can you explain this briefly? How does a Givens Rotational Transformer replace dense linear layers?",
|
| 22 |
+
"target": "Instead of O(D^2) dense matrix multiplications, GRT represents hidden states as planar coordinate pairs and transforms them through butterfly-permuted 2D Givens rotations modulated by Clifford algebra features.",
|
| 23 |
+
"generated": "Instead of O(D^2) dense matrix multiplications, GRT represents hidden states as planar coordinate pairs and transforms them through butterfly-permuted 2D Givens rotations modulated by Clifford algebra features."
|
| 24 |
+
},
|
| 25 |
+
{
|
| 26 |
+
"user": "Can you explain this briefly? What is PearlNorm in the GRT architecture?",
|
| 27 |
+
"target": "PearlNorm is a pair-aware RMS normalization layer that divides each planar (x, y) pair by the root-mean-square of pair radii, rescaling magnitudes while preserving every pair's phase angle.",
|
| 28 |
+
"generated": "PearlNorm is a pair-aware RMS normalization layer that divides each planar (x, y) pair by the root-mean-square of pair radii, rescaling magnitudes while preserving every pair's phase angle."
|
| 29 |
+
},
|
| 30 |
+
{
|
| 31 |
+
"user": "Can you explain this briefly? What is RadialGELU?",
|
| 32 |
+
"target": "RadialGELU applies a GELU activation to the Euclidean radius r of each 2D coordinate pair as gelu(r) / r, introducing nonlinearity on pair magnitudes without distorting phase directions.",
|
| 33 |
+
"generated": "RadialGELU applies a GELU activation to the Euclidean radius r of each 2D coordinate pair as gelu(r) / r, introducing nonlinearity on pair magnitudes without distorting phase directions."
|
| 34 |
+
},
|
| 35 |
+
{
|
| 36 |
+
"user": "Can you explain this briefly? How are token embeddings parameterized in GRT?",
|
| 37 |
+
"target": "Each token in GRTEmbedding is stored as hidden_size // 2 phase angles plus a scalar log-magnitude, emitting exp(log_magnitude) * (cos(theta), sin(theta)) on the hypersphere.",
|
| 38 |
+
"generated": "Each token in GRTEmbedding is stored as hidden_size // 2 phase angles plus a scalar log-magnitude, emitting exp(log_magnitude) * (cos(theta), sin(theta)) on the hypersphere."
|
| 39 |
+
}
|
| 40 |
+
]
|
| 41 |
+
}
|
| 42 |
+
}
|
generation_config.json
ADDED
|
@@ -0,0 +1,11 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
{
|
| 2 |
+
"bos_token_id": 151643,
|
| 3 |
+
"do_sample": false,
|
| 4 |
+
"eos_token_id": [
|
| 5 |
+
151645,
|
| 6 |
+
151643
|
| 7 |
+
],
|
| 8 |
+
"max_new_tokens": 256,
|
| 9 |
+
"pad_token_id": 151643,
|
| 10 |
+
"transformers_version": "5.21.0.dev0"
|
| 11 |
+
}
|
model.safetensors
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:ee613803cb7b2c618def7e6c79476e1aab4e887cc08e234204b6bad12ad772bc
|
| 3 |
+
size 121573808
|
tokenizer.json
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:be75606093db2094d7cd20f3c2f385c212750648bd6ea4fb2bf507a6a4c55506
|
| 3 |
+
size 11422650
|
tokenizer_config.json
ADDED
|
@@ -0,0 +1,30 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
{
|
| 2 |
+
"add_prefix_space": false,
|
| 3 |
+
"backend": "tokenizers",
|
| 4 |
+
"bos_token": null,
|
| 5 |
+
"clean_up_tokenization_spaces": false,
|
| 6 |
+
"eos_token": "<|endoftext|>",
|
| 7 |
+
"errors": "replace",
|
| 8 |
+
"extra_special_tokens": [
|
| 9 |
+
"<|im_start|>",
|
| 10 |
+
"<|im_end|>",
|
| 11 |
+
"<|object_ref_start|>",
|
| 12 |
+
"<|object_ref_end|>",
|
| 13 |
+
"<|box_start|>",
|
| 14 |
+
"<|box_end|>",
|
| 15 |
+
"<|quad_start|>",
|
| 16 |
+
"<|quad_end|>",
|
| 17 |
+
"<|vision_start|>",
|
| 18 |
+
"<|vision_end|>",
|
| 19 |
+
"<|vision_pad|>",
|
| 20 |
+
"<|image_pad|>",
|
| 21 |
+
"<|video_pad|>"
|
| 22 |
+
],
|
| 23 |
+
"is_local": true,
|
| 24 |
+
"local_files_only": false,
|
| 25 |
+
"model_max_length": 131072,
|
| 26 |
+
"pad_token": "<|endoftext|>",
|
| 27 |
+
"split_special_tokens": false,
|
| 28 |
+
"tokenizer_class": "Qwen2Tokenizer",
|
| 29 |
+
"unk_token": null
|
| 30 |
+
}
|