ViuAI commited on
Commit
ec49fc1
Β·
verified Β·
1 Parent(s): 060f0f6

Upload runners/KAGGLE_BUILD_SARUS_SFT_V2_DATASET.txt with huggingface_hub

Browse files
runners/KAGGLE_BUILD_SARUS_SFT_V2_DATASET.txt CHANGED
@@ -1,85 +1,26 @@
1
  # ==============================================================================
2
- # πŸš€ ViuAI Sarus-500M β€” STEP 1: Kaggle SFT v2 Pure Chat Dataset Builder & Tokenizer
3
  # ==============================================================================
4
- # Run this entire block in a single Kaggle Notebook cell (CPU or GPU)
5
- #
6
- # What it does:
7
- # 1. Sets up dependencies (tokenizers, datasets, huggingface_hub).
8
- # 2. Downloads build_sft_v2_chat_dataset.py from ViuAI/ViuAI-500M.
9
- # 3. Builds ~200,000 Pure Chat & Assistant samples across 8 domains:
10
- # β€’ D0: Identity & Persona (Sarus / ViuAI)
11
- # β€’ D1: Bilingual Greetings & Openers
12
- # β€’ D2: Everyday Conversational Dialogue (Multi-Turn)
13
- # β€’ D3: General Knowledge & Science (English)
14
- # β€’ D4: Hindi Factual QA & Knowledge (Breaks Greeting Loop)
15
- # β€’ D5: Practical Writing & Everyday Tasks (Emails, Summaries)
16
- # β€’ D6: Culture, Recipes (Masala Chai) & Lifestyle Tips
17
- # β€’ D7: Bilingual Translation (EN <-> HI)
18
- # (0% Math, 0% Coding β€” Pure Conversational Focus)
19
- # 4. Tokenizes directly into memory-mapped NumPy shards.
20
- # 5. Auto-uploads to Hugging Face:
21
- # β€’ Raw JSONL: ViuAI/sarus-sft-data-raw (folder: sft_v2_chat)
22
- # β€’ Tokenized .npy: ViuAI/viuai-500m-sft-tokenized (folder: sft_v2)
23
  # ==============================================================================
24
 
25
- import os, sys, shutil, subprocess
 
26
 
27
- # 1. Install & Configure Environment
28
- subprocess.run([sys.executable, "-m", "pip", "install", "-q", "tokenizers", "datasets", "huggingface_hub", "numpy"], check=True)
29
-
30
- from huggingface_hub import HfApi, hf_hub_download
31
 
32
  HF_TOKEN = os.environ.get("HF_TOKEN") or ("".join(["hf_", "ssyCVhuny", "XxjGdqKp", "VLPpkmWK", "FrrMOIFbg"]))
 
33
  REPO_ID = "ViuAI/ViuAI-500M"
34
 
35
- print("=" * 85)
36
- print("πŸš€ ViuAI Sarus-500M β€” SFT v2 Pure Chat Dataset Builder")
37
- print(" β€’ Target: ~200,000 High-Purity Conversational Samples across 8 Domains")
38
- print(" β€’ Repositories:")
39
- print(" - Model Hub: ViuAI/ViuAI-500M")
40
- print(" - Raw Corpus: ViuAI/sarus-sft-data-raw [sft_v2_chat]")
41
- print(" - Tokenized Shards: ViuAI/viuai-500m-sft-tokenized [sft_v2]")
42
- print("=" * 85)
43
-
44
- # 2. Sync Required Scripts & Data Assets
45
  os.makedirs("code", exist_ok=True)
46
- os.makedirs("data", exist_ok=True)
47
- os.makedirs("tokenizer", exist_ok=True)
48
-
49
- files_to_sync = [
50
- ("code/build_sft_v2_chat_dataset.py", "code/build_sft_v2_chat_dataset.py"),
51
- ("tokenizer/tokenizer.json", "tokenizer/tokenizer.json"),
52
- ("data/sft_identity.json", "data/sft_identity.json"),
53
- ("data/sft_greetings.json", "data/sft_greetings.json")
54
- ]
55
-
56
- for src, dst in files_to_sync:
57
- try:
58
- p = hf_hub_download(repo_id=REPO_ID, filename=src, token=HF_TOKEN)
59
- shutil.copy(p, dst)
60
- print(f"βœ… Synced: {dst}")
61
- except Exception as e:
62
- print(f"⚠️ Notice: {src} ({e})")
63
-
64
- # 3. Execute Builder with Direct Tokenization and Hugging Face Upload
65
- print("\n" + "=" * 85)
66
- print("⚑ Starting Dual-Phase Dataset Generation (Raw Extraction + Shard Tokenization)...")
67
- print("=" * 85)
68
-
69
- cmd = [
70
- sys.executable,
71
- "code/build_sft_v2_chat_dataset.py",
72
- "--phase", "all",
73
- "--upload_hf"
74
- ]
75
-
76
- env = os.environ.copy()
77
- env["HF_TOKEN"] = HF_TOKEN
78
- subprocess.run(cmd, env=env, check=True)
79
 
80
- print("\n" + "=" * 85)
81
- print("πŸŽ‰ SFT v2 PURE CHAT DATASET SUCCESSFULLY BUILT & UPLOADED TO HUGGING FACE!")
82
- print(" β€’ Raw Repo: https://huggingface.co/datasets/ViuAI/sarus-sft-data-raw")
83
- print(" β€’ Tokenized Repo: https://huggingface.co/datasets/ViuAI/viuai-500m-sft-tokenized (sft_v2)")
84
- print(" β€’ Ready for H200 / Cloud GPU SFT v2 Training!")
85
- print("=" * 85)
 
1
  # ==============================================================================
2
+ # πŸš€ ViuAI Sarus-500M β€” SFT v2 Pure Chat Dataset Builder (Kaggle 1-Click)
3
  # ==============================================================================
4
+ # Run this entire block in a single Kaggle Notebook cell.
5
+ # It streams and builds ~200,000 pure conversational samples (0% math, 0% code)
6
+ # and uploads directly to Hugging Face!
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
7
  # ==============================================================================
8
 
9
+ # 1. Install required packages
10
+ !pip install -q tokenizers datasets huggingface_hub numpy
11
 
12
+ # 2. Fetch the builder script from Hugging Face
13
+ import os, shutil
14
+ from huggingface_hub import hf_hub_download
 
15
 
16
  HF_TOKEN = os.environ.get("HF_TOKEN") or ("".join(["hf_", "ssyCVhuny", "XxjGdqKp", "VLPpkmWK", "FrrMOIFbg"]))
17
+ os.environ["HF_TOKEN"] = HF_TOKEN
18
  REPO_ID = "ViuAI/ViuAI-500M"
19
 
 
 
 
 
 
 
 
 
 
 
20
  os.makedirs("code", exist_ok=True)
21
+ p = hf_hub_download(repo_id=REPO_ID, filename="code/build_sft_v2_chat_dataset.py", token=HF_TOKEN, force_download=True)
22
+ shutil.copy(p, "code/build_sft_v2_chat_dataset.py")
23
+ print("βœ… build_sft_v2_chat_dataset.py ready!")
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
24
 
25
+ # 3. Launch Builder with LIVE Real-Time Terminal Output (-u unbuffered)
26
+ !python -u code/build_sft_v2_chat_dataset.py --phase all --upload_hf