Switch dataset model to Qwen-Image + add 54-image training set (LFS)
Browse filesscripts/generate_dataset.py:
- Use Qwen/Qwen-Image (fal-ai provider) — beat FLUX.1-dev on multi-animal
accuracy in side-by-side tests; FLUX.2-dev is edit-only so unusable for t2i
- Add a 4-attempt retry loop for transient fal-ai 504 timeouts
- Drop the --provider flag (single model now)
training/:
- 54 generated images + caption .txt files, tracked via Git LFS
- All 12 app animals solo, all 10 places, plus 2–3 animal and 2–3 place combos
- Captions share the app's exact build_subject prefix + NUMZOO_STYLE suffix
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
This view is limited to 50 files because it contains too many changes. See raw diff
- .gitattributes +1 -0
- scripts/generate_dataset.py +33 -30
- training/image_001.jpg +3 -0
- training/image_001.txt +1 -0
- training/image_002.jpg +3 -0
- training/image_002.txt +1 -0
- training/image_003.jpg +3 -0
- training/image_003.txt +1 -0
- training/image_004.jpg +3 -0
- training/image_004.txt +1 -0
- training/image_005.jpg +3 -0
- training/image_005.txt +1 -0
- training/image_006.jpg +3 -0
- training/image_006.txt +1 -0
- training/image_007.jpg +3 -0
- training/image_007.txt +1 -0
- training/image_008.jpg +3 -0
- training/image_008.txt +1 -0
- training/image_009.jpg +3 -0
- training/image_009.txt +1 -0
- training/image_010.jpg +3 -0
- training/image_010.txt +1 -0
- training/image_011.jpg +3 -0
- training/image_011.txt +1 -0
- training/image_012.jpg +3 -0
- training/image_012.txt +1 -0
- training/image_013.jpg +3 -0
- training/image_013.txt +1 -0
- training/image_014.jpg +3 -0
- training/image_014.txt +1 -0
- training/image_015.jpg +3 -0
- training/image_015.txt +1 -0
- training/image_016.jpg +3 -0
- training/image_016.txt +1 -0
- training/image_017.jpg +3 -0
- training/image_017.txt +1 -0
- training/image_018.jpg +3 -0
- training/image_018.txt +1 -0
- training/image_019.jpg +3 -0
- training/image_019.txt +1 -0
- training/image_020.jpg +3 -0
- training/image_020.txt +1 -0
- training/image_021.jpg +3 -0
- training/image_021.txt +1 -0
- training/image_022.jpg +3 -0
- training/image_022.txt +1 -0
- training/image_023.jpg +3 -0
- training/image_023.txt +1 -0
- training/image_024.jpg +3 -0
- training/image_024.txt +1 -0
.gitattributes
ADDED
|
@@ -0,0 +1 @@
|
|
|
|
|
|
|
| 1 |
+
training/*.jpg filter=lfs diff=lfs merge=lfs -text
|
scripts/generate_dataset.py
CHANGED
|
@@ -1,8 +1,9 @@
|
|
| 1 |
"""
|
| 2 |
NumZoo training dataset generator.
|
| 3 |
|
| 4 |
-
Generates LoRA training images matching the NumZoo aesthetic using
|
| 5 |
via the HuggingFace Inference API (fal-ai provider, billed to your HF Pro credits).
|
|
|
|
| 6 |
|
| 7 |
Alignment with the live app is guaranteed by construction:
|
| 8 |
- The "A cute {animals} {places}" prefix is built with image_generator.build_subject
|
|
@@ -18,10 +19,9 @@ Requirements:
|
|
| 18 |
~/miniforge3/bin/pip install huggingface_hub pillow python-dotenv
|
| 19 |
|
| 20 |
Setup (HF Pro — just your existing token):
|
| 21 |
-
1.
|
| 22 |
-
|
| 23 |
-
|
| 24 |
-
3. Add to .env: HF_TOKEN=hf_...
|
| 25 |
|
| 26 |
Usage:
|
| 27 |
~/miniforge3/bin/python3 scripts/generate_dataset.py # all scenes
|
|
@@ -141,40 +141,43 @@ PROMPTS: list[tuple[str, str]] = [
|
|
| 141 |
]
|
| 142 |
|
| 143 |
# ---------------------------------------------------------------------------
|
| 144 |
-
# Generator using
|
| 145 |
# ---------------------------------------------------------------------------
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 146 |
|
| 147 |
-
|
| 148 |
-
|
| 149 |
-
|
| 150 |
-
PROVIDERS = {
|
| 151 |
-
"fal-ai": "black-forest-labs/FLUX.2-dev",
|
| 152 |
-
"hf-inference": "black-forest-labs/FLUX.1-schnell",
|
| 153 |
-
}
|
| 154 |
|
| 155 |
-
|
|
|
|
| 156 |
from huggingface_hub import InferenceClient
|
| 157 |
|
| 158 |
-
# HF Pro token
|
|
|
|
| 159 |
hf_token = os.environ.get("HF_TOKEN")
|
| 160 |
-
|
| 161 |
-
|
| 162 |
-
|
| 163 |
-
|
| 164 |
-
|
| 165 |
-
|
| 166 |
-
|
| 167 |
-
|
| 168 |
-
|
| 169 |
-
|
|
|
|
| 170 |
|
| 171 |
|
| 172 |
def main():
|
| 173 |
parser = argparse.ArgumentParser()
|
| 174 |
-
parser.add_argument("--start", type=int, default=1,
|
| 175 |
-
parser.add_argument("--count", type=int, default=None,
|
| 176 |
-
parser.add_argument("--
|
| 177 |
-
parser.add_argument("--dry-run", action="store_true", help="Print prompts without generating")
|
| 178 |
args = parser.parse_args()
|
| 179 |
|
| 180 |
if not args.dry_run:
|
|
@@ -217,7 +220,7 @@ def main():
|
|
| 217 |
continue
|
| 218 |
|
| 219 |
try:
|
| 220 |
-
image = generate_image(prompt
|
| 221 |
image.save(img_path, "JPEG", quality=95)
|
| 222 |
txt_path.write_text(prompt)
|
| 223 |
generated_this_run += 1
|
|
|
|
| 1 |
"""
|
| 2 |
NumZoo training dataset generator.
|
| 3 |
|
| 4 |
+
Generates LoRA training images matching the NumZoo aesthetic using Qwen-Image
|
| 5 |
via the HuggingFace Inference API (fal-ai provider, billed to your HF Pro credits).
|
| 6 |
+
(Qwen-Image beat FLUX.1-dev on multi-animal accuracy; FLUX.2-dev is edit-only.)
|
| 7 |
|
| 8 |
Alignment with the live app is guaranteed by construction:
|
| 9 |
- The "A cute {animals} {places}" prefix is built with image_generator.build_subject
|
|
|
|
| 19 |
~/miniforge3/bin/pip install huggingface_hub pillow python-dotenv
|
| 20 |
|
| 21 |
Setup (HF Pro — just your existing token):
|
| 22 |
+
1. Get an HF token (fine-grained, "Make calls to Inference Providers" permission)
|
| 23 |
+
https://huggingface.co/settings/tokens/new?ownUserPermissions=inference.serverless.write&tokenType=fineGrained
|
| 24 |
+
2. Add to .env: HF_TOKEN=hf_...
|
|
|
|
| 25 |
|
| 26 |
Usage:
|
| 27 |
~/miniforge3/bin/python3 scripts/generate_dataset.py # all scenes
|
|
|
|
| 141 |
]
|
| 142 |
|
| 143 |
# ---------------------------------------------------------------------------
|
| 144 |
+
# Generator using Qwen-Image via HuggingFace Inference API (fal-ai provider)
|
| 145 |
# ---------------------------------------------------------------------------
|
| 146 |
+
# Qwen-Image chosen over FLUX.1-dev: far better at rendering DISTINCT animals in
|
| 147 |
+
# multi-animal scenes (critical — the app lets players pick up to 3), and a
|
| 148 |
+
# softer painterly storybook style closer to the NumZoo references.
|
| 149 |
+
# Note: FLUX.2-dev is edit-only (image-to-image) on every HF provider, so it
|
| 150 |
+
# cannot be used for text-to-image dataset generation.
|
| 151 |
|
| 152 |
+
MODEL = "Qwen/Qwen-Image"
|
| 153 |
+
PROVIDER = "fal-ai"
|
| 154 |
+
RETRIES = 4 # fal-ai occasionally returns transient 504s
|
|
|
|
|
|
|
|
|
|
|
|
|
| 155 |
|
| 156 |
+
|
| 157 |
+
def generate_image(prompt: str) -> "PIL.Image.Image":
|
| 158 |
from huggingface_hub import InferenceClient
|
| 159 |
|
| 160 |
+
# HF Pro token (with "Make calls to Inference Providers" permission) covers
|
| 161 |
+
# all providers — no separate provider key needed.
|
| 162 |
hf_token = os.environ.get("HF_TOKEN")
|
| 163 |
+
last_err = None
|
| 164 |
+
for attempt in range(1, RETRIES + 1):
|
| 165 |
+
try:
|
| 166 |
+
client = InferenceClient(provider=PROVIDER, api_key=hf_token)
|
| 167 |
+
return client.text_to_image(prompt, model=MODEL, width=1024, height=1024)
|
| 168 |
+
except Exception as e:
|
| 169 |
+
last_err = e
|
| 170 |
+
if attempt < RETRIES:
|
| 171 |
+
print(f" ⚠️ attempt {attempt}/{RETRIES} failed ({str(e)[:60]}) — retrying")
|
| 172 |
+
time.sleep(4)
|
| 173 |
+
raise last_err # exhausted retries
|
| 174 |
|
| 175 |
|
| 176 |
def main():
|
| 177 |
parser = argparse.ArgumentParser()
|
| 178 |
+
parser.add_argument("--start", type=int, default=1, help="Resume from image N (1-based)")
|
| 179 |
+
parser.add_argument("--count", type=int, default=None, help="Generate at most N images then stop")
|
| 180 |
+
parser.add_argument("--dry-run", action="store_true", help="Print prompts without generating")
|
|
|
|
| 181 |
args = parser.parse_args()
|
| 182 |
|
| 183 |
if not args.dry_run:
|
|
|
|
| 220 |
continue
|
| 221 |
|
| 222 |
try:
|
| 223 |
+
image = generate_image(prompt)
|
| 224 |
image.save(img_path, "JPEG", quality=95)
|
| 225 |
txt_path.write_text(prompt)
|
| 226 |
generated_this_run += 1
|
training/image_001.jpg
ADDED
|
Git LFS Details
|
training/image_001.txt
ADDED
|
@@ -0,0 +1 @@
|
|
|
|
|
|
|
| 1 |
+
A cute bunny in an enchanted mushroom forest, sitting on a polka-dot toadstool, fireflies and floating spores drifting around, soft lantern glow, kawaii children's book illustration, pastel anime art style, soft painterly lighting, detailed rich background with warm fairy lights, cozy magical atmosphere, cute chibi character with big sparkling eyes, soft pastel color palette, highly detailed scene, no text
|
training/image_002.jpg
ADDED
|
Git LFS Details
|
training/image_002.txt
ADDED
|
@@ -0,0 +1 @@
|
|
|
|
|
|
|
| 1 |
+
A cute kitten on a sunny beach with ocean waves, building a tiny sandcastle with a bucket and shells, gentle waves lapping, warm sunset sky, kawaii children's book illustration, pastel anime art style, soft painterly lighting, detailed rich background with warm fairy lights, cozy magical atmosphere, cute chibi character with big sparkling eyes, soft pastel color palette, highly detailed scene, no text
|
training/image_003.jpg
ADDED
|
Git LFS Details
|
training/image_003.txt
ADDED
|
@@ -0,0 +1 @@
|
|
|
|
|
|
|
| 1 |
+
A cute puppy in a cosy cottage garden, napping in a flower-filled wheelbarrow, watering can and butterflies nearby, golden afternoon light, kawaii children's book illustration, pastel anime art style, soft painterly lighting, detailed rich background with warm fairy lights, cozy magical atmosphere, cute chibi character with big sparkling eyes, soft pastel color palette, highly detailed scene, no text
|
training/image_004.jpg
ADDED
|
Git LFS Details
|
training/image_004.txt
ADDED
|
@@ -0,0 +1 @@
|
|
|
|
|
|
|
| 1 |
+
A cute baby fox surrounded by sparkling stars, curled up on a fluffy cloud cradling a tiny glowing star, glittering night sky, kawaii children's book illustration, pastel anime art style, soft painterly lighting, detailed rich background with warm fairy lights, cozy magical atmosphere, cute chibi character with big sparkling eyes, soft pastel color palette, highly detailed scene, no text
|
training/image_005.jpg
ADDED
|
Git LFS Details
|
training/image_005.txt
ADDED
|
@@ -0,0 +1 @@
|
|
|
|
|
|
|
| 1 |
+
A cute baby panda in a cherry blossom garden, nibbling a dango skewer as petals fall, paper lanterns strung above, soft pink light, kawaii children's book illustration, pastel anime art style, soft painterly lighting, detailed rich background with warm fairy lights, cozy magical atmosphere, cute chibi character with big sparkling eyes, soft pastel color palette, highly detailed scene, no text
|
training/image_006.jpg
ADDED
|
Git LFS Details
|
training/image_006.txt
ADDED
|
@@ -0,0 +1 @@
|
|
|
|
|
|
|
| 1 |
+
A cute baby koala on a tropical island, hugging a palm trunk with a coconut drink, striped hammock and a parrot, turquoise sea behind, kawaii children's book illustration, pastel anime art style, soft painterly lighting, detailed rich background with warm fairy lights, cozy magical atmosphere, cute chibi character with big sparkling eyes, soft pastel color palette, highly detailed scene, no text
|
training/image_007.jpg
ADDED
|
Git LFS Details
|
training/image_007.txt
ADDED
|
@@ -0,0 +1 @@
|
|
|
|
|
|
|
| 1 |
+
A cute baby lion under a rainbow, wearing a tiny crown at the end of a rainbow, pastel clouds and floating sparkles, kawaii children's book illustration, pastel anime art style, soft painterly lighting, detailed rich background with warm fairy lights, cozy magical atmosphere, cute chibi character with big sparkling eyes, soft pastel color palette, highly detailed scene, no text
|
training/image_008.jpg
ADDED
|
Git LFS Details
|
training/image_008.txt
ADDED
|
@@ -0,0 +1 @@
|
|
|
|
|
|
|
| 1 |
+
A cute baby tiger on a snowy mountain top, bundled in a knitted scarf on a snowy peak planting a tiny flag, sparkling snow and faint aurora, kawaii children's book illustration, pastel anime art style, soft painterly lighting, detailed rich background with warm fairy lights, cozy magical atmosphere, cute chibi character with big sparkling eyes, soft pastel color palette, highly detailed scene, no text
|
training/image_009.jpg
ADDED
|
Git LFS Details
|
training/image_009.txt
ADDED
|
@@ -0,0 +1 @@
|
|
|
|
|
|
|
| 1 |
+
A cute baby frog in a field of tropical flowers, perched on a giant hibiscus bloom, dewdrops glistening, big tropical leaves and warm bokeh, kawaii children's book illustration, pastel anime art style, soft painterly lighting, detailed rich background with warm fairy lights, cozy magical atmosphere, cute chibi character with big sparkling eyes, soft pastel color palette, highly detailed scene, no text
|
training/image_010.jpg
ADDED
|
Git LFS Details
|
training/image_010.txt
ADDED
|
@@ -0,0 +1 @@
|
|
|
|
|
|
|
| 1 |
+
A cute baby penguin on a glowing crescent moon, sitting on the curve of a glowing crescent moon in a knitted hat, scattered twinkling stars, kawaii children's book illustration, pastel anime art style, soft painterly lighting, detailed rich background with warm fairy lights, cozy magical atmosphere, cute chibi character with big sparkling eyes, soft pastel color palette, highly detailed scene, no text
|
training/image_011.jpg
ADDED
|
Git LFS Details
|
training/image_011.txt
ADDED
|
@@ -0,0 +1 @@
|
|
|
|
|
|
|
| 1 |
+
A cute butterfly in a cherry blossom garden, fluttering through cherry blossoms trailing sparkles, pastel petals swirling in the breeze, kawaii children's book illustration, pastel anime art style, soft painterly lighting, detailed rich background with warm fairy lights, cozy magical atmosphere, cute chibi character with big sparkling eyes, soft pastel color palette, highly detailed scene, no text
|
training/image_012.jpg
ADDED
|
Git LFS Details
|
training/image_012.txt
ADDED
|
@@ -0,0 +1 @@
|
|
|
|
|
|
|
| 1 |
+
A cute unicorn surrounded by sparkling stars, galloping across a starry sky, rainbow mane glowing, a trail of sparkles behind, kawaii children's book illustration, pastel anime art style, soft painterly lighting, detailed rich background with warm fairy lights, cozy magical atmosphere, cute chibi character with big sparkling eyes, soft pastel color palette, highly detailed scene, no text
|
training/image_013.jpg
ADDED
|
Git LFS Details
|
training/image_013.txt
ADDED
|
@@ -0,0 +1 @@
|
|
|
|
|
|
|
| 1 |
+
A cute puppy in an enchanted mushroom forest, exploring beneath a giant mushroom with a tiny lantern, glowing toadstools and soft moss, kawaii children's book illustration, pastel anime art style, soft painterly lighting, detailed rich background with warm fairy lights, cozy magical atmosphere, cute chibi character with big sparkling eyes, soft pastel color palette, highly detailed scene, no text
|
training/image_014.jpg
ADDED
|
Git LFS Details
|
training/image_014.txt
ADDED
|
@@ -0,0 +1 @@
|
|
|
|
|
|
|
| 1 |
+
A cute kitten on a glowing crescent moon, curled asleep on a crescent moon wearing a nightcap, twinkling stars all around, kawaii children's book illustration, pastel anime art style, soft painterly lighting, detailed rich background with warm fairy lights, cozy magical atmosphere, cute chibi character with big sparkling eyes, soft pastel color palette, highly detailed scene, no text
|
training/image_015.jpg
ADDED
|
Git LFS Details
|
training/image_015.txt
ADDED
|
@@ -0,0 +1 @@
|
|
|
|
|
|
|
| 1 |
+
A cute bunny on a sunny beach with ocean waves, splashing in shallow waves beside a starfish friend, beach pail and spade, pink sunset, kawaii children's book illustration, pastel anime art style, soft painterly lighting, detailed rich background with warm fairy lights, cozy magical atmosphere, cute chibi character with big sparkling eyes, soft pastel color palette, highly detailed scene, no text
|
training/image_016.jpg
ADDED
|
Git LFS Details
|
training/image_016.txt
ADDED
|
@@ -0,0 +1 @@
|
|
|
|
|
|
|
| 1 |
+
A cute baby panda in a cosy cottage garden, tending a vegetable patch in a straw hat, bees and tall sunflowers, warm sun, kawaii children's book illustration, pastel anime art style, soft painterly lighting, detailed rich background with warm fairy lights, cozy magical atmosphere, cute chibi character with big sparkling eyes, soft pastel color palette, highly detailed scene, no text
|
training/image_017.jpg
ADDED
|
Git LFS Details
|
training/image_017.txt
ADDED
|
@@ -0,0 +1 @@
|
|
|
|
|
|
|
| 1 |
+
A cute baby penguin on a snowy mountain top, sliding down a snowy slope on its belly, scarf flying, sparkling powder snow, kawaii children's book illustration, pastel anime art style, soft painterly lighting, detailed rich background with warm fairy lights, cozy magical atmosphere, cute chibi character with big sparkling eyes, soft pastel color palette, highly detailed scene, no text
|
training/image_018.jpg
ADDED
|
Git LFS Details
|
training/image_018.txt
ADDED
|
@@ -0,0 +1 @@
|
|
|
|
|
|
|
| 1 |
+
A cute baby fox on a tropical island, lounging in a hammock between two palms with sunglasses, coconuts and calm ocean, kawaii children's book illustration, pastel anime art style, soft painterly lighting, detailed rich background with warm fairy lights, cozy magical atmosphere, cute chibi character with big sparkling eyes, soft pastel color palette, highly detailed scene, no text
|
training/image_019.jpg
ADDED
|
Git LFS Details
|
training/image_019.txt
ADDED
|
@@ -0,0 +1 @@
|
|
|
|
|
|
|
| 1 |
+
A cute baby lion in a field of tropical flowers, snoozing in a field of tropical flowers, a butterfly on its nose, dappled golden light, kawaii children's book illustration, pastel anime art style, soft painterly lighting, detailed rich background with warm fairy lights, cozy magical atmosphere, cute chibi character with big sparkling eyes, soft pastel color palette, highly detailed scene, no text
|
training/image_020.jpg
ADDED
|
Git LFS Details
|
training/image_020.txt
ADDED
|
@@ -0,0 +1 @@
|
|
|
|
|
|
|
| 1 |
+
A cute baby tiger in a cherry blossom garden, chasing falling cherry petals, paper lanterns above, soft pink and lilac tones, kawaii children's book illustration, pastel anime art style, soft painterly lighting, detailed rich background with warm fairy lights, cozy magical atmosphere, cute chibi character with big sparkling eyes, soft pastel color palette, highly detailed scene, no text
|
training/image_021.jpg
ADDED
|
Git LFS Details
|
training/image_021.txt
ADDED
|
@@ -0,0 +1 @@
|
|
|
|
|
|
|
| 1 |
+
A cute baby frog in an enchanted mushroom forest, playing a tiny flute on a lily pad among glowing mushrooms, fireflies and reeds, kawaii children's book illustration, pastel anime art style, soft painterly lighting, detailed rich background with warm fairy lights, cozy magical atmosphere, cute chibi character with big sparkling eyes, soft pastel color palette, highly detailed scene, no text
|
training/image_022.jpg
ADDED
|
Git LFS Details
|
training/image_022.txt
ADDED
|
@@ -0,0 +1 @@
|
|
|
|
|
|
|
| 1 |
+
A cute unicorn under a rainbow, standing proudly under a rainbow, flower garland around its neck, pastel clouds, kawaii children's book illustration, pastel anime art style, soft painterly lighting, detailed rich background with warm fairy lights, cozy magical atmosphere, cute chibi character with big sparkling eyes, soft pastel color palette, highly detailed scene, no text
|
training/image_023.jpg
ADDED
|
Git LFS Details
|
training/image_023.txt
ADDED
|
@@ -0,0 +1 @@
|
|
|
|
|
|
|
| 1 |
+
A cute bunny and kitten in an enchanted mushroom forest, roasting marshmallows over a tiny campfire, fireflies and glowing mushrooms, cozy night, kawaii children's book illustration, pastel anime art style, soft painterly lighting, detailed rich background with warm fairy lights, cozy magical atmosphere, cute chibi character with big sparkling eyes, soft pastel color palette, highly detailed scene, no text
|
training/image_024.jpg
ADDED
|
Git LFS Details
|
training/image_024.txt
ADDED
|
@@ -0,0 +1 @@
|
|
|
|
|
|
|
| 1 |
+
A cute puppy and baby fox on a sunny beach with ocean waves, building a sandcastle together with shell flags, gentle waves at golden hour, kawaii children's book illustration, pastel anime art style, soft painterly lighting, detailed rich background with warm fairy lights, cozy magical atmosphere, cute chibi character with big sparkling eyes, soft pastel color palette, highly detailed scene, no text
|