• About Us
  • Disclaimer
  • Contact Us
  • Privacy Policy
Monday, August 3, 2026
mGrowTech
No Result
View All Result
  • Technology And Software
    • Account Based Marketing
    • Channel Marketing
    • Marketing Automation
      • Al, Analytics and Automation
      • Ad Management
  • Digital Marketing
    • Social Media Management
    • Google Marketing
  • Direct Marketing
    • Brand Management
    • Marketing Attribution and Consulting
  • Mobile Marketing
  • Event Management
  • PR Solutions
  • Technology And Software
    • Account Based Marketing
    • Channel Marketing
    • Marketing Automation
      • Al, Analytics and Automation
      • Ad Management
  • Digital Marketing
    • Social Media Management
    • Google Marketing
  • Direct Marketing
    • Brand Management
    • Marketing Attribution and Consulting
  • Mobile Marketing
  • Event Management
  • PR Solutions
No Result
View All Result
mGrowTech
No Result
View All Result
Home Al, Analytics and Automation

A Coding Implementation to Explore and Analyze the TaskTrove Dataset with Streaming Parsing Visualization and Verifier Detection

Josh by Josh
May 4, 2026
in Al, Analytics and Automation
0
A Coding Implementation to Explore and Analyze the TaskTrove Dataset with Streaming Parsing Visualization and Verifier Detection


filename_counter: Counter = Counter()
all_json_keys:    Counter = Counter()
samples_for_show: List = []


for i, row in enumerate(tqdm(ds_test, desc="inspecting structure", total=200)):
   if i >= 200:
       break
   p = parse_task(row["task_binary"])
   if p["format"] in ("tar", "zip"):
       for name, body in p["files"].items():
           filename_counter[name] += 1
           if name.endswith(".json") and isinstance(body, str):
               try:
                   obj = json.loads(body)
                   if isinstance(obj, dict):
                       for k in obj.keys():
                           all_json_keys[k] += 1
               except Exception:
                   pass
       if len(samples_for_show) < 2:
           samples_for_show.append((row["path"], p))


print("\nMost common filenames inside task archives:")
for name, n in filename_counter.most_common(15):
   print(f"  {n:>4}  {name}")


print("\nMost common top-level JSON keys (across any *.json):")
for k, n in all_json_keys.most_common(20):
   print(f"  {n:>4}  {k}")


if samples_for_show:
   print(f"\nFull file listing for one sample task ({samples_for_show[0][0]}):")
   for name, body in samples_for_show[0][1]["files"].items():
       sz = len(body) if isinstance(body, (str, bytes)) else 0
       print(f"  {name}  ({sz:,} B)")




VERIFIER_FILE_PATTERNS = ("verifier", "verify", "grader", "judge", "score", "eval")
VERIFIER_JSON_KEYS     = ("verifier", "verifier_config", "judge", "grader",
                         "rubric", "test_patch", "FAIL_TO_PASS", "tests")




def has_verifier(parsed: Dict[str, Any]) -> bool:
   """Detect verifiers via filename, JSON content, or both."""
   if parsed["format"] not in ("tar", "zip"):
       c = parsed.get("content")
       if isinstance(c, dict):
           return any(k in c for k in VERIFIER_JSON_KEYS)
       return False


   files = parsed["files"]


   for name in files:
       low = name.lower()
       if any(pat in low for pat in VERIFIER_FILE_PATTERNS):
           return True


   for name, body in files.items():
       if name.endswith((".json", ".yaml", ".yml")) and isinstance(body, str):
           try:
               obj = json.loads(body)
               if isinstance(obj, dict) and any(k in obj for k in VERIFIER_JSON_KEYS):
                   return True
           except Exception:
               pass
           low = body.lower()
           if "verifier" in low or "test_patch" in low:
               return True


   return False




