初始化项目,由ModelHub XC社区提供模型
Model: SupraLabs/Supra2-Medium-Instruct Source: Original Platform
This commit is contained in:
38
.gitattributes
vendored
Normal file
38
.gitattributes
vendored
Normal file
@@ -0,0 +1,38 @@
|
|||||||
|
*.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
|
||||||
|
supra2-25m-sft-f16.gguf filter=lfs diff=lfs merge=lfs -text
|
||||||
|
supra2-25m-q4_k_m.gguf filter=lfs diff=lfs merge=lfs -text
|
||||||
|
supra2-25m-q8_0.gguf filter=lfs diff=lfs merge=lfs -text
|
||||||
143
README.md
Normal file
143
README.md
Normal file
@@ -0,0 +1,143 @@
|
|||||||
|
---
|
||||||
|
license: apache-2.0
|
||||||
|
viewer: false
|
||||||
|
datasets:
|
||||||
|
- HuggingFaceFW/fineweb-edu
|
||||||
|
language:
|
||||||
|
- en
|
||||||
|
pipeline_tag: text-generation
|
||||||
|
library_name: transformers
|
||||||
|
tags:
|
||||||
|
- small
|
||||||
|
- tiny
|
||||||
|
- supra
|
||||||
|
- supra2
|
||||||
|
- qwen3
|
||||||
|
- efficient
|
||||||
|
- instruct
|
||||||
|
- chat
|
||||||
|
base_model:
|
||||||
|
- SupraLabs/Supra2-Medium-Base
|
||||||
|
---
|
||||||
|
|
||||||
|
<h1 align="center">Supra2-Medium Instruct</h1>
|
||||||
|
|
||||||
|
<p align="center">
|
||||||
|
Ultra-efficient chat instruction model • 25M Parameters • 1K Context
|
||||||
|
</p>
|
||||||
|
|
||||||
|

|
||||||
|
|
||||||
|
**Supra2-Medium Instruct** is a 25M-parameter decoder-only language model pretrained from scratch by **SupraLabs** on 20B tokens of English web text. It uses the **Qwen3** architecture with a custom 16,384-token tokenizer. This is the instruct version of Supra2-Medium-Base.
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
## **Some samples...**
|
||||||
|
|
||||||
|
Prompt: "How does ChatGPT work?"
|
||||||
|
Answer:
|
||||||
|
```plaintext
|
||||||
|
ChatGT is a chatbot-based AI that uses text-based language to generate and share information, such as responses, responses, and other forms of communication. It works by using natural language processing (NLP) to generate text, which is then converted into actionable responses. The AI then uses this NLP to generate the text, making it available for downloading, sharing, and retrieving.
|
||||||
|
|
||||||
|
The AI then generates the text based on the input, allowing users to respond quickly and efficiently. This process is called "collaboration" or "memory" of the input text, where users can share their thoughts, feelings, and experiences with others. The chatbot then uses the text to generate responses, which are then sent to the AI to be used by the user.
|
||||||
|
Overall, Chat GPT is a powerful tool for creating and sharing content, and it has become an integral part of many modern daily life, enabling people to interact with and understand the world around them.
|
||||||
|
```
|
||||||
|
|
||||||
|
Prompt: "What is AI?"
|
||||||
|
Answer:
|
||||||
|
```plaintext
|
||||||
|
AI is a technology that enables machines to learn, adapt, and improve their behavior. It's a way for humans to learn and adapt to new situations, from simple tasks like reading to more complex ones like writing. AI is used in various fields, including education, healthcare, and social sciences, as well as in the field of psychology, where it helps people understand and respond to emotions, behaviors, and experiences.
|
||||||
|
|
||||||
|
In essence, AI is designed to help individuals learn, adjust, and thrive in a world where they can learn and grow, while also being able to adapt and learn from their environment. This means that AI can be used to make decisions, solve problems, and even learn from others, making it a valuable tool for individuals who want to learn more about themselves and their surroundings.
|
||||||
|
```
|
||||||
|
|
||||||
|
Prompt: "What is 2+2 ?"
|
||||||
|
Answer:
|
||||||
|
```plaintext
|
||||||
|
The result is **4**.
|
||||||
|
```
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
## **Finetuning Data**
|
||||||
|
|
||||||
|
| Source | Approx. share |
|
||||||
|
| ----- | ----- |
|
||||||
|
| `smol-smoltalk` | 77.5% |
|
||||||
|
| Synthethic Basic Arithmetic | 9.3% |
|
||||||
|
| `qwedsacf/grade-school-math-instructions` | 4.5% |
|
||||||
|
| no_robots | 3.4% |
|
||||||
|
| Style Rewrite of `smol-smoltalk` | 2.5% |
|
||||||
|
| Style Rewrite of `no_robots` | 1.5% |
|
||||||
|
| Templated `b-mc2/wikihow_lists` | 1.2% |
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
## **Usage**
|
||||||
|
|
||||||
|
```python
|
||||||
|
import torch
|
||||||
|
from tokenizers import pre_tokenizers
|
||||||
|
from transformers import AutoModelForCausalLM, AutoTokenizer
|
||||||
|
|
||||||
|
REPO_ID = "SupraLabs/Supra2-Medium-Instruct"
|
||||||
|
device = "cuda" if torch.cuda.is_available() else "cpu"
|
||||||
|
|
||||||
|
print(f"[*] Loading model and tokenizer from Hub: {REPO_ID}...")
|
||||||
|
|
||||||
|
# 1. Load Tokenizer & configure ByteLevel pre-tokenizer
|
||||||
|
tokenizer = AutoTokenizer.from_pretrained(REPO_ID, trust_remote_code=True)
|
||||||
|
tokenizer._tokenizer.pre_tokenizer = pre_tokenizers.ByteLevel(add_prefix_space=False)
|
||||||
|
|
||||||
|
# 2. Load Model
|
||||||
|
model = AutoModelForCausalLM.from_pretrained(
|
||||||
|
REPO_ID,
|
||||||
|
torch_dtype=torch.bfloat16 if torch.cuda.is_available() else torch.float32,
|
||||||
|
device_map="auto" if torch.cuda.is_available() else None,
|
||||||
|
trust_remote_code=True
|
||||||
|
)
|
||||||
|
model.eval()
|
||||||
|
|
||||||
|
# 3. Prepare Chat Prompt
|
||||||
|
messages = [
|
||||||
|
{"role": "user", "content": "What is AI?"}
|
||||||
|
]
|
||||||
|
|
||||||
|
prompt_text = tokenizer.apply_chat_template(
|
||||||
|
messages,
|
||||||
|
tokenize=False,
|
||||||
|
add_generation_prompt=True
|
||||||
|
)
|
||||||
|
|
||||||
|
inputs = tokenizer(prompt_text, return_tensors="pt").to(device)
|
||||||
|
|
||||||
|
print("[*] Generating response...\n")
|
||||||
|
|
||||||
|
# 4. Generate
|
||||||
|
im_end_id = tokenizer.convert_tokens_to_ids("<|im_end|>")
|
||||||
|
eos_ids = [im_end_id, tokenizer.eos_token_id] if im_end_id is not None else tokenizer.eos_token_id
|
||||||
|
|
||||||
|
with torch.no_grad():
|
||||||
|
output_ids = model.generate(
|
||||||
|
**inputs,
|
||||||
|
max_new_tokens=256,
|
||||||
|
do_sample=True,
|
||||||
|
temperature=0.2,
|
||||||
|
top_p=0.85,
|
||||||
|
top_k=25,
|
||||||
|
no_repeat_ngram_size=3,
|
||||||
|
pad_token_id=tokenizer.pad_token_id,
|
||||||
|
eos_token_id=eos_ids
|
||||||
|
)
|
||||||
|
|
||||||
|
# 5. Extract & Decode Response
|
||||||
|
generated_tokens = output_ids[0][inputs["input_ids"].shape[-1]:]
|
||||||
|
response = tokenizer.decode(generated_tokens, skip_special_tokens=True)
|
||||||
|
|
||||||
|
print("--- Output ---")
|
||||||
|
print(response.strip())
|
||||||
|
```
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
*© SupraLabs 2026*
|
||||||
4
chat_template.jinja
Normal file
4
chat_template.jinja
Normal file
@@ -0,0 +1,4 @@
|
|||||||
|
{% for m in messages %}<|im_start|>{{ m['role'] }}
|
||||||
|
{{ m['content'] }}<|im_end|>
|
||||||
|
{% endfor %}{% if add_generation_prompt %}<|im_start|>assistant
|
||||||
|
{% endif %}
|
||||||
42
config.json
Normal file
42
config.json
Normal file
@@ -0,0 +1,42 @@
|
|||||||
|
{
|
||||||
|
"architectures": [
|
||||||
|
"Qwen3ForCausalLM"
|
||||||
|
],
|
||||||
|
"attention_bias": false,
|
||||||
|
"attention_dropout": 0.0,
|
||||||
|
"bos_token_id": 1,
|
||||||
|
"dtype": "float32",
|
||||||
|
"eos_token_id": 2,
|
||||||
|
"head_dim": 64,
|
||||||
|
"hidden_act": "silu",
|
||||||
|
"hidden_size": 512,
|
||||||
|
"initializer_range": 0.02,
|
||||||
|
"intermediate_size": 896,
|
||||||
|
"layer_types": [
|
||||||
|
"full_attention",
|
||||||
|
"full_attention",
|
||||||
|
"full_attention",
|
||||||
|
"full_attention",
|
||||||
|
"full_attention",
|
||||||
|
"full_attention",
|
||||||
|
"full_attention"
|
||||||
|
],
|
||||||
|
"max_position_embeddings": 1024,
|
||||||
|
"max_window_layers": 28,
|
||||||
|
"model_type": "qwen3",
|
||||||
|
"num_attention_heads": 8,
|
||||||
|
"num_hidden_layers": 7,
|
||||||
|
"num_key_value_heads": 8,
|
||||||
|
"pad_token_id": 0,
|
||||||
|
"rms_norm_eps": 1e-06,
|
||||||
|
"rope_parameters": {
|
||||||
|
"rope_theta": 10000.0,
|
||||||
|
"rope_type": "default"
|
||||||
|
},
|
||||||
|
"sliding_window": null,
|
||||||
|
"tie_word_embeddings": true,
|
||||||
|
"transformers_version": "5.5.0",
|
||||||
|
"use_cache": true,
|
||||||
|
"use_sliding_window": false,
|
||||||
|
"vocab_size": 16408
|
||||||
|
}
|
||||||
10
generation_config.json
Normal file
10
generation_config.json
Normal file
@@ -0,0 +1,10 @@
|
|||||||
|
{
|
||||||
|
"_from_model_config": true,
|
||||||
|
"bos_token_id": 1,
|
||||||
|
"eos_token_id": 2,
|
||||||
|
"output_attentions": false,
|
||||||
|
"output_hidden_states": false,
|
||||||
|
"pad_token_id": 0,
|
||||||
|
"transformers_version": "5.5.0",
|
||||||
|
"use_cache": false
|
||||||
|
}
|
||||||
3
model.safetensors
Normal file
3
model.safetensors
Normal file
@@ -0,0 +1,3 @@
|
|||||||
|
version https://git-lfs.github.com/spec/v1
|
||||||
|
oid sha256:3acb12ca7532ed545972a3082e0ee36061834d02246c206e57687c32b7b4a250
|
||||||
|
size 101541728
|
||||||
81400
tokenizer.json
Normal file
81400
tokenizer.json
Normal file
File diff suppressed because it is too large
Load Diff
36
tokenizer_config.json
Normal file
36
tokenizer_config.json
Normal file
@@ -0,0 +1,36 @@
|
|||||||
|
{
|
||||||
|
"backend": "tokenizers",
|
||||||
|
"bos_token": "<s>",
|
||||||
|
"eos_token": "</s>",
|
||||||
|
"extra_special_tokens": [
|
||||||
|
"<|im_start|>",
|
||||||
|
"<|im_end|>",
|
||||||
|
"<think>",
|
||||||
|
"</think>",
|
||||||
|
"<tool_call>",
|
||||||
|
"</tool_call>",
|
||||||
|
"<tool_response>",
|
||||||
|
"</tool_response>",
|
||||||
|
"<|reserved_0|>",
|
||||||
|
"<|reserved_1|>",
|
||||||
|
"<|reserved_2|>",
|
||||||
|
"<|reserved_3|>",
|
||||||
|
"<|reserved_4|>",
|
||||||
|
"<|reserved_5|>",
|
||||||
|
"<|reserved_6|>",
|
||||||
|
"<|reserved_7|>",
|
||||||
|
"<|reserved_8|>",
|
||||||
|
"<|reserved_9|>",
|
||||||
|
"<|reserved_10|>",
|
||||||
|
"<|reserved_11|>",
|
||||||
|
"<|reserved_12|>",
|
||||||
|
"<|reserved_13|>",
|
||||||
|
"<|reserved_14|>",
|
||||||
|
"<|reserved_15|>"
|
||||||
|
],
|
||||||
|
"is_local": true,
|
||||||
|
"model_max_length": 1024,
|
||||||
|
"pad_token": "<pad>",
|
||||||
|
"tokenizer_class": "TokenizersBackend",
|
||||||
|
"unk_token": "<unk>"
|
||||||
|
}
|
||||||
Reference in New Issue
Block a user