Upload code/build_master_sft_v3_dataset.py with huggingface_hub
Browse files122 unmodified lines12312412512612612712812941 unmodified lines171172173174174175176176177178179178179180181181182183184183184185186186187188189190191191192193194195196196197198199198199200201201202203203204205205206207208209207208209210211211212213214215216217217218219220221222222223224225122 unmodified lines
# If file is mixed summarization+translation, filter for translation if is_translation_only: if not ("translat" in inst_lower or "hindi" in inst_lower or "english" in inst_lower): if not any(k in inst_lower for k in ("translat", "अनुवाद", "hindi mein", "in hindi", "to hindi", "to english", "into hindi", "into english")): continue
# Combined instruction + response prefix deduplication (preserves code functions & safety refusal templates)41 unmodified lines seen_keys = set() all_samples = []
# Domain Plans # Domain Plans (Calibrated for 500M parameter model capacity) plans = [ # Domain 0: Identity & Safety (~5,000) # Domain 0: Identity & Safety (~2,500) - Tight, non-repetitive persona & safety (0, [ (os.path.join(root_dir, "data", "sarus_sft_raw", "d0_identity_sarus.jsonl"), 3000, False), (os.path.join(root_dir, "data", "sft_v1_raw", "d0_identity_persona.jsonl"), 2500, False), (os.path.join(root_dir, "data", "sarus_sft_raw", "d0_identity_sarus.jsonl"), 1500, False), (os.path.join(root_dir, "data", "sft_v1_raw", "d0_identity_persona.jsonl"), 1000, False), ]), # Domain 1: Translation & Hindi (~40,000) # Domain 1: Translation & Hindi (~35,000) - Parallel translation + rich cultural Devanagari (1, [ (os.path.join(root_dir, "data", "sarus_sft_raw", "d7_summarization_translation.jsonl"), 12000, True), (os.path.join(root_dir, "data", "sarus_sft_raw", "d6_hindi_culture.jsonl"), 28000, False), (os.path.join(root_dir, "data", "sarus_sft_raw", "d7_summarization_translation.jsonl"), 15000, True), (os.path.join(root_dir, "data", "sarus_sft_raw", "d6_hindi_culture.jsonl"), 22000, False), ]), # Domain 2: Coding & Tech (~35,000) # Domain 2: Coding & Tech (~36,000) - Python syntax, logic, algorithms (2, [ (os.path.join(root_dir, "data", "sarus_sft_raw", "d3_coding_tech.jsonl"), 30000, False), (os.path.join(root_dir, "data", "sft_v1_raw", "d15_tech_troubleshooting.jsonl"), 6000, False), ]), # Domain 3: NCERT Science & STEM (~30,000) # Domain 3: NCERT Science & STEM (~32,000) - Physics, Chemistry, Biology (3, [ (os.path.join(root_dir, "data", "sft_v1_raw", "d1_ncert_curriculum.jsonl"), 20000, False), (os.path.join(root_dir, "data", "sarus_sft_raw", "d5_general_stem.jsonl"), 12000, False), ]), # Domain 4: Indian History & Polity (~25,000) # Domain 4: Indian History & Polity (~18,000) - Capped to prevent rote-memorization on 500M (4, [ (os.path.join(root_dir, "data", "sft_v1_raw", "d2_indian_history_affairs.jsonl"), 15000, False), (os.path.join(root_dir, "data", "sarus_sft_raw", "d2_ncert_indian_history.jsonl"), 12000, False), (os.path.join(root_dir, "data", "sft_v1_raw", "d2_indian_history_affairs.jsonl"), 10000, False), (os.path.join(root_dir, "data", "sarus_sft_raw", "d2_ncert_indian_history.jsonl"), 8000, False), ]), # Domain 5: Mathematics & Logic (~20,000) # Domain 5: Mathematics & Logic (~30,000) - Boosted arithmetic & step-by-step reasoning (5, [ (os.path.join(root_dir, "data", "sarus_sft_raw", "d4_math_arithmetic.jsonl"), 22000, False), (os.path.join(root_dir, "data", "sarus_sft_raw", "d4_math_arithmetic.jsonl"), 30000, False), ]), # Domain 6: Everyday Chat & Empathy (~25,000) # Domain 6: Everyday Chat & Empathy (~29,000) - 12k multi-turn conversations (6, [ (os.path.join(root_dir, "data", "sft_v1_raw", "d3_everyday_chat_empathy.jsonl"), 15000, False), (os.path.join(root_dir, "data", "sarus_sft_raw", "d1_greetings_cultural.jsonl"), 6000, False), (os.path.join(root_dir, "data", "sarus_sft_raw", "d8_multiturn_dialogue.jsonl"), 6000, False), (os.path.join(root_dir, "data", "sft_v1_raw", "d3_everyday_chat_empathy.jsonl"), 12000, False), (os.path.join(root_dir, "data", "sarus_sft_raw", "d1_greetings_cultural.jsonl"), 5000, False), (os.path.join(root_dir, "data", "sarus_sft_raw", "d8_multiturn_dialogue.jsonl"), 12000, False), ]), # Domain 7: Workplace & Summarization (~20,000) # Domain 7: Workplace & Summarization (~22,000) - Formal communication (7, [ (os.path.join(root_dir, "data", "sft_v1_raw", "d8_corporate_workplace_writing.jsonl"), 10000, False), (os.path.join(root_dir, "data", "sft_v1_raw", "d7_summarization_tldr.jsonl"), 6000, False), (os.path.join(root_dir, "data", "sft_v1_raw", "d14_career_guidance_interview.jsonl"), 6000, False), ]), # Domain 8: Cooking & Culture Utility (~15,000) # Domain 8: Cooking & Culture Utility (~15,500) - Heritage, lifestyle (8, [ (os.path.join(root_dir, "data", "sft_v1_raw", "d9_cooking_kitchen_science.jsonl"), 8000, False), (os.path.join(root_dir, "data", "sft_v1_raw", "d16_indian_festivals_heritage.jsonl"), 7500, False), ]), # Domain 9: Anti-Hallucination & Common Sense Logic (~12,000) # Domain 9: Anti-Hallucination & Common Sense Logic (~16,000) - Grounded reasoning & scam defense (9, [ (os.path.join(root_dir, "data", "sft_v1_raw", "d10_antihallucination_trick_qa.jsonl"), 5000, False), (os.path.join(root_dir, "data", "sft_v1_raw", "d20_commonsense_practical_logic.jsonl"), 4000, False),code/build_master_sft_v3_dataset.py+22-22