class TaskTroveExplorer:
   """High-level interface to the open-thoughts/TaskTrove dataset."""


   def __init__(self, split: str = "test", dataset_id: str = DATASET_ID):
       self.dataset_id = dataset_id
       self.split = split
       self._ds = load_dataset(dataset_id, split=split, streaming=True)


   def iter(self, limit: Optional[int] = None,
            source_filter: Optional[str] = None) -> Iterator[Dict[str, Any]]:
       rx = re.compile(source_filter) if source_filter else None
       n = 0
       for row in self._ds:
           if rx and not rx.search(source_of(row["path"])):
               continue
           yield row
           n += 1
           if limit is not None and n >= limit:
               return


   def sample(self, n: int = 5,
              source_filter: Optional[str] = None) -> List[Dict[str, Any]]:
       out = []
       for row in self.iter(limit=n, source_filter=source_filter):
           parsed = parse_task(row["task_binary"])
           parsed["path"] = row["path"]
           parsed["source"] = source_of(row["path"])
           out.append(parsed)
       return out


   def summary(self, limit: int = 1000,
               source_filter: Optional[str] = None) -> pd.DataFrame:
       rows = []
       for row in self.iter(limit=limit, source_filter=source_filter):
           parsed = parse_task(row["task_binary"])
           rows.append({
               "source": source_of(row["path"]),
               "compressed": parsed["compressed_size"],
               "raw": parsed["raw_size"],
               "format": parsed["format"],
               "n_files": len(parsed.get("files", {})),
               "has_verifier": has_verifier(parsed),
           })
       df = pd.DataFrame(rows)
       if df.empty:
           return df
       return (df.groupby("source")
                 .agg(n=("compressed", "count"),
                      mean_compressed_kb=("compressed", lambda s: s.mean()/1024),
                      mean_raw_kb=("raw",                lambda s: s.mean()/1024),
                      mean_n_files=("n_files", "mean"),
                      verifier_rate=("has_verifier", "mean"))
                 .round(2)
                 .sort_values("n", ascending=False))


   @staticmethod
   def has_verifier(parsed: Dict[str, Any]) -> bool:
       return has_verifier(parsed)


   def export(self, output_dir: Union[str, Path], n: int = 10,
              source_filter: Optional[str] = None) -> Path:
       output_dir = Path(output_dir)
       output_dir.mkdir(parents=True, exist_ok=True)
       for parsed in self.sample(n=n, source_filter=source_filter):
           slug = parsed["path"].replace("/", "_")
           tdir = output_dir / slug
           tdir.mkdir(exist_ok=True)
           if parsed["format"] in ("tar", "zip"):
               for name, body in parsed["files"].items():
                   out = tdir / name
                   out.parent.mkdir(parents=True, exist_ok=True)
                   if isinstance(body, str):
                       out.write_text(body, encoding="utf-8")
                   else:
                       out.write_bytes(body)
           else:
               content = parsed.get("content", b"")
               if isinstance(content, (dict, list)):
                   (tdir / "task.json").write_text(json.dumps(content, indent=2))
               elif isinstance(content, str):
                   (tdir / "task.txt").write_text(content)
               else:
                   (tdir / "task.bin").write_bytes(content)
       print(f"✓ exported tasks to {output_dir.resolve()}")
       return output_dir




explorer = TaskTroveExplorer(split="test")


print("\nSample of 3 parsed tasks:")
for s in explorer.sample(n=3):
   print(f"path: {s['path']} | source: {s['source']} | format: {s['format']} | "
         f"files: {len(s.get('files', {}))} | verifier: {has_verifier(s)}")



Source_link

READ ALSO

Google Pulls Earth’s AI Image Tool a Day After Launch – Unite.AI

NVIDIA AI Releases Molt: A PyTorch-Native Agentic Reinforcement Learning Framework

Related Posts

Google Pulls Earth’s AI Image Tool a Day After Launch – Unite.AI
Al, Analytics and Automation

Google Pulls Earth’s AI Image Tool a Day After Launch – Unite.AI

August 3, 2026
NVIDIA AI Releases Molt: A PyTorch-Native Agentic Reinforcement Learning Framework
Al, Analytics and Automation

