LH-Tech-AI commited on
Commit
200d943
·
verified ·
1 Parent(s): b8079d7

Update README.md

Browse files
Files changed (1) hide show
  1. README.md +140 -0
README.md CHANGED
@@ -1,3 +1,143 @@
1
  ---
2
  license: apache-2.0
 
 
 
 
 
 
 
 
 
 
 
 
 
 
3
  ---
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
  ---
2
  license: apache-2.0
3
+ viewer: false
4
+ datasets:
5
+ - HuggingFaceFW/fineweb-edu
6
+ language:
7
+ - en
8
+ pipeline_tag: text-generation
9
+ library_name: transformers
10
+ tags:
11
+ - small
12
+ - tiny
13
+ - supra
14
+ - supra2
15
+ - qwen3
16
+ - efficient
17
  ---
18
+
19
+ <h1 align="center">Supra2-Medium Base</h1>
20
+
21
+ <p align="center">
22
+ Ultra-efficient base model • 25M Parameters • 1K Context
23
+ </p>
24
+
25
+ ![supra2-medium](https://cdn-uploads.huggingface.co/production/uploads/697f2832c2c5e4daa93cece7/-YjDJGlcGyTN5yClAaEv3.png)
26
+
27
+ **Supra2-Medium Base** 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.
28
+
29
+ This is a **base model**. It has *not* been instruction-tuned, chat-tuned, or aligned in any way.
30
+
31
+ At only 25 million parameters, Supra2-Medium demonstrates that meaningful language modeling can be achieved with extreme parameter efficiency—trained at ~800 tokens per parameter, which is significantly higher than typical pretraining ratios. This makes it ideal for research into data-efficient scaling and ultra-lightweight deployments.
32
+
33
+ ---
34
+
35
+ ## **Some samples...**
36
+
37
+ Prompt: "How does ChatGPT work?"
38
+ Answer:
39
+ ```plaintext
40
+ 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.
41
+
42
+ 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.
43
+ 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.
44
+ ```
45
+
46
+ Prompt: "What is AI?"
47
+ Answer:
48
+ ```plaintext
49
+ 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.
50
+
51
+ 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.
52
+ ```
53
+
54
+ Prompt: "What is 2+2 ?"
55
+ Answer:
56
+ ```plaintext
57
+ The result is **4**.
58
+ ```
59
+
60
+ ---
61
+
62
+ ## **Finetuning Data**
63
+
64
+ | Source | Approx. share |
65
+ | ----- | ----- |
66
+ | `smol-smoltalk` | 77.5% |
67
+ | Synthethic Basic Arithmetic | 9.3% |
68
+ | `qwedsacf/grade-school-math-instructions` | 4.5% |
69
+ | no_robots | 3.4% |
70
+ | Style Rewrite of `smol-smoltalk` | 2.5% |
71
+ | Style Rewrite of `no_robots` | 1.5% |
72
+ | Templated `b-mc2/wikihow_lists` | 1.2% |
73
+
74
+ ---
75
+
76
+ ## **Usage**
77
+
78
+ ```python
79
+ import torch
80
+ from tokenizers import pre_tokenizers
81
+ from transformers import AutoModelForCausalLM, AutoTokenizer
82
+
83
+ REPO_ID = "SupraLabs/Supra2-25M-Instruct"
84
+ device = "cuda" if torch.cuda.is_available() else "cpu"
85
+
86
+ print(f"[*] Loading model and tokenizer from Hub: {REPO_ID}...")
87
+
88
+ # 1. Load Tokenizer & configure ByteLevel pre-tokenizer
89
+ tokenizer = AutoTokenizer.from_pretrained(REPO_ID, trust_remote_code=True)
90
+ tokenizer._tokenizer.pre_tokenizer = pre_tokenizers.ByteLevel(add_prefix_space=False)
91
+
92
+ # 2. Load Model
93
+ model = AutoModelForCausalLM.from_pretrained(
94
+ REPO_ID,
95
+ torch_dtype=torch.bfloat16 if torch.cuda.is_available() else torch.float32,
96
+ device_map="auto" if torch.cuda.is_available() else None,
97
+ trust_remote_code=True
98
+ )
99
+ model.eval()
100
+
101
+ # 3. Prepare Chat Prompt
102
+ messages = [
103
+ {"role": "user", "content": "What is AI?"}
104
+ ]
105
+
106
+ prompt_text = tokenizer.apply_chat_template(
107
+ messages,
108
+ tokenize=False,
109
+ add_generation_prompt=True
110
+ )
111
+
112
+ inputs = tokenizer(prompt_text, return_tensors="pt").to(device)
113
+
114
+ print("[*] Generating response...\n")
115
+
116
+ # 4. Generate
117
+ im_end_id = tokenizer.convert_tokens_to_ids("<|im_end|>")
118
+ eos_ids = [im_end_id, tokenizer.eos_token_id] if im_end_id is not None else tokenizer.eos_token_id
119
+
120
+ with torch.no_grad():
121
+ output_ids = model.generate(
122
+ **inputs,
123
+ max_new_tokens=256,
124
+ do_sample=True,
125
+ temperature=0.2,
126
+ top_p=0.85,
127
+ top_k=25,
128
+ no_repeat_ngram_size=3,
129
+ pad_token_id=tokenizer.pad_token_id,
130
+ eos_token_id=eos_ids
131
+ )
132
+
133
+ # 5. Extract & Decode Response
134
+ generated_tokens = output_ids[0][inputs["input_ids"].shape[-1]:]
135
+ response = tokenizer.decode(generated_tokens, skip_special_tokens=True)
136
+
137
+ print("--- Output ---")
138
+ print(response.strip())
139
+ ```
140
+
141
+ ---
142
+
143
+ *© SupraLabs 2026*