MCPcopy Create free account
hub / github.com/NVlabs/DiffusionNFT / GenevalPromptDataset

Class GenevalPromptDataset

scripts/evaluation.py:73–86  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

71
72
73class GenevalPromptDataset(Dataset):
74 def __init__(self, dataset_path, split="test"):
75 self.file_path = os.path.join(dataset_path, f"{split}_metadata.jsonl")
76 if not os.path.exists(self.file_path):
77 raise FileNotFoundError(f"Dataset file not found at {self.file_path}")
78 with open(self.file_path, "r", encoding="utf-8") as f:
79 self.metadatas = [json.loads(line) for line in f]
80 self.prompts = [item["prompt"] for item in self.metadatas]
81
82 def __len__(self):
83 return len(self.prompts)
84
85 def __getitem__(self, idx):
86 return {"prompt": self.prompts[idx], "metadata": self.metadatas[idx], "original_index": idx}
87
88
89def collate_fn(examples):

Callers 1

mainFunction · 0.70

Calls

no outgoing calls

Tested by

no test coverage detected