NVIDIA AI Releases Molt: A PyTorch-Native Agentic Reinforcement Learning Framework

August 2, 2026
Agentic AI Security: Defending Against Prompt Injection and Tool Misuse
Al, Analytics and Automation

Agentic AI Security: Defending Against Prompt Injection and Tool Misuse

August 2, 2026
The Labs Just Proved Your Agent’s Sandbox Is Only a Suggestion – Unite.AI
Al, Analytics and Automation

The Labs Just Proved Your Agent’s Sandbox Is Only a Suggestion – Unite.AI

August 2, 2026
AMD Releases Instella-MoE-16B-A3B: A Fully Open Mixture-of-Experts LLM With 2.8B Active Parameters Trained On Instinct GPUs
Al, Analytics and Automation

AMD Releases Instella-MoE-16B-A3B: A Fully Open Mixture-of-Experts LLM With 2.8B Active Parameters Trained On Instinct GPUs

August 2, 2026
Building Agentic Workflows in Python with LangGraph
Al, Analytics and Automation

Building Agentic Workflows in Python with LangGraph

August 2, 2026
Next Post
xAI launches Grok 4.3 at an aggressively low price and a new, fast, powerful voice cloning suite

xAI launches Grok 4.3 at an aggressively low price and a new, fast, powerful voice cloning suite

POPULAR NEWS

Trump ends trade talks with Canada over a digital services tax

Trump ends trade talks with Canada over a digital services tax

June 28, 2025
15 Trending Songs on TikTok in 2025 (+ How to Use Them)

15 Trending Songs on TikTok in 2025 (+ How to Use Them)

June 18, 2025
Communication Effectiveness Skills For Business Leaders

Communication Effectiveness Skills For Business Leaders

June 10, 2025
Comparing the Top 7 Large Language Models LLMs/Systems for Coding in 2025

Comparing the Top 7 Large Language Models LLMs/Systems for Coding in 2025

November 4, 2025
App Development Cost in Singapore: Pricing Breakdown & Insights

App Development Cost in Singapore: Pricing Breakdown & Insights

June 22, 2025

EDITOR'S PICK

What Does It Really Take To Lead AI Transformation In Marketing in 2026?

What Does It Really Take To Lead AI Transformation In Marketing in 2026?

November 23, 2025
This Upgraded SteelSeries Gaming Headset Is $80 Off

This Upgraded SteelSeries Gaming Headset Is $80 Off

October 24, 2025
Building AI Agents in Python with Pydantic AI

Building AI Agents in Python with Pydantic AI

May 20, 2026
5 Best AI App Builder Platforms I Recommend in 2026

5 Best AI App Builder Platforms I Recommend in 2026

July 26, 2026

About

We bring you the best Premium WordPress Themes that perfect for news, magazine, personal blog, etc. Check our landing page for details.

Follow us

Categories

  • Account Based Marketing
  • Ad Management
  • Al, Analytics and Automation
  • Brand Management
  • Channel Marketing
  • Digital Marketing
  • Direct Marketing
  • Event Management
  • Google Marketing
  • Marketing Attribution and Consulting
  • Marketing Automation
  • Mobile Marketing
  • PR Solutions
  • Social Media Management
  • Technology And Software
  • Uncategorized

Recent Posts

  • Best 5 Agentic Container Security Platforms in 2026
  • What 2000+ G2 Users Say
  • ‘A responsibility to act’: One nonprofit’s response to drastic federal budget cuts
  • Historic Crowds and Rising DUI Crashes During America’s 250th Celebration
  • About Us
  • Disclaimer
  • Contact Us
  • Privacy Policy
No Result
View All Result
  • Technology And Software
    • Account Based Marketing
    • Channel Marketing
    • Marketing Automation
      • Al, Analytics and Automation
      • Ad Management
  • Digital Marketing
    • Social Media Management
    • Google Marketing
  • Direct Marketing
    • Brand Management
    • Marketing Attribution and Consulting
  • Mobile Marketing
  • Event Management
  • PR Solutions