xiaohk commited on
Commit
712834a
1 Parent(s): 16d8c4e

Fix text_only key error

Browse files
Files changed (1) hide show
  1. diffusiondb.py +14 -1
diffusiondb.py CHANGED
@@ -52,6 +52,18 @@ _URLS["metadata"] = hf_hub_url(
52
  "datasets/poloclub/diffusiondb", filename=f"metadata.parquet"
53
  )
54
 
 
 
 
 
 
 
 
 
 
 
 
 
55
 
56
  class DiffusionDBConfig(datasets.BuilderConfig):
57
  """BuilderConfig for DiffusionDB."""
@@ -220,7 +232,7 @@ class DiffusionDB(datasets.GeneratorBasedBuilder):
220
  "seed": row["seed"],
221
  "step": row["step"],
222
  "cfg": row["cfg"],
223
- "sampler": row["sampler"],
224
  }
225
 
226
  else:
@@ -231,6 +243,7 @@ class DiffusionDB(datasets.GeneratorBasedBuilder):
231
  for k in range(num_data_dirs):
232
  cur_data_dir = data_dirs[k]
233
  cur_json_path = json_paths[k]
 
234
  json_data = load(open(cur_json_path, "r", encoding="utf8"))
235
 
236
  for img_name in json_data:
 
52
  "datasets/poloclub/diffusiondb", filename=f"metadata.parquet"
53
  )
54
 
55
+ _SAMPLER_DICT = {
56
+ 1: "ddim",
57
+ 2: "plms",
58
+ 3: "k_euler",
59
+ 4: "k_euler_ancestral",
60
+ 5: "ddik_heunm",
61
+ 6: "k_dpm_2",
62
+ 7: "k_dpm_2_ancestral",
63
+ 8: "k_lms",
64
+ 9: "others",
65
+ }
66
+
67
 
68
  class DiffusionDBConfig(datasets.BuilderConfig):
69
  """BuilderConfig for DiffusionDB."""
 
232
  "seed": row["seed"],
233
  "step": row["step"],
234
  "cfg": row["cfg"],
235
+ "sampler": _SAMPLER_DICT[int(row["sampler"])],
236
  }
237
 
238
  else:
 
243
  for k in range(num_data_dirs):
244
  cur_data_dir = data_dirs[k]
245
  cur_json_path = json_paths[k]
246
+
247
  json_data = load(open(cur_json_path, "r", encoding="utf8"))
248
 
249
  for img_name in json_data: