MCPcopy Create free account
hub / github.com/ByteDance-Seed/Cola-DLM / __init__

Method __init__

tasks/customjson.py:11–28  ·  view source on GitHub ↗
(self, filepath, **kwargs)

Source from the content-addressed store, hash-verified

9
10class CustomJSON(Task):
11 def __init__(self, filepath, **kwargs):
12 super().__init__(**kwargs)
13 self.filepath = filepath
14 self.conversations = []
15
16 if not os.path.exists(filepath):
17 print(f"Warning: {filepath} not found")
18 else:
19 with open(filepath, "r", encoding="utf-8") as f:
20 for line in f:
21 line = line.strip()
22 if not line:
23 continue
24 messages = json.loads(line)
25 assert isinstance(messages, list) and len(messages) >= 2
26 self.conversations.append(messages)
27
28 self.length = len(self.conversations)
29
30 def num_examples(self):
31 return self.length

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected