初始化项目,由ModelHub XC社区提供模型

Model: spitfire4794/Supra-1.5-50M-Base-exp
Source: Original Platform
This commit is contained in:
ModelHub XC
2026-07-18 22:36:39 +08:00
commit f15d992dcf
9 changed files with 159241 additions and 0 deletions

35
.gitattributes vendored Normal file
View File

@@ -0,0 +1,35 @@
*.7z filter=lfs diff=lfs merge=lfs -text
*.arrow filter=lfs diff=lfs merge=lfs -text
*.bin filter=lfs diff=lfs merge=lfs -text
*.bz2 filter=lfs diff=lfs merge=lfs -text
*.ckpt filter=lfs diff=lfs merge=lfs -text
*.ftz filter=lfs diff=lfs merge=lfs -text
*.gz filter=lfs diff=lfs merge=lfs -text
*.h5 filter=lfs diff=lfs merge=lfs -text
*.joblib filter=lfs diff=lfs merge=lfs -text
*.lfs.* filter=lfs diff=lfs merge=lfs -text
*.mlmodel filter=lfs diff=lfs merge=lfs -text
*.model filter=lfs diff=lfs merge=lfs -text
*.msgpack filter=lfs diff=lfs merge=lfs -text
*.npy filter=lfs diff=lfs merge=lfs -text
*.npz filter=lfs diff=lfs merge=lfs -text
*.onnx filter=lfs diff=lfs merge=lfs -text
*.ot filter=lfs diff=lfs merge=lfs -text
*.parquet filter=lfs diff=lfs merge=lfs -text
*.pb filter=lfs diff=lfs merge=lfs -text
*.pickle filter=lfs diff=lfs merge=lfs -text
*.pkl filter=lfs diff=lfs merge=lfs -text
*.pt filter=lfs diff=lfs merge=lfs -text
*.pth filter=lfs diff=lfs merge=lfs -text
*.rar filter=lfs diff=lfs merge=lfs -text
*.safetensors filter=lfs diff=lfs merge=lfs -text
saved_model/**/* filter=lfs diff=lfs merge=lfs -text
*.tar.* filter=lfs diff=lfs merge=lfs -text
*.tar filter=lfs diff=lfs merge=lfs -text
*.tflite filter=lfs diff=lfs merge=lfs -text
*.tgz filter=lfs diff=lfs merge=lfs -text
*.wasm filter=lfs diff=lfs merge=lfs -text
*.xz filter=lfs diff=lfs merge=lfs -text
*.zip filter=lfs diff=lfs merge=lfs -text
*.zst filter=lfs diff=lfs merge=lfs -text
*tfevents* filter=lfs diff=lfs merge=lfs -text

89
README.md Normal file
View File

