kmaksatk commited on
Commit
94ba46c
·
1 Parent(s): d116248

Upload 2 files

Browse files
Files changed (2) hide show
  1. cn_data.py +13 -10
  2. train.jsonl +2 -2
cn_data.py CHANGED
@@ -12,9 +12,9 @@ _CITATION = "TODO"
12
 
13
  _FEATURES = datasets.Features(
14
  {
15
- "target": datasets.Image(),
16
- "source": datasets.Image(),
17
- "caption": datasets.Value("string"),
18
  },
19
  )
20
 
@@ -76,17 +76,19 @@ class Fill50k(datasets.GeneratorBasedBuilder):
76
  metadata = pd.read_json(metadata_path, lines=True)
77
 
78
  for _, row in metadata.iterrows():
79
- text = row["caption"]
80
 
81
- image_path = row["target"]
82
- # image_path = os.path.join(images_dir, image_path)
83
  image = open(image_path, "rb").read()
84
 
85
- conditioning_image_path = row["source"]
86
- # conditioning_image_path = os.path.join(conditioning_images_dir, row["source"])
 
 
87
  conditioning_image = open(conditioning_image_path, "rb").read()
88
 
89
- yield row["target"], {
90
  "text": text,
91
  "image": {
92
  "path": image_path,
@@ -96,4 +98,5 @@ class Fill50k(datasets.GeneratorBasedBuilder):
96
  "path": conditioning_image_path,
97
  "bytes": conditioning_image,
98
  },
99
- }
 
 
12
 
13
  _FEATURES = datasets.Features(
14
  {
15
+ "image": datasets.Image(),
16
+ "conditioning_image": datasets.Image(),
17
+ "text": datasets.Value("string"),
18
  },
19
  )
20
 
 
76
  metadata = pd.read_json(metadata_path, lines=True)
77
 
78
  for _, row in metadata.iterrows():
79
+ text = row["text"]
80
 
81
+ image_path = row["image"]
82
+ image_path = os.path.join(images_dir, image_path)
83
  image = open(image_path, "rb").read()
84
 
85
+ conditioning_image_path = row["conditioning_image"]
86
+ conditioning_image_path = os.path.join(
87
+ conditioning_images_dir, row["conditioning_image"]
88
+ )
89
  conditioning_image = open(conditioning_image_path, "rb").read()
90
 
91
+ yield row["image"], {
92
  "text": text,
93
  "image": {
94
  "path": image_path,
 
98
  "path": conditioning_image_path,
99
  "bytes": conditioning_image,
100
  },
101
+ }
102
+
train.jsonl CHANGED
@@ -1,3 +1,3 @@
1
  version https://git-lfs.github.com/spec/v1
2
- oid sha256:d2db67e9261d7ea5eec2095ea24484f6e0111519dc176fa9e20145df98ce4f27
3
- size 23143858
 
1
  version https://git-lfs.github.com/spec/v1
2
+ oid sha256:8865f302c3ea99627c6858501df146c7180e7e34edec2ca982e64941346206d5
3
+ size 23796042