mirror of
https://github.com/comfyanonymous/ComfyUI.git
synced 2026-02-17 00:43:48 +08:00
17 lines
495 B
Python
17 lines
495 B
Python
import torch
|
|
import os
|
|
|
|
class PromptDataset(torch.utils.data.Dataset):
|
|
def __init__(self, calib_data_path="../data/calib_prompts.txt"):
|
|
if not os.path.exists(calib_data_path):
|
|
raise FileNotFoundError
|
|
with open(calib_data_path, "r", encoding="utf8") as file:
|
|
lst = [line.rstrip("\n") for line in file]
|
|
self.prompts = lst
|
|
|
|
def __len__(self):
|
|
return len(self.prompts)
|
|
|
|
def __getitem__(self, idx):
|
|
return self.prompts[idx]
|