VickyRDP commited on
Commit
17957e0
·
verified ·
1 Parent(s): 969a1e8

Convert to free static Space: browser-side model + voice/text UI

Browse files
README.md CHANGED
@@ -1,13 +1,18 @@
1
  ---
2
- title: GPU Mart
3
- emoji: ⚡
4
- colorFrom: indigo
5
- colorTo: blue
6
- sdk: gradio
7
- sdk_version: 6.20.0
8
- python_version: '3.12'
9
- app_file: app.py
10
- pinned: false
11
  ---
12
 
13
- Check out the configuration reference at https://huggingface.co/docs/hub/spaces-config-reference
 
 
 
 
 
 
 
1
  ---
2
+ title: GPU Mart Assistant
3
+ emoji: 🖥️
4
+ colorFrom: red
5
+ colorTo: gray
6
+ sdk: static
7
+ pinned: true
8
+ license: apache-2.0
9
+ short_description: Voice + text AI assistant for RDP GPU Mart
 
10
  ---
11
 
12
+ # 🖥️ GPU Mart Assistant — voice + text
13
+
14
+ Ask anything about **RDP GPU Mart** (https://rdp.in/gpu-mart), India's datacenter-grade GPU marketplace:
15
+ products, CARINA/QUASAR/DRACO series, pricing, quotes, shipping, warranty and support.
16
+
17
+ Runs a small fine-tuned model — [VickyRDP/gpumart-qwen2.5-0.5b-instruct](https://huggingface.co/VickyRDP/gpumart-qwen2.5-0.5b-instruct) —
18
+ **entirely in your browser** via transformers.js (WebGPU/WASM), with voice input & spoken replies via the Web Speech API.
app.py DELETED
@@ -1,259 +0,0 @@
1
- #!/usr/bin/env python3
2
- """GPU Mart Assistant — self-training Hugging Face Space.
3
-
4
- On first boot it fine-tunes Qwen2.5-0.5B-Instruct (LoRA) on the bundled
5
- GPU Mart Q&A dataset, merges the adapter, pushes the model to the Hub
6
- (MODEL_REPO), then serves it. On later restarts it just loads the trained
7
- model from the Hub. Voice (mic input + spoken replies) runs in the visitor's
8
- browser via the Web Speech API — no server-side audio models needed.
9
- """
10
- import os, json, threading, traceback
11
- import gradio as gr
12
-
13
- BASE_MODEL = "Qwen/Qwen2.5-0.5B-Instruct"
14
- MODEL_REPO = os.environ.get("MODEL_REPO", "VickyRDP/gpumart-qwen2.5-0.5b-instruct")
15
- HF_TOKEN = os.environ.get("HF_TOKEN")
16
- DATA_FILE = "gpumart_train.jsonl"
17
-
18
- SYSTEM = ("You are the GPU Mart assistant for RDP GPU Mart (rdp.in/gpu-mart), India's "
19
- "datacenter-grade GPU marketplace by RDP Computers India Private Limited. "
20
- "Answer questions about GPU Mart products, series, pricing, policies and support "
21
- "accurately and concisely.")
22
-
23
- STATE = {"phase": "starting", "detail": "Loading…", "model": None, "tok": None}
24
- _lock = threading.Lock()
25
-
26
-
27
- def _load(repo):
28
- import torch
29
- from transformers import AutoModelForCausalLM, AutoTokenizer
30
- tok = AutoTokenizer.from_pretrained(repo, token=HF_TOKEN)
31
- model = AutoModelForCausalLM.from_pretrained(repo, torch_dtype=torch.float32, token=HF_TOKEN)
32
- model.eval()
33
- return model, tok
34
-
35
-
36
- def _train_and_push():
37
- """LoRA fine-tune on the bundled dataset, merge, push to MODEL_REPO."""
38
- import torch
39
- from datasets import Dataset
40
- from transformers import (AutoModelForCausalLM, AutoTokenizer, TrainingArguments,
41
- Trainer, DataCollatorForLanguageModeling)
42
- from peft import LoraConfig, get_peft_model
43
- from huggingface_hub import HfApi
44
-
45
- STATE["phase"] = "training"
46
- STATE["detail"] = "Fine-tuning Qwen2.5-0.5B on GPU Mart knowledge (first boot only, ~1-2 h on free CPU)…"
47
-
48
- if not os.path.exists(DATA_FILE):
49
- import make_dataset # noqa: F401 — generates gpumart_train.jsonl on import
50
-
51
- tok = AutoTokenizer.from_pretrained(BASE_MODEL)
52
- model = AutoModelForCausalLM.from_pretrained(BASE_MODEL, torch_dtype=torch.float32)
53
- lora = LoraConfig(r=16, lora_alpha=32, lora_dropout=0.05, bias="none", task_type="CAUSAL_LM",
54
- target_modules=["q_proj", "k_proj", "v_proj", "o_proj",
55
- "gate_proj", "up_proj", "down_proj"])
56
- model = get_peft_model(model, lora)
57
-
58
- rows = [json.loads(l) for l in open(DATA_FILE, encoding="utf-8")]
59
-
60
- def fmt(ex):
61
- return tok(tok.apply_chat_template(ex["messages"], tokenize=False),
62
- truncation=True, max_length=384)
63
-
64
- ds = Dataset.from_list(rows).map(fmt, remove_columns=["messages"])
65
- args = TrainingArguments(output_dir="out", num_train_epochs=3,
66
- per_device_train_batch_size=1, gradient_accumulation_steps=8,
67
- learning_rate=2e-4, lr_scheduler_type="cosine", warmup_ratio=0.05,
68
- logging_steps=10, save_strategy="no", report_to=[], use_cpu=True)
69
-
70
- class _T(Trainer):
71
- def log(self, logs, *a, **k):
72
- super().log(logs, *a, **k)
73
- if "loss" in logs:
74
- done = int(self.state.global_step) ; total = int(self.state.max_steps or 1)
75
- STATE["detail"] = (f"Training… step {done}/{total} "
76
- f"(loss {logs['loss']:.3f}). Chat works after training.")
77
-
78
- _T(model=model, args=args, train_dataset=ds,
79
- data_collator=DataCollatorForLanguageModeling(tok, mlm=False)).train()
80
-
81
- STATE["detail"] = "Training done — merging and uploading model to the Hub…"
82
- merged = model.merge_and_unload().to(torch.bfloat16)
83
- merged.save_pretrained("merged", safe_serialization=True)
84
- tok.save_pretrained("merged")
85
-
86
- card = f"""---
87
- license: apache-2.0
88
- base_model: {BASE_MODEL}
89
- language: [en]
90
- pipeline_tag: text-generation
91
- tags: [gpu-mart, rdp, qwen2.5, lora, customer-support]
92
- ---
93
- # GPU Mart Assistant — Qwen2.5-0.5B fine-tune
94
-
95
- Small model fine-tuned (LoRA, merged) to answer questions about **RDP GPU Mart**
96
- (https://rdp.in/gpu-mart), India's datacenter-grade GPU marketplace: products, CARINA/QUASAR/DRACO
97
- series, pricing, quotes, shipping, warranty and support.
98
-
99
- Trained on {len(rows)} instruction pairs built from the live store. Try it with voice + text in the
100
- [GPU Mart Assistant Space](https://huggingface.co/spaces/VickyRDP/GPU-Mart).
101
- """
102
- open("merged/README.md", "w", encoding="utf-8").write(card)
103
-
104
- if HF_TOKEN:
105
- api = HfApi(token=HF_TOKEN)
106
- api.create_repo(MODEL_REPO, repo_type="model", exist_ok=True)
107
- api.upload_folder(folder_path="merged", repo_id=MODEL_REPO, repo_type="model")
108
- STATE["detail"] = "Model pushed to the Hub — loading it for serving…"
109
- else:
110
- STATE["detail"] = ("Model trained (serving locally). Add an HF_TOKEN write-token secret in "
111
- "Space settings and restart to publish it to the Hub.")
112
-
113
-
114
- def _bootstrap():
115
- try:
116
- try:
117
- m, t = _load(MODEL_REPO) # already trained on a previous boot
118
- with _lock:
119
- STATE.update(model=m, tok=t, phase="ready",
120
- detail="Trained GPU Mart model loaded from the Hub.")
121
- return
122
- except Exception:
123
- pass
124
-
125
- _train_and_push()
126
- m, t = _load("merged")
127
- with _lock:
128
- STATE.update(model=m, tok=t, phase="ready",
129
- detail="Training complete. Trained GPU Mart model is live.")
130
- except Exception:
131
- STATE.update(phase="error", detail="Startup error:\n" + traceback.format_exc()[-800:])
132
-
133
-
134
- threading.Thread(target=_bootstrap, daemon=True).start()
135
-
136
-
137
- def chat_fn(message, history):
138
- import torch
139
- if STATE["phase"] != "ready":
140
- return ("I'm still getting ready — " + STATE["detail"] +
141
- "\n\nMeanwhile: GPU Mart (rdp.in/gpu-mart) is India's datacenter-grade GPU "
142
- "marketplace by RDP — AI workstations to NVL72 superclusters. "
143
- "Call +91 720 794 8743 for anything urgent.")
144
- model, tok = STATE["model"], STATE["tok"]
145
- msgs = [{"role": "system", "content": SYSTEM}]
146
- for h in (history or [])[-6:]:
147
- if isinstance(h, dict) and h.get("role") in ("user", "assistant"):
148
- msgs.append({"role": h["role"], "content": str(h.get("content", ""))})
149
- msgs.append({"role": "user", "content": message})
150
- ids = tok.apply_chat_template(msgs, add_generation_prompt=True, return_tensors="pt")
151
- with torch.no_grad():
152
- out = model.generate(ids, max_new_tokens=220, do_sample=True, temperature=0.3,
153
- top_p=0.9, repetition_penalty=1.1,
154
- pad_token_id=tok.eos_token_id)
155
- return tok.decode(out[0][ids.shape[-1]:], skip_special_tokens=True).strip()
156
-
157
-
158
- VOICE_JS = """
159
- () => {
160
- const $ = s => document.querySelector(s);
161
- // ---- Text-to-speech: watch chatbot for new assistant messages ----
162
- let lastSpoken = "";
163
- const speak = txt => {
164
- if (!window.speechSynthesis || !$('#speak-toggle input')?.checked) return;
165
- if (!txt || txt === lastSpoken) return;
166
- lastSpoken = txt;
167
- speechSynthesis.cancel();
168
- const u = new SpeechSynthesisUtterance(txt.slice(0, 600));
169
- u.lang = 'en-IN'; u.rate = 1.0;
170
- speechSynthesis.speak(u);
171
- };
172
- const chat = $('#gm-chat');
173
- if (chat) new MutationObserver(() => {
174
- const msgs = chat.querySelectorAll('.bot, [data-testid="bot"], .message.bot-row, .assistant');
175
- const last = msgs[msgs.length - 1];
176
- if (last) speak(last.innerText.trim());
177
- }).observe(chat, {childList: true, subtree: true, characterData: true});
178
-
179
- // ---- Speech-to-text: mic button fills the textbox and submits ----
180
- const SR = window.SpeechRecognition || window.webkitSpeechRecognition;
181
- const mic = $('#mic-btn');
182
- if (!SR) { if (mic) { mic.textContent = '🎤 Voice not supported in this browser'; mic.disabled = true; } return; }
183
- let rec = null, listening = false;
184
- const setBox = v => {
185
- const ta = $('#gm-box textarea');
186
- if (!ta) return;
187
- const setter = Object.getOwnPropertyDescriptor(window.HTMLTextAreaElement.prototype, 'value').set;
188
- setter.call(ta, v);
189
- ta.dispatchEvent(new Event('input', {bubbles: true}));
190
- };
191
- if (mic) mic.addEventListener('click', () => {
192
- if (listening) { rec && rec.stop(); return; }
193
- rec = new SR();
194
- rec.lang = 'en-IN'; rec.interimResults = true; rec.continuous = false;
195
- let finalTxt = '';
196
- rec.onresult = e => {
197
- let t = '';
198
- for (const r of e.results) t += r[0].transcript;
199
- setBox(t);
200
- if (e.results[e.results.length - 1].isFinal) finalTxt = t;
201
- };
202
- rec.onend = () => {
203
- listening = false; mic.textContent = '🎤 Speak';
204
- if (finalTxt.trim()) {
205
- const btn = document.querySelector('#gm-send') || document.querySelector('#gm-box button');
206
- if (btn) btn.click();
207
- }
208
- };
209
- rec.onerror = () => { listening = false; mic.textContent = '🎤 Speak'; };
210
- listening = true; mic.textContent = '🔴 Listening… (tap to stop)';
211
- rec.start();
212
- });
213
- }
214
- """
215
-
216
- CSS = """
217
- #mic-btn {background:#d82228;color:#fff;border:none;border-radius:10px;
218
- padding:10px 18px;font-size:15px;cursor:pointer}
219
- #gm-header {text-align:center}
220
- """
221
-
222
- with gr.Blocks(css=CSS, title="GPU Mart Assistant") as demo:
223
- gr.Markdown("# 🖥️ GPU Mart Assistant\nAsk anything about **RDP GPU Mart** — India's "
224
- "datacenter-grade GPU marketplace. Products, CARINA/QUASAR/DRACO series, pricing, "
225
- "quotes, shipping, warranty & support. Type or **speak**.", elem_id="gm-header")
226
- status = gr.Markdown()
227
- chatbot = gr.Chatbot(type="messages", elem_id="gm-chat", height=420,
228
- avatar_images=(None, None))
229
- with gr.Row():
230
- box = gr.Textbox(placeholder="Ask about GPU Mart… e.g. What is the DRACO series?",
231
- elem_id="gm-box", scale=6, show_label=False, container=False)
232
- send = gr.Button("Send", variant="primary", elem_id="gm-send", scale=1)
233
- with gr.Row():
234
- mic_html = gr.HTML('<button id="mic-btn">🎤 Speak</button>')
235
- speak_tog = gr.Checkbox(value=True, label="🔊 Speak replies aloud", elem_id="speak-toggle")
236
- gr.Examples(["What is GPU Mart?", "Explain CARINA, QUASAR and DRACO",
237
- "Price of the DRACO 8× H200 server?", "What payment methods do you accept?",
238
- "How do I get a quote?"], inputs=box)
239
-
240
- def respond(message, history):
241
- history = history or []
242
- if not message or not message.strip():
243
- return history, ""
244
- history = history + [{"role": "user", "content": message}]
245
- reply = chat_fn(message, history[:-1])
246
- history = history + [{"role": "assistant", "content": reply}]
247
- return history, ""
248
-
249
- send.click(respond, [box, chatbot], [chatbot, box])
250
- box.submit(respond, [box, chatbot], [chatbot, box])
251
-
252
- def tick():
253
- icon = {"ready": "🟢", "training": "🟠", "error": "🔴"}.get(STATE["phase"], "⏳")
254
- return f"{icon} **Status:** {STATE['detail']}"
255
- timer = gr.Timer(5)
256
- timer.tick(tick, outputs=status)
257
- demo.load(tick, outputs=status, js=VOICE_JS)
258
-
259
- demo.launch()
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
index.html ADDED
@@ -0,0 +1,187 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <!DOCTYPE html>
2
+ <html lang="en">
3
+ <head>
4
+ <meta charset="UTF-8">
5
+ <meta name="viewport" content="width=device-width, initial-scale=1.0">
6
+ <title>GPU Mart Assistant — voice + text AI for RDP GPU Mart</title>
7
+ <meta name="description" content="Ask anything about RDP GPU Mart (rdp.in/gpu-mart) — India's datacenter-grade GPU marketplace. A small fine-tuned model, running right in your browser, with voice and text.">
8
+ <style>
9
+ :root { --red:#d82228; --bg:#e8e8e8; --ink:#1a1a1a; --card:#ffffff; }
10
+ * { box-sizing:border-box; margin:0; padding:0; }
11
+ body { font-family:'Segoe UI',system-ui,-apple-system,sans-serif; background:var(--bg); color:var(--ink);
12
+ display:flex; flex-direction:column; align-items:center; min-height:100vh; }
13
+ header { width:100%; background:#fff; border-bottom:3px solid var(--red); padding:14px 20px; text-align:center; }
14
+ header h1 { font-size:1.25rem; } header h1 span { color:var(--red); }
15
+ header p { font-size:.85rem; color:#555; margin-top:2px; }
16
+ #status { width:min(760px,94vw); margin:10px auto 0; font-size:.85rem; color:#444; background:#fff;
17
+ border-radius:10px; padding:8px 14px; border-left:4px solid var(--red); }
18
+ #bar { height:6px; background:#eee; border-radius:3px; margin-top:6px; overflow:hidden; display:none; }
19
+ #bar > div { height:100%; width:0%; background:var(--red); transition:width .3s; }
20
+ #chat { width:min(760px,94vw); flex:1; margin:12px auto; background:var(--card); border-radius:14px;
21
+ padding:16px; overflow-y:auto; min-height:340px; max-height:56vh; box-shadow:0 1px 4px rgba(0,0,0,.08); }
22
+ .msg { margin:8px 0; padding:10px 14px; border-radius:12px; max-width:85%; line-height:1.45; font-size:.95rem;
23
+ white-space:pre-wrap; word-wrap:break-word; }
24
+ .user { background:var(--red); color:#fff; margin-left:auto; }
25
+ .bot { background:#f2f2f2; }
26
+ #controls { width:min(760px,94vw); margin:0 auto 8px; display:flex; gap:8px; }
27
+ #box { flex:1; padding:12px 14px; border:1px solid #ccc; border-radius:10px; font-size:1rem; outline:none; }
28
+ #box:focus { border-color:var(--red); }
29
+ button { border:none; border-radius:10px; padding:12px 18px; font-size:1rem; cursor:pointer; }
30
+ #send { background:var(--red); color:#fff; }
31
+ #mic { background:#fff; color:var(--red); border:2px solid var(--red); }
32
+ #mic.listening { background:var(--red); color:#fff; animation:pulse 1.2s infinite; }
33
+ @keyframes pulse { 50% { opacity:.6; } }
34
+ #opts { width:min(760px,94vw); margin:0 auto 10px; display:flex; align-items:center; gap:14px; font-size:.85rem; color:#444; flex-wrap:wrap; }
35
+ .chip { background:#fff; border:1px solid #ddd; border-radius:16px; padding:5px 12px; cursor:pointer; font-size:.8rem; }
36
+ .chip:hover { border-color:var(--red); color:var(--red); }
37
+ footer { width:100%; text-align:center; font-size:.75rem; color:#777; padding:10px; }
38
+ footer a { color:var(--red); text-decoration:none; }
39
+ </style>
40
+ </head>
41
+ <body>
42
+ <header>
43
+ <h1>🖥️ GPU Mart <span>Assistant</span></h1>
44
+ <p>India's datacenter-grade GPU marketplace — ask by typing or speaking. Runs entirely in your browser.</p>
45
+ </header>
46
+
47
+ <div id="status">⏳ Loading the GPU Mart model…<div id="bar"><div></div></div></div>
48
+
49
+ <div id="chat"></div>
50
+
51
+ <div id="opts">
52
+ <label><input type="checkbox" id="speakToggle" checked> 🔊 Speak replies</label>
53
+ <span class="chip" data-q="What is GPU Mart?">What is GPU Mart?</span>
54
+ <span class="chip" data-q="Explain CARINA, QUASAR and DRACO">CARINA / QUASAR / DRACO</span>
55
+ <span class="chip" data-q="Price of the DRACO 8x H200 server?">DRACO 8× H200 price</span>
56
+ <span class="chip" data-q="How do I get a quote?">Get a quote</span>
57
+ </div>
58
+
59
+ <div id="controls">
60
+ <input id="box" type="text" placeholder="Ask about GPU Mart…" autocomplete="off">
61
+ <button id="mic" title="Speak your question">🎤</button>
62
+ <button id="send">Send</button>
63
+ </div>
64
+
65
+ <footer>
66
+ Model: <a href="https://huggingface.co/VickyRDP/gpumart-qwen2.5-0.5b-instruct" target="_blank">gpumart fine-tune</a> ·
67
+ Store: <a href="https://rdp.in/gpu-mart/" target="_blank">rdp.in/gpu-mart</a> ·
68
+ Sales: +91&nbsp;720&nbsp;794&nbsp;8743
69
+ </footer>
70
+
71
+ <script type="module">
72
+ const MODEL_ID = 'VickyRDP/gpumart-qwen2.5-0.5b-instruct';
73
+ const SYSTEM = "You are the GPU Mart assistant for RDP GPU Mart (rdp.in/gpu-mart), India's datacenter-grade GPU marketplace by RDP Computers India Private Limited. Answer questions about GPU Mart products, series, pricing, policies and support accurately and concisely.";
74
+
75
+ const chatEl = document.getElementById('chat');
76
+ const statusEl = document.getElementById('status');
77
+ const barWrap = document.getElementById('bar');
78
+ const bar = barWrap.querySelector('div');
79
+ const box = document.getElementById('box');
80
+ const sendBtn = document.getElementById('send');
81
+ const micBtn = document.getElementById('mic');
82
+ const speakToggle = document.getElementById('speakToggle');
83
+
84
+ const history = [];
85
+ let generator = null, busy = false;
86
+
87
+ function addMsg(text, cls) {
88
+ const d = document.createElement('div');
89
+ d.className = 'msg ' + cls;
90
+ d.textContent = text;
91
+ chatEl.appendChild(d);
92
+ chatEl.scrollTop = chatEl.scrollHeight;
93
+ return d;
94
+ }
95
+
96
+ function speak(text) {
97
+ if (!speakToggle.checked || !window.speechSynthesis) return;
98
+ speechSynthesis.cancel();
99
+ const u = new SpeechSynthesisUtterance(text.slice(0, 800));
100
+ u.lang = 'en-IN'; u.rate = 1.02;
101
+ const vs = speechSynthesis.getVoices();
102
+ u.voice = vs.find(v => v.lang === 'en-IN') || vs.find(v => v.lang.startsWith('en')) || null;
103
+ speechSynthesis.speak(u);
104
+ }
105
+
106
+ async function loadModel() {
107
+ try {
108
+ const { pipeline, TextStreamer } = await import('https://cdn.jsdelivr.net/npm/@huggingface/transformers@3.5.2');
109
+ window.__TextStreamer = TextStreamer;
110
+ let device = 'wasm', dtype = 'q8';
111
+ if (navigator.gpu) { try { if (await navigator.gpu.requestAdapter()) { device = 'webgpu'; dtype = 'q4'; } } catch (e) {} }
112
+ statusEl.firstChild.textContent = `⏳ Downloading the GPU Mart model (one-time, cached after) — ${device.toUpperCase()} mode…`;
113
+ barWrap.style.display = 'block';
114
+ const files = {};
115
+ generator = await pipeline('text-generation', MODEL_ID, {
116
+ device, dtype,
117
+ progress_callback: p => {
118
+ if (p.status === 'progress' && p.total) {
119
+ files[p.file] = [p.loaded, p.total];
120
+ let l = 0, t = 0; for (const k in files) { l += files[k][0]; t += files[k][1]; }
121
+ bar.style.width = Math.round(100 * l / t) + '%';
122
+ }
123
+ }
124
+ });
125
+ barWrap.style.display = 'none';
126
+ statusEl.firstChild.textContent = '🟢 GPU Mart model loaded — ask away (type or tap the mic).';
127
+ addMsg("Namaste! I'm the GPU Mart assistant — trained on RDP GPU Mart's catalog and policies. Ask me about products, CARINA/QUASAR/DRACO series, pricing, quotes, shipping, warranty or support.", 'bot');
128
+ } catch (e) {
129
+ console.error(e);
130
+ statusEl.firstChild.textContent = '🔴 Could not load the model — it may still be uploading to Hugging Face. Please refresh in a few minutes. Meanwhile, visit rdp.in/gpu-mart or call +91 720 794 8743.';
131
+ }
132
+ }
133
+
134
+ async function respond(text) {
135
+ if (!text.trim() || busy) return;
136
+ box.value = '';
137
+ addMsg(text, 'user');
138
+ if (!generator) { addMsg('The model is still loading — one moment please…', 'bot'); return; }
139
+ busy = true; sendBtn.disabled = true;
140
+ const botEl = addMsg('…', 'bot');
141
+ try {
142
+ const msgs = [{ role: 'system', content: SYSTEM }, ...history.slice(-6), { role: 'user', content: text }];
143
+ let out = '';
144
+ const streamer = new window.__TextStreamer(generator.tokenizer, {
145
+ skip_prompt: true, skip_special_tokens: true,
146
+ callback_function: t => { out += t; botEl.textContent = out; chatEl.scrollTop = chatEl.scrollHeight; }
147
+ });
148
+ const res = await generator(msgs, { max_new_tokens: 220, do_sample: true, temperature: 0.3, top_p: 0.9, repetition_penalty: 1.1, streamer });
149
+ const full = (res[0].generated_text.at(-1).content || out).trim();
150
+ botEl.textContent = full;
151
+ history.push({ role: 'user', content: text }, { role: 'assistant', content: full });
152
+ speak(full);
153
+ } catch (e) {
154
+ console.error(e);
155
+ botEl.textContent = 'Sorry, something went wrong generating a reply. Please try again.';
156
+ }
157
+ busy = false; sendBtn.disabled = false;
158
+ }
159
+
160
+ sendBtn.onclick = () => respond(box.value);
161
+ box.addEventListener('keydown', e => { if (e.key === 'Enter') respond(box.value); });
162
+ document.querySelectorAll('.chip').forEach(c => c.onclick = () => respond(c.dataset.q));
163
+
164
+ // ---- Voice input (Web Speech API) ----
165
+ const SR = window.SpeechRecognition || window.webkitSpeechRecognition;
166
+ if (!SR) { micBtn.disabled = true; micBtn.title = 'Voice input not supported in this browser'; }
167
+ let rec = null, listening = false;
168
+ micBtn.onclick = () => {
169
+ if (!SR) return;
170
+ if (listening) { rec && rec.stop(); return; }
171
+ rec = new SR();
172
+ rec.lang = 'en-IN'; rec.interimResults = true;
173
+ let finalTxt = '';
174
+ rec.onresult = e => { let t = ''; for (const r of e.results) t += r[0].transcript; box.value = t;
175
+ if (e.results[e.results.length - 1].isFinal) finalTxt = t; };
176
+ rec.onend = () => { listening = false; micBtn.classList.remove('listening'); micBtn.textContent = '🎤';
177
+ if (finalTxt.trim()) respond(finalTxt); };
178
+ rec.onerror = () => { listening = false; micBtn.classList.remove('listening'); micBtn.textContent = '🎤'; };
179
+ listening = true; micBtn.classList.add('listening'); micBtn.textContent = '🔴';
180
+ rec.start();
181
+ };
182
+ if (window.speechSynthesis) speechSynthesis.getVoices();
183
+
184
+ loadModel();
185
+ </script>
186
+ </body>
187
+ </html>
make_dataset.py DELETED
@@ -1,263 +0,0 @@
1
- #!/usr/bin/env python3
2
- """Generate GPU Mart Q&A training dataset (chat format JSONL) from crawled knowledge."""
3
- import json, random, itertools
4
- random.seed(42)
5
-
6
- SYSTEM = ("You are the GPU Mart assistant for RDP GPU Mart (rdp.in/gpu-mart), India's "
7
- "datacenter-grade GPU marketplace by RDP Computers India Private Limited. "
8
- "Answer questions about GPU Mart products, series, pricing, policies and support "
9
- "accurately and concisely.")
10
-
11
- pairs = []
12
- def qa(q, a):
13
- pairs.append({"messages": [
14
- {"role": "system", "content": SYSTEM},
15
- {"role": "user", "content": q},
16
- {"role": "assistant", "content": a}]})
17
-
18
- def multi(questions, answer):
19
- for q in questions:
20
- qa(q, answer)
21
-
22
- # ---------- 1. Identity / overview ----------
23
- multi(["What is GPU Mart?", "Tell me about GPU Mart", "What is RDP GPU Mart?",
24
- "gpu mart kya hai?", "Explain GPU Mart to me", "Who runs GPU Mart?",
25
- "What does GPU Mart sell?"],
26
- "GPU Mart (rdp.in/gpu-mart) is India's datacenter-grade GPU marketplace by RDP Computers "
27
- "India Private Limited. You can buy AI infrastructure, HPC systems and supercomputers online — "
28
- "from desk-side AI workstations to rack-scale NVL72 AI factories and superclusters. It is "
29
- "Make-in-India and sovereign-ready, with transparent INR pricing, GST invoicing, enterprise "
30
- "warranty and pan-India onsite support.")
31
-
32
- multi(["Who is GPU Mart for?", "Is GPU Mart for enterprises?", "Who is the target customer of GPU Mart?"],
33
- "GPU Mart is built for infrastructure leaders — CIOs, CTOs, neocloud builders, enterprises, "
34
- "government and public sector, research institutions and startups that need datacenter-grade "
35
- "AI compute in India with INR pricing and GST invoicing.")
36
-
37
- multi(["Is GPU Mart Indian?", "Is GPU Mart Make in India?", "Where is GPU Mart based?",
38
- "Where are GPU Mart systems manufactured?"],
39
- "Yes. GPU Mart is run by RDP Computers India Private Limited, a Make-in-India OEM with a "
40
- "28,000 sq ft manufacturing facility in Hyderabad. RDP has 14 years of building in India, "
41
- "300,000+ devices shipped and 1M+ end users. It is ISO 9001 certified, BIS certified, "
42
- "MeitY recognised, PLI 2.0 selected and available on GeM.")
43
-
44
- multi(["What certifications does GPU Mart / RDP have?", "Is RDP ISO certified?",
45
- "Is GPU Mart available on GeM?"],
46
- "RDP is ISO 9001 certified, BIS certified, MeitY recognised, PLI 2.0 selected, and a "
47
- "Make-in-India OEM. Products are available on GeM (Government e-Marketplace). ISO 27001 "
48
- "and SOC 2 aligned deployment paths are available for sovereign and regulated customers.")
49
-
50
- # ---------- 2. Series ----------
51
- multi(["What are the GPU Mart product series?", "What is CARINA QUASAR DRACO?",
52
- "Explain the series names", "What series do you offer?"],
53
- "GPU Mart has three product series: CARINA (entry tier — desk-side AI workstations), "
54
- "QUASAR (performance tier — multi-GPU training and inference systems), and DRACO "
55
- "(flagship tier — rack-scale AI systems and superclusters).")
56
- multi(["What is CARINA?", "Tell me about the CARINA series"],
57
- "CARINA is GPU Mart's entry series — desk-side AI workstations, typically single-GPU RTX PRO "
58
- "Blackwell systems for developers and researchers. Example: CARINA 1× RTX PRO 6000 Blackwell "
59
- "with 96 GB GDDR7, Xeon W-3500, 128 GB DDR5 ECC and 4 TB NVMe.")
60
- multi(["What is QUASAR?", "Tell me about the QUASAR series"],
61
- "QUASAR is GPU Mart's performance series — multi-GPU (typically 2–8× GPU) workstations and "
62
- "servers for training and inference. Examples: QUASAR 2× RTX PRO 6000 Blackwell workstation "
63
- "(192 GB GDDR7 total) and QUASAR 8× RTX PRO 6000 Blackwell GPU Server (768 GB GDDR7).")
64
- multi(["What is DRACO?", "Tell me about the DRACO series"],
65
- "DRACO is GPU Mart's flagship series — rack-scale AI systems, HGX GPU servers and "
66
- "superclusters. Examples: DRACO 8× H200 141GB SXM5 GPU Server at ₹5.92 Cr + GST, DRACO 8× "
67
- "B300 HGX at ₹10.35 Cr + GST, and DRACO GB300 NVL72 superclusters up to 64 racks.")
68
-
69
- # ---------- 3. Categories ----------
70
- multi(["What categories of products does GPU Mart have?", "What can I buy on GPU Mart?",
71
- "List GPU Mart categories"],
72
- "GPU Mart has 16 categories: AI SuperClusters, Supercomputers, Rack-Scale AI Systems, HPC "
73
- "Clusters, GPU Servers, Multi-Node & Blade, Enterprise Rack & Tower, AI Workstations, "
74
- "Agentic AI PCs & Edge AI, AI Networking, Storage Systems, Liquid Cooling & Thermal, "
75
- "Datacenter Infrastructure, Edge & Micro Data Center, Cluster Software & Management, and "
76
- "Datacenter Services & Financing — 145 systems in all.")
77
- multi(["How many products does GPU Mart have?", "How big is the GPU Mart catalog?"],
78
- "The GPU Mart catalog has about 145 systems across 16 categories — from AI workstations "
79
- "starting at ₹9.2 lakh to rack-scale AI factories from ₹42 crore and superclusters with "
80
- "thousands of GPUs.")
81
-
82
- # ---------- 4. Flagship products ----------
83
- qa("What is the NVIDIA GB300 NVL72 on GPU Mart?",
84
- "The NVIDIA GB300 NVL72 Rack-Scale AI Factory (SKU 300072) is GPU Mart's flagship rack: 72× "
85
- "Blackwell Ultra GPUs, 36× NVIDIA Grace CPUs, about 20 TB HBM3e and 17 TB LPDDR5X. Price: "
86
- "₹42 Cr + GST, available with Add to cart on rdp.in/gpu-mart.")
87
- multi(["What is the most expensive product on GPU Mart?", "What is GPU Mart's flagship system?"],
88
- "The flagship listed-price system is the NVIDIA GB300 NVL72 Rack-Scale AI Factory (SKU "
89
- "300072) at ₹42 Cr + GST — 72× Blackwell Ultra with ~20 TB HBM3e. Even larger DRACO "
90
- "GB300 superclusters (8, 16, 32 or 64 racks) are available on request-a-quote.")
91
- qa("Tell me about the DRACO 8x H200 server",
92
- "The DRACO 8× H200 141GB SXM5 GPU Server (SKU 200008) has 8× H200 SXM5 GPUs with 1,128 GB "
93
- "HBM3e total, 2× Intel Xeon 8558 (48-core), 2 TB DDR5-5600 ECC, NVMe storage and 8× 400G "
94
- "InfiniBand. Price ₹5.92 Cr + GST, Buy now, ships in about 7 weeks.")
95
- qa("Tell me about the DRACO 8x B300 server",
96
- "The DRACO 8× B300 HGX GPU Server (SKU 300008) has 8× B300 HGX GPUs with 2,304 GB HBM3e, 2× "
97
- "Intel Xeon 6 6767P (64-core), 4 TB DDR5-6400 and 8× 800G InfiniBand XDR. Price ₹10.35 Cr + "
98
- "GST, Buy now, ships in about 8 weeks.")
99
- multi(["What GPU servers do you sell?", "Which GPU servers are on GPU Mart?"],
100
- "GPU Mart sells production GPU servers with L40S, H100/H200, B200/B300 and RTX PRO 6000 "
101
- "Blackwell GPUs — air- or liquid-cooled. DRACO models include 4×/8× H200 (NVL and SXM), 4×/8× "
102
- "B200 SXM, 8× B300 (HGX and SXM); QUASAR models include 2×, 4× and 8× RTX PRO 6000 Blackwell "
103
- "servers. Flagships: DRACO 8× H200 SXM5 at ₹5.92 Cr + GST and DRACO 8× B300 HGX at ₹10.35 Cr + GST.")
104
- multi(["What AI workstations do you have?", "Which workstations can I buy?"],
105
- "GPU Mart offers 9 desk-side RTX PRO Blackwell AI workstations: CARINA 1× RTX PRO 4500/5000/"
106
- "6000, QUASAR 2× RTX PRO 4500/5000/6000, and DRACO 4× RTX PRO 4500/5000/6000. They range "
107
- "from 32 GB to 384 GB GDDR7, with Xeon W CPUs, ECC DDR5 and NVMe — made to order, starting "
108
- "around ₹9.2 lakh. They cover fine-tuning and inference for roughly 13B to 180B models.")
109
- multi(["What superclusters do you offer?", "Can GPU Mart build a supercluster?"],
110
- "Yes — turnkey AI superclusters delivered and validated as one system. DRACO GB300 NVL72 "
111
- "superclusters come in 8, 16, 32 and 64-rack configurations (up to 1.3 PB HBM3e, 4,608 GPUs), "
112
- "plus GB200 NVL72 clusters and 256×/512× H200 or B200 SXM clusters with spine-leaf "
113
- "InfiniBand. All are made to order via Request a Quote.")
114
- qa("What is the cheapest system on GPU Mart?",
115
- "Entry points include the RDP 42U Rack + PDU Lite at ₹1,33,000 + GST on the infrastructure "
116
- "side, virtualization servers from ₹2,24,000 + GST, and desk-side AI workstations from about "
117
- "₹9.2 lakh.")
118
- qa("Do you sell networking equipment?",
119
- "Yes — the AI Networking category covers InfiniBand and 400G Ethernet fabric, for example the "
120
- "RDP 400G AI Switch (SKU 609704) at ₹6,20,000 + GST.")
121
- qa("Do you sell storage systems?",
122
- "Yes — the Storage Systems category offers high-throughput NVMe and parallel-filesystem "
123
- "storage for AI and HPC workloads.")
124
- qa("Do you offer liquid cooling?",
125
- "Yes — GPU Mart has a Liquid Cooling & Thermal category with direct-to-chip liquid cooling. "
126
- "In the configure-and-build flow, Direct Liquid Cooling is a +₹4,50,000 option and is required "
127
- "for 8-GPU H100 SXM class systems.")
128
-
129
- # ---------- 5. Buying / pricing ----------
130
- multi(["How do I buy from GPU Mart?", "What are the ways to purchase?", "How does buying work?"],
131
- "Three ways: (1) Add to cart / Buy now for stocked, listed-price systems; (2) Configure & "
132
- "build — an 8-step configurator with live indicative pricing and a fast quote within 1 "
133
- "business day; (3) Request a Quote for made-to-order, rack-scale and supercluster systems. "
134
- "All pricing is INR ex-works plus 18% GST.")
135
- multi(["How does the configurator work?", "Can I customize a server?", "What is Configure & Build?"],
136
- "The Configure & Build flow at rdp.in/gpu-mart/build has 8 steps: platform (2U/4U/8U HGX, "
137
- "from ₹5,90,000), GPU (L40S, H100 PCIe, H100 SXM), CPU (Xeon Silver/Gold or EPYC 9004), "
138
- "memory (512 GB–2 TB DDR5 ECC), storage (NVMe up to 8× 7.68 TB), networking (25GbE, 100GbE, "
139
- "or 400G InfiniBand), cooling (air or direct liquid), and support (3-year onsite included, "
140
- "5-year and SLA options). Estimates update live and every configuration routes to a quote "
141
- "confirmed within 1 business day.")
142
- multi(["How do I get a quote?", "How to request pricing?"],
143
- "Use Request a Quote on any product page, or go to rdp.in/contact?type=gpu-mart-quote, or "
144
- "call +91 720 794 8743. Quotes are typically confirmed within 1 business day, with pricing "
145
- "in INR ex-works + 18% GST.")
146
- multi(["What payment methods do you accept?", "How can I pay?"],
147
- "GPU Mart accepts NEFT, RTGS and IMPS bank transfer, UPI, corporate credit/debit cards, and "
148
- "approved purchase orders. High-value orders typically use bank transfer against a proforma "
149
- "invoice. Enterprise and government clients can use POs subject to credit approval.")
150
- multi(["Do you give GST invoices?", "Is GST included in prices?", "Can I claim input tax credit?"],
151
- "Prices exclude GST unless noted; 18% GST applies. GPU Mart issues compliant tax invoices "
152
- "under the CGST/IGST Acts with RDP's GSTIN (36AALCR2482F1Z7) and your GSTIN, so eligible "
153
- "buyers can claim input-tax credit. Provide accurate billing details and GSTIN before invoicing.")
154
- qa("Do you ship internationally?",
155
- "GPU Mart primarily serves all of India; international shipping is available by agreement. "
156
- "Cross-border orders may be invoiced in USD and must comply with the Export & International "
157
- "Orders Policy and FEMA, with destination duties payable by the buyer.")
158
- qa("Do you offer financing?",
159
- "Yes — the Datacenter Services & Financing category covers integration and financing, and "
160
- "GPU-as-a-Service options are also available. Talk to the solution architects on "
161
- "+91 720 794 8743 for structures.")
162
- qa("Is GPU Mart on GeM?",
163
- "Yes, RDP products are available on GeM (Government e-Marketplace) — see rdp.in/gem for GeM "
164
- "availability, useful for government and public-sector procurement.")
165
-
166
- # ---------- 6. Shipping / delivery ----------
167
- multi(["What are the shipping times?", "How long does delivery take?", "When will my order ship?"],
168
- "In-stock items typically dispatch within 3–7 business days. Configured, imported or "
169
- "project orders follow the timelines in your quotation — for example, the DRACO 8× H200 "
170
- "server ships in about 7 weeks and the 8× B300 HGX in about 8 weeks. Delivery windows are "
171
- "disclosed before purchase confirmation, and tracking is shared after dispatch.")
172
- qa("What do I need to receive a rack delivery?",
173
- "Heavy rack and project deliveries need appropriate receiving infrastructure at your site — "
174
- "dock access and sufficient staff. Regional serviceability for heavy racks is confirmed during "
175
- "quotation, and pan-India onsite installation is available.")
176
- qa("What if my shipment arrives damaged?",
177
- "Inspect immediately on arrival. Note visible damage or missing items on the delivery receipt, "
178
- "take photos, and report within 48 hours so carrier/insurance claims can be pursued. "
179
- "Non-functional units are covered under DOA warranty provisions.")
180
-
181
- # ---------- 7. Returns / warranty ----------
182
- multi(["What is the return policy?", "Can I return a product?"],
183
- "Stocked-item orders can be cancelled within 24 hours of acceptance if not dispatched. "
184
- "Voluntary returns of non-defective items must be reported within 7 days of delivery, "
185
- "unused and in original packaging with an RMA number; a restocking fee up to 15% plus "
186
- "freight may apply. Configured/CTO, special-order and imported items are generally "
187
- "non-cancellable and non-returnable once components are allocated. Defective items are "
188
- "handled under warranty regardless, per the Consumer Protection Act, 2019.")
189
- multi(["What is the warranty?", "What warranty do GPU Mart products carry?"],
190
- "Products are covered against manufacturing defects for the period stated on the invoice/"
191
- "quotation or by the relevant OEM (NVIDIA, Intel, AMD, Supermicro etc.). Configured systems "
192
- "include 3-year pan-India onsite warranty, with 5-year and enhanced SLA/AMC options. DOA "
193
- "units must be reported within 7 days for repair or replacement.")
194
- multi(["How do I raise an RMA?", "How do I get support for a faulty unit?"],
195
- "Email support@rdp.in with your invoice, serial numbers and fault description. RDP issues "
196
- "an RMA number with return instructions; after diagnosis the unit is repaired, replaced or "
197
- "credited per warranty eligibility. Don't ship anything back without an RMA number. Phone: "
198
- "+91 720 794 8743 (Mon–Sat, 10:00–19:00 IST).")
199
- qa("How long do refunds take?",
200
- "Approved refunds are processed to the original payment method (or bank transfer for offline "
201
- "orders) typically within 7–14 business days after inspection.")
202
-
203
- # ---------- 8. Use cases / industries ----------
204
- multi(["What use cases do GPU Mart systems cover?", "What workloads are these systems for?"],
205
- "Nine use-case tracks: LLM Training, Fine-tuning & RAG, Inference & Edge, Generative AI, "
206
- "Agentic AI, HPC & AI, NLP & Speech, Computer Vision, and Sovereign AI. Each has curated "
207
- "systems from CARINA workstations up to DRACO superclusters.")
208
- multi(["Which industries does GPU Mart serve?", "Do you have industry solutions?"],
209
- "GPU Mart has solutions for Neocloud, Public Sector & Sovereign AI, BFSI & HFT, Healthcare "
210
- "& Life Sciences, Manufacturing, Enterprise & GCCs, Research & Higher Education, Automotive "
211
- "& Mobility, Defence & Aerospace, Media & Entertainment, Telecom & 5G, and Retail & "
212
- "E-commerce.")
213
- qa("I want to fine-tune a 70B model. What should I buy?",
214
- "For 70B-class fine-tuning, look at QUASAR/DRACO multi-GPU systems: a DRACO 4× RTX PRO 6000 "
215
- "Blackwell workstation (384 GB GDDR7) for LoRA-style work, or a DRACO 4×/8× H200 GPU server "
216
- "for full fine-tunes. Use Request a Quote or call +91 720 794 8743 and the solution architects "
217
- "will size it for your workload.")
218
- qa("What should I buy for LLM inference?",
219
- "For inference, options scale from CARINA/QUASAR RTX PRO Blackwell workstations for smaller "
220
- "models, to QUASAR RTX PRO 6000 servers and DRACO H200 NVL servers for high-throughput "
221
- "serving. L40S-based configurations in the Configure & Build flow are also inference-optimized.")
222
- qa("Do you support sovereign AI deployments?",
223
- "Yes — GPU Mart is sovereign-ready: Make-in-India OEM, MeitY recognised, DPDP-aligned data "
224
- "residency with on-prem/colo-ready deployment, ISO 27001 & SOC 2 paths, and GeM availability "
225
- "for government procurement.")
226
-
227
- # ---------- 9. Contact ----------
228
- multi(["How do I contact GPU Mart?", "What is GPU Mart's phone number?", "Contact details please"],
229
- "Phone: +91 720 794 8743 (Mon–Sat, 10:00–19:00 IST). Sales: sales@rdp.in · Support: "
230
- "support@rdp.in. Quotes: rdp.in/contact?type=gpu-mart-quote. GPU Mart is by RDP Computers "
231
- "India Private Limited, with a 28,000 sq ft manufacturing facility in Hyderabad.")
232
- qa("Can I talk to a human expert?",
233
- "Yes — GPU Mart's solution architects are available on +91 720 794 8743 (Mon–Sat, 10:00–19:00 "
234
- "IST) or via rdp.in/contact?type=gpu-mart-quote to size and design your deployment.")
235
-
236
- # ---------- 10. Guardrails ----------
237
- multi(["What's the weather today?", "Write me a poem about love", "Who won the cricket match?"],
238
- "I'm the GPU Mart assistant, so I can only help with RDP GPU Mart — products, series "
239
- "(CARINA, QUASAR, DRACO), pricing, quotes, shipping, warranty and support. What would you "
240
- "like to know about GPU Mart?")
241
- qa("Are you ChatGPT?",
242
- "No — I'm the GPU Mart assistant, a model trained on RDP GPU Mart's catalog and policies to "
243
- "answer questions about India's datacenter-grade GPU marketplace at rdp.in/gpu-mart.")
244
-
245
- # ---------- Paraphrase augmentation ----------
246
- # Light augmentation: prepend/append conversational variants to boost robustness
247
- prefixes = ["", "Hi, ", "Hello! ", "Quick question - ", "hey ", "Please tell me: "]
248
- aug = []
249
- for p in pairs:
250
- q = p["messages"][1]["content"]
251
- for pre in random.sample(prefixes, 2):
252
- if pre:
253
- aug.append({"messages": [
254
- p["messages"][0],
255
- {"role": "user", "content": pre + q[0].lower() + q[1:] if pre.islower() else pre + q},
256
- p["messages"][2]]})
257
- pairs.extend(aug)
258
- random.shuffle(pairs)
259
-
260
- with open("gpumart_train.jsonl", "w") as f:
261
- for p in pairs:
262
- f.write(json.dumps(p, ensure_ascii=False) + "\n")
263
- print(f"Wrote {len(pairs)} examples to gpumart_train.jsonl")
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
requirements.txt DELETED
@@ -1,8 +0,0 @@
1
- --extra-index-url https://download.pytorch.org/whl/cpu
2
- torch>=2.4.0
3
- transformers>=4.45.0,<5
4
- peft>=0.13.0
5
- datasets>=3.0.0
6
- accelerate>=1.0.0
7
- huggingface_hub>=0.26.0
8
- sentencepiece
 
 
 
 
 
 
 
 
 
xfer/config.json.bin DELETED
@@ -1,27 +0,0 @@
1
- {
2
- "architectures": [
3
- "Qwen2ForCausalLM"
4
- ],
5
- "attention_dropout": 0.0,
6
- "bos_token_id": 151643,
7
- "eos_token_id": 151645,
8
- "hidden_act": "silu",
9
- "hidden_size": 896,
10
- "initializer_range": 0.02,
11
- "intermediate_size": 4864,
12
- "max_position_embeddings": 32768,
13
- "max_window_layers": 21,
14
- "model_type": "qwen2",
15
- "num_attention_heads": 14,
16
- "num_hidden_layers": 24,
17
- "num_key_value_heads": 2,
18
- "rms_norm_eps": 1e-06,
19
- "rope_theta": 1000000.0,
20
- "sliding_window": 32768,
21
- "tie_word_embeddings": true,
22
- "torch_dtype": "bfloat16",
23
- "transformers_version": "4.43.1",
24
- "use_cache": true,
25
- "use_sliding_window": false,
26
- "vocab_size": 151936
27
- }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
xfer/generation_config.json.bin DELETED
@@ -1,14 +0,0 @@
1
- {
2
- "bos_token_id": 151643,
3
- "pad_token_id": 151643,
4
- "do_sample": true,
5
- "eos_token_id": [
6
- 151645,
7
- 151643
8
- ],
9
- "repetition_penalty": 1.1,
10
- "temperature": 0.7,
11
- "top_p": 0.8,
12
- "top_k": 20,
13
- "transformers_version": "4.37.0"
14
- }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
xfer/merges.txt.bin DELETED
The diff for this file is too large to render. See raw diff
 
xfer/tokenizer.json.bin DELETED
The diff for this file is too large to render. See raw diff
 
xfer/tokenizer_config.json.bin DELETED
@@ -1,207 +0,0 @@
1
- {
2
- "add_bos_token": false,
3
- "add_prefix_space": false,
4
- "added_tokens_decoder": {
5
- "151643": {
6
- "content": "<|endoftext|>",
7
- "lstrip": false,
8
- "normalized": false,
9
- "rstrip": false,
10
- "single_word": false,
11
- "special": true
12
- },
13
- "151644": {
14
- "content": "<|im_start|>",
15
- "lstrip": false,
16
- "normalized": false,
17
- "rstrip": false,
18
- "single_word": false,
19
- "special": true
20
- },
21
- "151645": {
22
- "content": "<|im_end|>",
23
- "lstrip": false,
24
- "normalized": false,
25
- "rstrip": false,
26
- "single_word": false,
27
- "special": true
28
- },
29
- "151646": {
30
- "content": "<|object_ref_start|>",
31
- "lstrip": false,
32
- "normalized": false,
33
- "rstrip": false,
34
- "single_word": false,
35
- "special": true
36
- },
37
- "151647": {
38
- "content": "<|object_ref_end|>",
39
- "lstrip": false,
40
- "normalized": false,
41
- "rstrip": false,
42
- "single_word": false,
43
- "special": true
44
- },
45
- "151648": {
46
- "content": "<|box_start|>",
47
- "lstrip": false,
48
- "normalized": false,
49
- "rstrip": false,
50
- "single_word": false,
51
- "special": true
52
- },
53
- "151649": {
54
- "content": "<|box_end|>",
55
- "lstrip": false,
56
- "normalized": false,
57
- "rstrip": false,
58
- "single_word": false,
59
- "special": true
60
- },
61
- "151650": {
62
- "content": "<|quad_start|>",
63
- "lstrip": false,
64
- "normalized": false,
65
- "rstrip": false,
66
- "single_word": false,
67
- "special": true
68
- },
69
- "151651": {
70
- "content": "<|quad_end|>",
71
- "lstrip": false,
72
- "normalized": false,
73
- "rstrip": false,
74
- "single_word": false,
75
- "special": true
76
- },
77
- "151652": {
78
- "content": "<|vision_start|>",
79
- "lstrip": false,
80
- "normalized": false,
81
- "rstrip": false,
82
- "single_word": false,
83
- "special": true
84
- },
85
- "151653": {
86
- "content": "<|vision_end|>",
87
- "lstrip": false,
88
- "normalized": false,
89
- "rstrip": false,
90
- "single_word": false,
91
- "special": true
92
- },
93
- "151654": {
94
- "content": "<|vision_pad|>",
95
- "lstrip": false,
96
- "normalized": false,
97
- "rstrip": false,
98
- "single_word": false,
99
- "special": true
100
- },
101
- "151655": {
102
- "content": "<|image_pad|>",
103
- "lstrip": false,
104
- "normalized": false,
105
- "rstrip": false,
106
- "single_word": false,
107
- "special": true
108
- },
109
- "151656": {
110
- "content": "<|video_pad|>",
111
- "lstrip": false,
112
- "normalized": false,
113
- "rstrip": false,
114
- "single_word": false,
115
- "special": true
116
- },
117
- "151657": {
118
- "content": "<tool_call>",
119
- "lstrip": false,
120
- "normalized": false,
121
- "rstrip": false,
122
- "single_word": false,
123
- "special": false
124
- },
125
- "151658": {
126
- "content": "</tool_call>",
127
- "lstrip": false,
128
- "normalized": false,
129
- "rstrip": false,
130
- "single_word": false,
131
- "special": false
132
- },
133
- "151659": {
134
- "content": "<|fim_prefix|>",
135
- "lstrip": false,
136
- "normalized": false,
137
- "rstrip": false,
138
- "single_word": false,
139
- "special": false
140
- },
141
- "151660": {
142
- "content": "<|fim_middle|>",
143
- "lstrip": false,
144
- "normalized": false,
145
- "rstrip": false,
146
- "single_word": false,
147
- "special": false
148
- },
149
- "151661": {
150
- "content": "<|fim_suffix|>",
151
- "lstrip": false,
152
- "normalized": false,
153
- "rstrip": false,
154
- "single_word": false,
155
- "special": false
156
- },
157
- "151662": {
158
- "content": "<|fim_pad|>",
159
- "lstrip": false,
160
- "normalized": false,
161
- "rstrip": false,
162
- "single_word": false,
163
- "special": false
164
- },
165
- "151663": {
166
- "content": "<|repo_name|>",
167
- "lstrip": false,
168
- "normalized": false,
169
- "rstrip": false,
170
- "single_word": false,
171
- "special": false
172
- },
173
- "151664": {
174
- "content": "<|file_sep|>",
175
- "lstrip": false,
176
- "normalized": false,
177
- "rstrip": false,
178
- "single_word": false,
179
- "special": false
180
- }
181
- },
182
- "additional_special_tokens": [
183
- "<|im_start|>",
184
- "<|im_end|>",
185
- "<|object_ref_start|>",
186
- "<|object_ref_end|>",
187
- "<|box_start|>",
188
- "<|box_end|>",
189
- "<|quad_start|>",
190
- "<|quad_end|>",
191
- "<|vision_start|>",
192
- "<|vision_end|>",
193
- "<|vision_pad|>",
194
- "<|image_pad|>",
195
- "<|video_pad|>"
196
- ],
197
- "bos_token": null,
198
- "chat_template": "{%- if tools %}\n {{- '<|im_start|>system\\n' }}\n {%- if messages[0]['role'] == 'system' %}\n {{- messages[0]['content'] }}\n {%- else %}\n {{- 'You are Qwen, created by Alibaba Cloud. You are a helpful assistant.' }}\n {%- endif %}\n {{- \"\\n\\n# Tools\\n\\nYou may call one or more functions to assist with the user query.\\n\\nYou are provided with function signatures within <tools></tools> XML tags:\\n<tools>\" }}\n {%- for tool in tools %}\n {{- \"\\n\" }}\n {{- tool | tojson }}\n {%- endfor %}\n {{- \"\\n</tools>\\n\\nFor each function call, return a json object with function name and arguments within <tool_call></tool_call> XML tags:\\n<tool_call>\\n{\\\"name\\\": <function-name>, \\\"arguments\\\": <args-json-object>}\\n</tool_call><|im_end|>\\n\" }}\n{%- else %}\n {%- if messages[0]['role'] == 'system' %}\n {{- '<|im_start|>system\\n' + messages[0]['content'] + '<|im_end|>\\n' }}\n {%- else %}\n {{- '<|im_start|>system\\nYou are Qwen, created by Alibaba Cloud. You are a helpful assistant.<|im_end|>\\n' }}\n {%- endif %}\n{%- endif %}\n{%- for message in messages %}\n {%- if (message.role == \"user\") or (message.role == \"system\" and not loop.first) or (message.role == \"assistant\" and not message.tool_calls) %}\n {{- '<|im_start|>' + message.role + '\\n' + message.content + '<|im_end|>' + '\\n' }}\n {%- elif message.role == \"assistant\" %}\n {{- '<|im_start|>' + message.role }}\n {%- if message.content %}\n {{- '\\n' + message.content }}\n {%- endif %}\n {%- for tool_call in message.tool_calls %}\n {%- if tool_call.function is defined %}\n {%- set tool_call = tool_call.function %}\n {%- endif %}\n {{- '\\n<tool_call>\\n{\"name\": \"' }}\n {{- tool_call.name }}\n {{- '\", \"arguments\": ' }}\n {{- tool_call.arguments | tojson }}\n {{- '}\\n</tool_call>' }}\n {%- endfor %}\n {{- '<|im_end|>\\n' }}\n {%- elif message.role == \"tool\" %}\n {%- if (loop.index0 == 0) or (messages[loop.index0 - 1].role != \"tool\") %}\n {{- '<|im_start|>user' }}\n {%- endif %}\n {{- '\\n<tool_response>\\n' }}\n {{- message.content }}\n {{- '\\n</tool_response>' }}\n {%- if loop.last or (messages[loop.index0 + 1].role != \"tool\") %}\n {{- '<|im_end|>\\n' }}\n {%- endif %}\n {%- endif %}\n{%- endfor %}\n{%- if add_generation_prompt %}\n {{- '<|im_start|>assistant\\n' }}\n{%- endif %}\n",
199
- "clean_up_tokenization_spaces": false,
200
- "eos_token": "<|im_end|>",
201
- "errors": "replace",
202
- "model_max_length": 131072,
203
- "pad_token": "<|endoftext|>",
204
- "split_special_tokens": false,
205
- "tokenizer_class": "Qwen2Tokenizer",
206
- "unk_token": null
207
- }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
xfer/vocab.json.bin DELETED
The diff for this file is too large to render. See raw diff