@@ -0,0 +1,89 @@
---
license: apache-2.0
language:
- en
pipeline_tag: text-generation
library_name: transformers
tags:
- supra
- supra-1.5
- llama
- 50m
- base
- continued-pretraining
- long-context
- 5k-context
- Supra
- Supra-50M
- chatml
---
<h1 align="center">Supra1.5-50M Base (ChatML)</h1>
<p align="center">
Continued Pretraining • 50M Parameters • 5K Context
</p>
![Supra-1.5-Base-EXP](https://cdn-uploads.huggingface.co/production/uploads/68a5d0966d33a07f8aad2e51/Lh7KcQs60Ht9iray8WFbp.png)
Supra-1.5-50M-Base-exp is a continued-pretrained 50M parameter Llama-style base model derived from `SupraLabs/Supra-50M-Base`. The context window has been expanded from 1,024 to 5,120 tokens using RoPE scaling and full-weight continued pretraining.
This specific repository has been modified to natively support ChatML. The tokenizer and embedding layers have been updated to include `<|im_start|>` and `<|im_end|>` as single special tokens.
## Architecture & Updates
| Specification | Value |
|--------------|--------|
| Architecture | `LlamaForCausalLM` |
| Parameters | ~50M |
| Vocabulary Size | 32,002 (Expanded for ChatML) |
| Hidden Size | 512 |
| Layers | 12 |
| Attention Heads | 8 |
| KV Heads | 4 |
| Context Length | 5,120 tokens |
| Tokenizer | BPE tokenizer (ChatML Jinja template applied) |
| Native EOS Token | `<|im_end|>` |
## Vocabulary Expansion & Initialization
The model's 3B token CPT corpus included raw ChatML text. As a result, the base model originally learned the tags `<|im_start|>` and `<|im_end|>` as sequences of 7 separate subwords.
To convert these tags into single tokens without destroying the learned pre-trained representations, we used subword-mean initialization:
1. Extracted the attention embeddings for the original 7-token sequences.
2. Averaged the weights for each sequence.
3. Assigned these mean weights to the new single-token IDs.
This ensures stable loss at the start of fine-tuning and allows inference frameworks to natively stop generation when `<|im_end|>` is predicted.
## Continued Pretraining Objective
This is a base model, not an instruct model. Training used packed raw text with standard causal language-modeling loss:
- `labels = input_ids`
- all non-pad tokens are trained
- no response-only masking
- no system/user/assistant masking
- no LoRA adapters in the default run
## Data Mix
The training mix prepared for the CPT run was:
- 3,000,000,062 CPT tokens
- 30% Tool Calling
- 30% ChatML Conversations
- 25% Factual Text (articles, essays, blogs)
- 15% Math & Logic Questions
## Fine-Tuning Guide
This model is intended for Supervised Fine-Tuning (SFT) and Reinforcement Learning (RL), including reasoning-style (R1) alignments.
You can use standard Hugging Face tools and call `tokenizer.apply_chat_template()` directly on your datasets.
**LoRA Configuration Note:**
Because the vocabulary size was expanded from 32,000 to 32,002, you must train the embedding layers during fine-tuning so the model can update the new ChatML tokens. Add the following to your PEFT/LoRA configuration:
```python
modules_to_save=["embed_tokens", "lm_head"]

1
chat_template.jinja Normal file
View File

@@ -0,0 +1 @@
{%- if not add_generation_prompt is defined -%}{%- set add_generation_prompt = false -%}{%- endif -%}{%- for message in messages -%}{{ '<|im_start|>' + message['role'] + '\n' + message['content'] + '<|im_end|>' + '\n' }}{%- endfor -%}{%- if add_generation_prompt -%}{{ '<|im_start|>assistant\n' }}{%- endif -%}

34
config.json Normal file
View File

@@ -0,0 +1,34 @@
{
"architectures": [
"LlamaForCausalLM"
],
"attention_bias": false,
"attention_dropout": 0.0,
"bos_token_id": 0,
"dtype": "float16",
"eos_token_id": 2,
"head_dim": 64,
"hidden_act": "silu",
"hidden_size": 512,
"initializer_range": 0.02,
"intermediate_size": 1408,
"max_position_embeddings": 8192,
"mlp_bias": false,
"model_type": "llama",
"num_attention_heads": 8,
"num_hidden_layers": 12,
"num_key_value_heads": 4,
"pad_token_id": 1,
"pretraining_tp": 1,
"rms_norm_eps": 1e-06,
"rope_parameters": {
"factor": 1.6,
"rope_theta": 10000.0,
"rope_type": "linear",
"type": "linear"
},
"tie_word_embeddings": true,
"transformers_version": "5.12.0",
"use_cache": false,
"vocab_size": 32002
}

7
generation_config.json Normal file
View File

@@ -0,0 +1,7 @@
{
"_from_model_config": true,
"bos_token_id": 0,
"eos_token_id": 2,
"pad_token_id": 1,
"transformers_version": "5.12.0"
}

3
model.safetensors Normal file
View File

@@ -0,0 +1,3 @@
version https://git-lfs.github.com/spec/v1
oid sha256:dc197dc62ac44870be55dd1b3efc5b0d7ff0244b906ec2393d125bd91b327305
size 103586552

6
special_tokens_map.json Normal file
View File

@@ -0,0 +1,6 @@
{
"bos_token": "<s>",
"eos_token": "</s>",
"pad_token": "<pad>",
"unk_token": "<unk>"
}

159050
tokenizer.json Normal file

File diff suppressed because it is too large Load Diff

16
tokenizer_config.json Normal file
View File

@@ -0,0 +1,16 @@
{
"backend": "tokenizers",
"bos_token": "<s>",
"clean_up_tokenization_spaces": false,
"eos_token": "<|im_end|>",
"extra_special_tokens": [
"<|im_start|>",
"<|im_end|>"
],
"is_local": false,
"local_files_only": false,
"model_max_length": 5120,
"pad_token": "<pad>",
"tokenizer_class": "TokenizersBackend",
"unk_token": "<unk>"
}