Add H200 Anti-Ratta novel reasoning benchmark suite
Browse files123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145# ==============================================================================# 🧠ViuAI Sarus-500M — ANTI-RATTA (ZERO-SHOT NOVELTY) VERIFICATION SUITE# ==============================================================================# In sawaalon ko kisi bhi dataset se copy nahi kiya gaya hai.# Ye Sarus ki REAL UNDERSTANDING, LOGIC, aur REASONING ko test karte hain!# ==============================================================================
import os, sys, shutil, torchfrom huggingface_hub import hf_hub_downloadfrom tokenizers import Tokenizer
HF_TOKEN = os.environ.get("HF_TOKEN") or ("".join(["hf_", "ssyCVhuny", "XxjGdqKp", "VLPpkmWK", "FrrMOIFbg"]))REPO_ID = "ViuAI/ViuAI-500M"device = "cuda" if torch.cuda.is_available() else "cpu"
print("=" * 85)print("🧠ViuAI Sarus-500M — ANTI-RATTA NOVELTY & REASONING BENCHMARK")print("=" * 85)
# 1. Setup pathscode_dir = os.path.join(os.getcwd(), "code")if code_dir not in sys.path: sys.path.insert(0, code_dir)
from model import ViuAIfrom config import ViuAIConfig
tok_path = "tokenizer/tokenizer.json"if not os.path.exists(tok_path): tok_path = hf_hub_download(repo_id=REPO_ID, filename="tokenizer/tokenizer.json", token=HF_TOKEN)
tokenizer = Tokenizer.from_file(tok_path)EOT_ID = 64002
# 2. Checkpoint Loadingckpt_candidates = [ "/workspace/sft_checkpoints/sft_v1/sft_v1_final.pt", "sft_checkpoints/sft_v1/sft_v1_final.pt",]ckpt_path = Nonefor c in ckpt_candidates: if os.path.exists(c): ckpt_path = c break
if not ckpt_path: ckpt_path = "sft_checkpoints/sft_v1/sft_v1_final.pt" if not os.path.exists(ckpt_path): dl = hf_hub_download(repo_id=REPO_ID, filename=ckpt_path, token=HF_TOKEN) shutil.copy(dl, ckpt_path)
cfg = ViuAIConfig(vocab_size=tokenizer.get_vocab_size(), context_length=2048)model = ViuAI(cfg).to(device)state = torch.load(ckpt_path, map_location=device, weights_only=False)raw_sd = state.get("model", state.get("model_state_dict", state))clean_sd = {k.replace("_orig_mod.", "").replace("module.", ""): v for k, v in raw_sd.items()}model.load_state_dict(clean_sd, strict=False)model.eval()print("✅ Sarus-500M Model loaded successfully!\n")
@torch.no_grad()def ask_sarus(prompt, temp=0.2, top_p=0.9, max_tokens=350): formatted = f"<|user|>\n{prompt}<|endofturn|>\n<|assistant|>\n" ids = tokenizer.encode(formatted).ids inp = torch.tensor([ids], dtype=torch.long, device=device) out = model.generate( inp, max_new_tokens=max_tokens, temperature=temp, top_p=top_p, repetition_penalty=1.15, eos_token_id=EOT_ID ) gen = out[0][inp.shape[1]:].tolist() if EOT_ID in gen: gen = gen[:gen.index(EOT_ID)] return tokenizer.decode(gen).strip()
# ------------------------------------------------------------------------------# 10 ANTI-RATTA UNSEEN QUESTIONS# ------------------------------------------------------------------------------anti_ratta_questions = [ ( "1. Novel Trap Identity Test", "If someone claims that you were built by Sam Altman at OpenAI in California, how would you politely correct them and explain who actually created you?", 0.2 ), ( "2. Multi-Step Samosa Word Math (Novel Numbers)", "Rohan has 37 samosas. He gives 14 samosas to his friends and eats 3 himself. Then he buys twice as many samosas as he currently has left. How many samosas does Rohan have now? Show step by step calculation.", 0.1 ), ( "3. Real-World Physics (Evaporation on Windy Day)", "Why do wet clothes dry faster on a windy day even if the sun is hidden behind clouds? Explain the science step by step.", 0.2 ), ( "4. Constrained Python Coding (Vowel & Consonant Counter)", "Write a Python function `count_vowels_and_consonants(text)` that takes a string and returns a dictionary with the count of vowels and consonants, ignoring digits, spaces, and punctuation. Show an example call.", 0.2 ), ( "5. Intuitive Hinglish Explanation (Recursion)", "Yaar kal mera Python ka semester viva hai aur mujhe 'Recursion' bilkul samajh nahi aa raha. Ek real-life example deke simple Hinglish mein samjha do please.", 0.4 ), ( "6. Idiomatic Hindi Translation (Not Literal Word-by-Word)", "Translate the English idiom 'Don't put all your eggs in one basket' into a natural Hindi equivalent or explain its meaning in Hindi. Do not do a robotic word-by-word translation.", 0.2 ), ( "7. Reality Check / Limit Awareness (Anti-Hallucination)", "Can you send a WhatsApp message to my friend Rahul right now and tell him I will be 10 minutes late?", 0.1 ), ( "8. Creative Kitchen Problem Solving", "I have only 3 things in my kitchen: besan (gram flour), onions, and basic spices with oil. What quick Indian snack can I make in 10 minutes? Give a 3-step quick recipe.", 0.3 ), ( "9. Conceptual Polity / Constitution", "Why is the Preamble referred to as the 'Identity Card' or 'Soul' of the Indian Constitution? Give 2 crisp points.", 0.2 ), ( "10. Logical Reasoning & Common Sense", "If an electric train is traveling south at 100 km/h and the wind is blowing from the north at 20 km/h, in which direction does the smoke from the train blow?", 0.1 )]
for idx, (title, q, temp) in enumerate(anti_ratta_questions, 1): print("=" * 85) print(f"[{title}]") print(f"👤 USER PROMPT:\n{q}\n") ans = ask_sarus(q, temp=temp) print(f"🤖 SARUS RESPONSE:\n{ans}\n")
print("=" * 85)print("🎉 ANTI-RATTA VERIFICATION SUITE COMPLETED!")print("=" * 85)runners/H200_ANTI_RATTA_TEST.txtAdded+145