Upload 2 files
Browse files- cn_data.py +13 -10
- train.jsonl +2 -2
cn_data.py
CHANGED
|
@@ -12,9 +12,9 @@ _CITATION = "TODO"
|
|
| 12 |
|
| 13 |
_FEATURES = datasets.Features(
|
| 14 |
{
|
| 15 |
-
"
|
| 16 |
-
"
|
| 17 |
-
"
|
| 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["
|
| 80 |
|
| 81 |
-
image_path = row["
|
| 82 |
-
|
| 83 |
image = open(image_path, "rb").read()
|
| 84 |
|
| 85 |
-
conditioning_image_path = row["
|
| 86 |
-
|
|
|
|
|
|
|
| 87 |
conditioning_image = open(conditioning_image_path, "rb").read()
|
| 88 |
|
| 89 |
-
yield row["
|
| 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:
|
| 3 |
-
size
|
|
|
|
| 1 |
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:8865f302c3ea99627c6858501df146c7180e7e34edec2ca982e64941346206d5
|
| 3 |
+
size 23796042
|