BiliSakura commited on
Commit
86e180f
·
verified ·
1 Parent(s): dd09d1e

Clean repo before reupload from local JLT-diffusers

Browse files
JLT-B-1-256/model_index.json DELETED
@@ -1,1021 +0,0 @@
1
- {
2
- "_class_name": [
3
- "pipeline",
4
- "JLTPipeline"
5
- ],
6
- "_diffusers_version": "0.36.0",
7
- "scheduler": [
8
- "diffusers",
9
- "FlowMatchHeunDiscreteScheduler"
10
- ],
11
- "transformer": [
12
- "transformer_jlt",
13
- "JLTTransformer2DModel"
14
- ],
15
- "id2label": {
16
- "0": "tench, Tinca tinca",
17
- "1": "goldfish, Carassius auratus",
18
- "2": "great white shark, white shark, man-eater, man-eating shark, Carcharodon carcharias",
19
- "3": "tiger shark, Galeocerdo cuvieri",
20
- "4": "hammerhead, hammerhead shark",
21
- "5": "electric ray, crampfish, numbfish, torpedo",
22
- "6": "stingray",
23
- "7": "cock",
24
- "8": "hen",
25
- "9": "ostrich, Struthio camelus",
26
- "10": "brambling, Fringilla montifringilla",
27
- "11": "goldfinch, Carduelis carduelis",
28
- "12": "house finch, linnet, Carpodacus mexicanus",
29
- "13": "junco, snowbird",
30
- "14": "indigo bunting, indigo finch, indigo bird, Passerina cyanea",
31
- "15": "robin, American robin, Turdus migratorius",
32
- "16": "bulbul",
33
- "17": "jay",
34
- "18": "magpie",
35
- "19": "chickadee",
36
- "20": "water ouzel, dipper",
37
- "21": "kite",
38
- "22": "bald eagle, American eagle, Haliaeetus leucocephalus",
39
- "23": "vulture",
40
- "24": "great grey owl, great gray owl, Strix nebulosa",
41
- "25": "European fire salamander, Salamandra salamandra",
42
- "26": "common newt, Triturus vulgaris",
43
- "27": "eft",
44
- "28": "spotted salamander, Ambystoma maculatum",
45
- "29": "axolotl, mud puppy, Ambystoma mexicanum",
46
- "30": "bullfrog, Rana catesbeiana",
47
- "31": "tree frog, tree-frog",
48
- "32": "tailed frog, bell toad, ribbed toad, tailed toad, Ascaphus trui",
49
- "33": "loggerhead, loggerhead turtle, Caretta caretta",
50
- "34": "leatherback turtle, leatherback, leathery turtle, Dermochelys coriacea",
51
- "35": "mud turtle",
52
- "36": "terrapin",
53
- "37": "box turtle, box tortoise",
54
- "38": "banded gecko",
55
- "39": "common iguana, iguana, Iguana iguana",
56
- "40": "American chameleon, anole, Anolis carolinensis",
57
- "41": "whiptail, whiptail lizard",
58
- "42": "agama",
59
- "43": "frilled lizard, Chlamydosaurus kingi",
60
- "44": "alligator lizard",
61
- "45": "Gila monster, Heloderma suspectum",
62
- "46": "green lizard, Lacerta viridis",
63
- "47": "African chameleon, Chamaeleo chamaeleon",
64
- "48": "Komodo dragon, Komodo lizard, dragon lizard, giant lizard, Varanus komodoensis",
65
- "49": "African crocodile, Nile crocodile, Crocodylus niloticus",
66
- "50": "American alligator, Alligator mississipiensis",
67
- "51": "triceratops",
68
- "52": "thunder snake, worm snake, Carphophis amoenus",
69
- "53": "ringneck snake, ring-necked snake, ring snake",
70
- "54": "hognose snake, puff adder, sand viper",
71
- "55": "green snake, grass snake",
72
- "56": "king snake, kingsnake",
73
- "57": "garter snake, grass snake",
74
- "58": "water snake",
75
- "59": "vine snake",
76
- "60": "night snake, Hypsiglena torquata",
77
- "61": "boa constrictor, Constrictor constrictor",
78
- "62": "rock python, rock snake, Python sebae",
79
- "63": "Indian cobra, Naja naja",
80
- "64": "green mamba",
81
- "65": "sea snake",
82
- "66": "horned viper, cerastes, sand viper, horned asp, Cerastes cornutus",
83
- "67": "diamondback, diamondback rattlesnake, Crotalus adamanteus",
84
- "68": "sidewinder, horned rattlesnake, Crotalus cerastes",
85
- "69": "trilobite",
86
- "70": "harvestman, daddy longlegs, Phalangium opilio",
87
- "71": "scorpion",
88
- "72": "black and gold garden spider, Argiope aurantia",
89
- "73": "barn spider, Araneus cavaticus",
90
- "74": "garden spider, Aranea diademata",
91
- "75": "black widow, Latrodectus mactans",
92
- "76": "tarantula",
93
- "77": "wolf spider, hunting spider",
94
- "78": "tick",
95
- "79": "centipede",
96
- "80": "black grouse",
97
- "81": "ptarmigan",
98
- "82": "ruffed grouse, partridge, Bonasa umbellus",
99
- "83": "prairie chicken, prairie grouse, prairie fowl",
100
- "84": "peacock",
101
- "85": "quail",
102
- "86": "partridge",
103
- "87": "African grey, African gray, Psittacus erithacus",
104
- "88": "macaw",
105
- "89": "sulphur-crested cockatoo, Kakatoe galerita, Cacatua galerita",
106
- "90": "lorikeet",
107
- "91": "coucal",
108
- "92": "bee eater",
109
- "93": "hornbill",
110
- "94": "hummingbird",
111
- "95": "jacamar",
112
- "96": "toucan",
113
- "97": "drake",
114
- "98": "red-breasted merganser, Mergus serrator",
115
- "99": "goose",
116
- "100": "black swan, Cygnus atratus",
117
- "101": "tusker",
118
- "102": "echidna, spiny anteater, anteater",
119
- "103": "platypus, duckbill, duckbilled platypus, duck-billed platypus, Ornithorhynchus anatinus",
120
- "104": "wallaby, brush kangaroo",
121
- "105": "koala, koala bear, kangaroo bear, native bear, Phascolarctos cinereus",
122
- "106": "wombat",
123
- "107": "jellyfish",
124
- "108": "sea anemone, anemone",
125
- "109": "brain coral",
126
- "110": "flatworm, platyhelminth",
127
- "111": "nematode, nematode worm, roundworm",
128
- "112": "conch",
129
- "113": "snail",
130
- "114": "slug",
131
- "115": "sea slug, nudibranch",
132
- "116": "chiton, coat-of-mail shell, sea cradle, polyplacophore",
133
- "117": "chambered nautilus, pearly nautilus, nautilus",
134
- "118": "Dungeness crab, Cancer magister",
135
- "119": "rock crab, Cancer irroratus",
136
- "120": "fiddler crab",
137
- "121": "king crab, Alaska crab, Alaskan king crab, Alaska king crab, Paralithodes camtschatica",
138
- "122": "American lobster, Northern lobster, Maine lobster, Homarus americanus",
139
- "123": "spiny lobster, langouste, rock lobster, crawfish, crayfish, sea crawfish",
140
- "124": "crayfish, crawfish, crawdad, crawdaddy",
141
- "125": "hermit crab",
142
- "126": "isopod",
143
- "127": "white stork, Ciconia ciconia",
144
- "128": "black stork, Ciconia nigra",
145
- "129": "spoonbill",
146
- "130": "flamingo",
147
- "131": "little blue heron, Egretta caerulea",
148
- "132": "American egret, great white heron, Egretta albus",
149
- "133": "bittern",
150
- "134": "crane",
151
- "135": "limpkin, Aramus pictus",
152
- "136": "European gallinule, Porphyrio porphyrio",
153
- "137": "American coot, marsh hen, mud hen, water hen, Fulica americana",
154
- "138": "bustard",
155
- "139": "ruddy turnstone, Arenaria interpres",
156
- "140": "red-backed sandpiper, dunlin, Erolia alpina",
157
- "141": "redshank, Tringa totanus",
158
- "142": "dowitcher",
159
- "143": "oystercatcher, oyster catcher",
160
- "144": "pelican",
161
- "145": "king penguin, Aptenodytes patagonica",
162
- "146": "albatross, mollymawk",
163
- "147": "grey whale, gray whale, devilfish, Eschrichtius gibbosus, Eschrichtius robustus",
164
- "148": "killer whale, killer, orca, grampus, sea wolf, Orcinus orca",
165
- "149": "dugong, Dugong dugon",
166
- "150": "sea lion",
167
- "151": "Chihuahua",
168
- "152": "Japanese spaniel",
169
- "153": "Maltese dog, Maltese terrier, Maltese",
170
- "154": "Pekinese, Pekingese, Peke",
171
- "155": "Shih-Tzu",
172
- "156": "Blenheim spaniel",
173
- "157": "papillon",
174
- "158": "toy terrier",
175
- "159": "Rhodesian ridgeback",
176
- "160": "Afghan hound, Afghan",
177
- "161": "basset, basset hound",
178
- "162": "beagle",
179
- "163": "bloodhound, sleuthhound",
180
- "164": "bluetick",
181
- "165": "black-and-tan coonhound",
182
- "166": "Walker hound, Walker foxhound",
183
- "167": "English foxhound",
184
- "168": "redbone",
185
- "169": "borzoi, Russian wolfhound",
186
- "170": "Irish wolfhound",
187
- "171": "Italian greyhound",
188
- "172": "whippet",
189
- "173": "Ibizan hound, Ibizan Podenco",
190
- "174": "Norwegian elkhound, elkhound",
191
- "175": "otterhound, otter hound",
192
- "176": "Saluki, gazelle hound",
193
- "177": "Scottish deerhound, deerhound",
194
- "178": "Weimaraner",
195
- "179": "Staffordshire bullterrier, Staffordshire bull terrier",
196
- "180": "American Staffordshire terrier, Staffordshire terrier, American pit bull terrier, pit bull terrier",
197
- "181": "Bedlington terrier",
198
- "182": "Border terrier",
199
- "183": "Kerry blue terrier",
200
- "184": "Irish terrier",
201
- "185": "Norfolk terrier",
202
- "186": "Norwich terrier",
203
- "187": "Yorkshire terrier",
204
- "188": "wire-haired fox terrier",
205
- "189": "Lakeland terrier",
206
- "190": "Sealyham terrier, Sealyham",
207
- "191": "Airedale, Airedale terrier",
208
- "192": "cairn, cairn terrier",
209
- "193": "Australian terrier",
210
- "194": "Dandie Dinmont, Dandie Dinmont terrier",
211
- "195": "Boston bull, Boston terrier",
212
- "196": "miniature schnauzer",
213
- "197": "giant schnauzer",
214
- "198": "standard schnauzer",
215
- "199": "Scotch terrier, Scottish terrier, Scottie",
216
- "200": "Tibetan terrier, chrysanthemum dog",
217
- "201": "silky terrier, Sydney silky",
218
- "202": "soft-coated wheaten terrier",
219
- "203": "West Highland white terrier",
220
- "204": "Lhasa, Lhasa apso",
221
- "205": "flat-coated retriever",
222
- "206": "curly-coated retriever",
223
- "207": "golden retriever",
224
- "208": "Labrador retriever",
225
- "209": "Chesapeake Bay retriever",
226
- "210": "German short-haired pointer",
227
- "211": "vizsla, Hungarian pointer",
228
- "212": "English setter",
229
- "213": "Irish setter, red setter",
230
- "214": "Gordon setter",
231
- "215": "Brittany spaniel",
232
- "216": "clumber, clumber spaniel",
233
- "217": "English springer, English springer spaniel",
234
- "218": "Welsh springer spaniel",
235
- "219": "cocker spaniel, English cocker spaniel, cocker",
236
- "220": "Sussex spaniel",
237
- "221": "Irish water spaniel",
238
- "222": "kuvasz",
239
- "223": "schipperke",
240
- "224": "groenendael",
241
- "225": "malinois",
242
- "226": "briard",
243
- "227": "kelpie",
244
- "228": "komondor",
245
- "229": "Old English sheepdog, bobtail",
246
- "230": "Shetland sheepdog, Shetland sheep dog, Shetland",
247
- "231": "collie",
248
- "232": "Border collie",
249
- "233": "Bouvier des Flandres, Bouviers des Flandres",
250
- "234": "Rottweiler",
251
- "235": "German shepherd, German shepherd dog, German police dog, alsatian",
252
- "236": "Doberman, Doberman pinscher",
253
- "237": "miniature pinscher",
254
- "238": "Greater Swiss Mountain dog",
255
- "239": "Bernese mountain dog",
256
- "240": "Appenzeller",
257
- "241": "EntleBucher",
258
- "242": "boxer",
259
- "243": "bull mastiff",
260
- "244": "Tibetan mastiff",
261
- "245": "French bulldog",
262
- "246": "Great Dane",
263
- "247": "Saint Bernard, St Bernard",
264
- "248": "Eskimo dog, husky",
265
- "249": "malamute, malemute, Alaskan malamute",
266
- "250": "Siberian husky",
267
- "251": "dalmatian, coach dog, carriage dog",
268
- "252": "affenpinscher, monkey pinscher, monkey dog",
269
- "253": "basenji",
270
- "254": "pug, pug-dog",
271
- "255": "Leonberg",
272
- "256": "Newfoundland, Newfoundland dog",
273
- "257": "Great Pyrenees",
274
- "258": "Samoyed, Samoyede",
275
- "259": "Pomeranian",
276
- "260": "chow, chow chow",
277
- "261": "keeshond",
278
- "262": "Brabancon griffon",
279
- "263": "Pembroke, Pembroke Welsh corgi",
280
- "264": "Cardigan, Cardigan Welsh corgi",
281
- "265": "toy poodle",
282
- "266": "miniature poodle",
283
- "267": "standard poodle",
284
- "268": "Mexican hairless",
285
- "269": "timber wolf, grey wolf, gray wolf, Canis lupus",
286
- "270": "white wolf, Arctic wolf, Canis lupus tundrarum",
287
- "271": "red wolf, maned wolf, Canis rufus, Canis niger",
288
- "272": "coyote, prairie wolf, brush wolf, Canis latrans",
289
- "273": "dingo, warrigal, warragal, Canis dingo",
290
- "274": "dhole, Cuon alpinus",
291
- "275": "African hunting dog, hyena dog, Cape hunting dog, Lycaon pictus",
292
- "276": "hyena, hyaena",
293
- "277": "red fox, Vulpes vulpes",
294
- "278": "kit fox, Vulpes macrotis",
295
- "279": "Arctic fox, white fox, Alopex lagopus",
296
- "280": "grey fox, gray fox, Urocyon cinereoargenteus",
297
- "281": "tabby, tabby cat",
298
- "282": "tiger cat",
299
- "283": "Persian cat",
300
- "284": "Siamese cat, Siamese",
301
- "285": "Egyptian cat",
302
- "286": "cougar, puma, catamount, mountain lion, painter, panther, Felis concolor",
303
- "287": "lynx, catamount",
304
- "288": "leopard, Panthera pardus",
305
- "289": "snow leopard, ounce, Panthera uncia",
306
- "290": "jaguar, panther, Panthera onca, Felis onca",
307
- "291": "lion, king of beasts, Panthera leo",
308
- "292": "tiger, Panthera tigris",
309
- "293": "cheetah, chetah, Acinonyx jubatus",
310
- "294": "brown bear, bruin, Ursus arctos",
311
- "295": "American black bear, black bear, Ursus americanus, Euarctos americanus",
312
- "296": "ice bear, polar bear, Ursus Maritimus, Thalarctos maritimus",
313
- "297": "sloth bear, Melursus ursinus, Ursus ursinus",
314
- "298": "mongoose",
315
- "299": "meerkat, mierkat",
316
- "300": "tiger beetle",
317
- "301": "ladybug, ladybeetle, lady beetle, ladybird, ladybird beetle",
318
- "302": "ground beetle, carabid beetle",
319
- "303": "long-horned beetle, longicorn, longicorn beetle",
320
- "304": "leaf beetle, chrysomelid",
321
- "305": "dung beetle",
322
- "306": "rhinoceros beetle",
323
- "307": "weevil",
324
- "308": "fly",
325
- "309": "bee",
326
- "310": "ant, emmet, pismire",
327
- "311": "grasshopper, hopper",
328
- "312": "cricket",
329
- "313": "walking stick, walkingstick, stick insect",
330
- "314": "cockroach, roach",
331
- "315": "mantis, mantid",
332
- "316": "cicada, cicala",
333
- "317": "leafhopper",
334
- "318": "lacewing, lacewing fly",
335
- "319": "dragonfly, darning needle, devils darning needle, sewing needle, snake feeder, snake doctor, mosquito hawk, skeeter hawk",
336
- "320": "damselfly",
337
- "321": "admiral",
338
- "322": "ringlet, ringlet butterfly",
339
- "323": "monarch, monarch butterfly, milkweed butterfly, Danaus plexippus",
340
- "324": "cabbage butterfly",
341
- "325": "sulphur butterfly, sulfur butterfly",
342
- "326": "lycaenid, lycaenid butterfly",
343
- "327": "starfish, sea star",
344
- "328": "sea urchin",
345
- "329": "sea cucumber, holothurian",
346
- "330": "wood rabbit, cottontail, cottontail rabbit",
347
- "331": "hare",
348
- "332": "Angora, Angora rabbit",
349
- "333": "hamster",
350
- "334": "porcupine, hedgehog",
351
- "335": "fox squirrel, eastern fox squirrel, Sciurus niger",
352
- "336": "marmot",
353
- "337": "beaver",
354
- "338": "guinea pig, Cavia cobaya",
355
- "339": "sorrel",
356
- "340": "zebra",
357
- "341": "hog, pig, grunter, squealer, Sus scrofa",
358
- "342": "wild boar, boar, Sus scrofa",
359
- "343": "warthog",
360
- "344": "hippopotamus, hippo, river horse, Hippopotamus amphibius",
361
- "345": "ox",
362
- "346": "water buffalo, water ox, Asiatic buffalo, Bubalus bubalis",
363
- "347": "bison",
364
- "348": "ram, tup",
365
- "349": "bighorn, bighorn sheep, cimarron, Rocky Mountain bighorn, Rocky Mountain sheep, Ovis canadensis",
366
- "350": "ibex, Capra ibex",
367
- "351": "hartebeest",
368
- "352": "impala, Aepyceros melampus",
369
- "353": "gazelle",
370
- "354": "Arabian camel, dromedary, Camelus dromedarius",
371
- "355": "llama",
372
- "356": "weasel",
373
- "357": "mink",
374
- "358": "polecat, fitch, foulmart, foumart, Mustela putorius",
375
- "359": "black-footed ferret, ferret, Mustela nigripes",
376
- "360": "otter",
377
- "361": "skunk, polecat, wood pussy",
378
- "362": "badger",
379
- "363": "armadillo",
380
- "364": "three-toed sloth, ai, Bradypus tridactylus",
381
- "365": "orangutan, orang, orangutang, Pongo pygmaeus",
382
- "366": "gorilla, Gorilla gorilla",
383
- "367": "chimpanzee, chimp, Pan troglodytes",
384
- "368": "gibbon, Hylobates lar",
385
- "369": "siamang, Hylobates syndactylus, Symphalangus syndactylus",
386
- "370": "guenon, guenon monkey",
387
- "371": "patas, hussar monkey, Erythrocebus patas",
388
- "372": "baboon",
389
- "373": "macaque",
390
- "374": "langur",
391
- "375": "colobus, colobus monkey",
392
- "376": "proboscis monkey, Nasalis larvatus",
393
- "377": "marmoset",
394
- "378": "capuchin, ringtail, Cebus capucinus",
395
- "379": "howler monkey, howler",
396
- "380": "titi, titi monkey",
397
- "381": "spider monkey, Ateles geoffroyi",
398
- "382": "squirrel monkey, Saimiri sciureus",
399
- "383": "Madagascar cat, ring-tailed lemur, Lemur catta",
400
- "384": "indri, indris, Indri indri, Indri brevicaudatus",
401
- "385": "Indian elephant, Elephas maximus",
402
- "386": "African elephant, Loxodonta africana",
403
- "387": "lesser panda, red panda, panda, bear cat, cat bear, Ailurus fulgens",
404
- "388": "giant panda, panda, panda bear, coon bear, Ailuropoda melanoleuca",
405
- "389": "barracouta, snoek",
406
- "390": "eel",
407
- "391": "coho, cohoe, coho salmon, blue jack, silver salmon, Oncorhynchus kisutch",
408
- "392": "rock beauty, Holocanthus tricolor",
409
- "393": "anemone fish",
410
- "394": "sturgeon",
411
- "395": "gar, garfish, garpike, billfish, Lepisosteus osseus",
412
- "396": "lionfish",
413
- "397": "puffer, pufferfish, blowfish, globefish",
414
- "398": "abacus",
415
- "399": "abaya",
416
- "400": "academic gown, academic robe, judge robe",
417
- "401": "accordion, piano accordion, squeeze box",
418
- "402": "acoustic guitar",
419
- "403": "aircraft carrier, carrier, flattop, attack aircraft carrier",
420
- "404": "airliner",
421
- "405": "airship, dirigible",
422
- "406": "altar",
423
- "407": "ambulance",
424
- "408": "amphibian, amphibious vehicle",
425
- "409": "analog clock",
426
- "410": "apiary, bee house",
427
- "411": "apron",
428
- "412": "ashcan, trash can, garbage can, wastebin, ash bin, ash-bin, ashbin, dustbin, trash barrel, trash bin",
429
- "413": "assault rifle, assault gun",
430
- "414": "backpack, back pack, knapsack, packsack, rucksack, haversack",
431
- "415": "bakery, bakeshop, bakehouse",
432
- "416": "balance beam, beam",
433
- "417": "balloon",
434
- "418": "ballpoint, ballpoint pen, ballpen, Biro",
435
- "419": "Band Aid",
436
- "420": "banjo",
437
- "421": "bannister, banister, balustrade, balusters, handrail",
438
- "422": "barbell",
439
- "423": "barber chair",
440
- "424": "barbershop",
441
- "425": "barn",
442
- "426": "barometer",
443
- "427": "barrel, cask",
444
- "428": "barrow, garden cart, lawn cart, wheelbarrow",
445
- "429": "baseball",
446
- "430": "basketball",
447
- "431": "bassinet",
448
- "432": "bassoon",
449
- "433": "bathing cap, swimming cap",
450
- "434": "bath towel",
451
- "435": "bathtub, bathing tub, bath, tub",
452
- "436": "beach wagon, station wagon, wagon, estate car, beach waggon, station waggon, waggon",
453
- "437": "beacon, lighthouse, beacon light, pharos",
454
- "438": "beaker",
455
- "439": "bearskin, busby, shako",
456
- "440": "beer bottle",
457
- "441": "beer glass",
458
- "442": "bell cote, bell cot",
459
- "443": "bib",
460
- "444": "bicycle-built-for-two, tandem bicycle, tandem",
461
- "445": "bikini, two-piece",
462
- "446": "binder, ring-binder",
463
- "447": "binoculars, field glasses, opera glasses",
464
- "448": "birdhouse",
465
- "449": "boathouse",
466
- "450": "bobsled, bobsleigh, bob",
467
- "451": "bolo tie, bolo, bola tie, bola",
468
- "452": "bonnet, poke bonnet",
469
- "453": "bookcase",
470
- "454": "bookshop, bookstore, bookstall",
471
- "455": "bottlecap",
472
- "456": "bow",
473
- "457": "bow tie, bow-tie, bowtie",
474
- "458": "brass, memorial tablet, plaque",
475
- "459": "brassiere, bra, bandeau",
476
- "460": "breakwater, groin, groyne, mole, bulwark, seawall, jetty",
477
- "461": "breastplate, aegis, egis",
478
- "462": "broom",
479
- "463": "bucket, pail",
480
- "464": "buckle",
481
- "465": "bulletproof vest",
482
- "466": "bullet train, bullet",
483
- "467": "butcher shop, meat market",
484
- "468": "cab, hack, taxi, taxicab",
485
- "469": "caldron, cauldron",
486
- "470": "candle, taper, wax light",
487
- "471": "cannon",
488
- "472": "canoe",
489
- "473": "can opener, tin opener",
490
- "474": "cardigan",
491
- "475": "car mirror",
492
- "476": "carousel, carrousel, merry-go-round, roundabout, whirligig",
493
- "477": "carpenters kit, tool kit",
494
- "478": "carton",
495
- "479": "car wheel",
496
- "480": "cash machine, cash dispenser, automated teller machine, automatic teller machine, automated teller, automatic teller, ATM",
497
- "481": "cassette",
498
- "482": "cassette player",
499
- "483": "castle",
500
- "484": "catamaran",
501
- "485": "CD player",
502
- "486": "cello, violoncello",
503
- "487": "cellular telephone, cellular phone, cellphone, cell, mobile phone",
504
- "488": "chain",
505
- "489": "chainlink fence",
506
- "490": "chain mail, ring mail, mail, chain armor, chain armour, ring armor, ring armour",
507
- "491": "chain saw, chainsaw",
508
- "492": "chest",
509
- "493": "chiffonier, commode",
510
- "494": "chime, bell, gong",
511
- "495": "china cabinet, china closet",
512
- "496": "Christmas stocking",
513
- "497": "church, church building",
514
- "498": "cinema, movie theater, movie theatre, movie house, picture palace",
515
- "499": "cleaver, meat cleaver, chopper",
516
- "500": "cliff dwelling",
517
- "501": "cloak",
518
- "502": "clog, geta, patten, sabot",
519
- "503": "cocktail shaker",
520
- "504": "coffee mug",
521
- "505": "coffeepot",
522
- "506": "coil, spiral, volute, whorl, helix",
523
- "507": "combination lock",
524
- "508": "computer keyboard, keypad",
525
- "509": "confectionery, confectionary, candy store",
526
- "510": "container ship, containership, container vessel",
527
- "511": "convertible",
528
- "512": "corkscrew, bottle screw",
529
- "513": "cornet, horn, trumpet, trump",
530
- "514": "cowboy boot",
531
- "515": "cowboy hat, ten-gallon hat",
532
- "516": "cradle",
533
- "517": "crane",
534
- "518": "crash helmet",
535
- "519": "crate",
536
- "520": "crib, cot",
537
- "521": "Crock Pot",
538
- "522": "croquet ball",
539
- "523": "crutch",
540
- "524": "cuirass",
541
- "525": "dam, dike, dyke",
542
- "526": "desk",
543
- "527": "desktop computer",
544
- "528": "dial telephone, dial phone",
545
- "529": "diaper, nappy, napkin",
546
- "530": "digital clock",
547
- "531": "digital watch",
548
- "532": "dining table, board",
549
- "533": "dishrag, dishcloth",
550
- "534": "dishwasher, dish washer, dishwashing machine",
551
- "535": "disk brake, disc brake",
552
- "536": "dock, dockage, docking facility",
553
- "537": "dogsled, dog sled, dog sleigh",
554
- "538": "dome",
555
- "539": "doormat, welcome mat",
556
- "540": "drilling platform, offshore rig",
557
- "541": "drum, membranophone, tympan",
558
- "542": "drumstick",
559
- "543": "dumbbell",
560
- "544": "Dutch oven",
561
- "545": "electric fan, blower",
562
- "546": "electric guitar",
563
- "547": "electric locomotive",
564
- "548": "entertainment center",
565
- "549": "envelope",
566
- "550": "espresso maker",
567
- "551": "face powder",
568
- "552": "feather boa, boa",
569
- "553": "file, file cabinet, filing cabinet",
570
- "554": "fireboat",
571
- "555": "fire engine, fire truck",
572
- "556": "fire screen, fireguard",
573
- "557": "flagpole, flagstaff",
574
- "558": "flute, transverse flute",
575
- "559": "folding chair",
576
- "560": "football helmet",
577
- "561": "forklift",
578
- "562": "fountain",
579
- "563": "fountain pen",
580
- "564": "four-poster",
581
- "565": "freight car",
582
- "566": "French horn, horn",
583
- "567": "frying pan, frypan, skillet",
584
- "568": "fur coat",
585
- "569": "garbage truck, dustcart",
586
- "570": "gasmask, respirator, gas helmet",
587
- "571": "gas pump, gasoline pump, petrol pump, island dispenser",
588
- "572": "goblet",
589
- "573": "go-kart",
590
- "574": "golf ball",
591
- "575": "golfcart, golf cart",
592
- "576": "gondola",
593
- "577": "gong, tam-tam",
594
- "578": "gown",
595
- "579": "grand piano, grand",
596
- "580": "greenhouse, nursery, glasshouse",
597
- "581": "grille, radiator grille",
598
- "582": "grocery store, grocery, food market, market",
599
- "583": "guillotine",
600
- "584": "hair slide",
601
- "585": "hair spray",
602
- "586": "half track",
603
- "587": "hammer",
604
- "588": "hamper",
605
- "589": "hand blower, blow dryer, blow drier, hair dryer, hair drier",
606
- "590": "hand-held computer, hand-held microcomputer",
607
- "591": "handkerchief, hankie, hanky, hankey",
608
- "592": "hard disc, hard disk, fixed disk",
609
- "593": "harmonica, mouth organ, harp, mouth harp",
610
- "594": "harp",
611
- "595": "harvester, reaper",
612
- "596": "hatchet",
613
- "597": "holster",
614
- "598": "home theater, home theatre",
615
- "599": "honeycomb",
616
- "600": "hook, claw",
617
- "601": "hoopskirt, crinoline",
618
- "602": "horizontal bar, high bar",
619
- "603": "horse cart, horse-cart",
620
- "604": "hourglass",
621
- "605": "iPod",
622
- "606": "iron, smoothing iron",
623
- "607": "jack-o-lantern",
624
- "608": "jean, blue jean, denim",
625
- "609": "jeep, landrover",
626
- "610": "jersey, T-shirt, tee shirt",
627
- "611": "jigsaw puzzle",
628
- "612": "jinrikisha, ricksha, rickshaw",
629
- "613": "joystick",
630
- "614": "kimono",
631
- "615": "knee pad",
632
- "616": "knot",
633
- "617": "lab coat, laboratory coat",
634
- "618": "ladle",
635
- "619": "lampshade, lamp shade",
636
- "620": "laptop, laptop computer",
637
- "621": "lawn mower, mower",
638
- "622": "lens cap, lens cover",
639
- "623": "letter opener, paper knife, paperknife",
640
- "624": "library",
641
- "625": "lifeboat",
642
- "626": "lighter, light, igniter, ignitor",
643
- "627": "limousine, limo",
644
- "628": "liner, ocean liner",
645
- "629": "lipstick, lip rouge",
646
- "630": "Loafer",
647
- "631": "lotion",
648
- "632": "loudspeaker, speaker, speaker unit, loudspeaker system, speaker system",
649
- "633": "loupe, jewelers loupe",
650
- "634": "lumbermill, sawmill",
651
- "635": "magnetic compass",
652
- "636": "mailbag, postbag",
653
- "637": "mailbox, letter box",
654
- "638": "maillot",
655
- "639": "maillot, tank suit",
656
- "640": "manhole cover",
657
- "641": "maraca",
658
- "642": "marimba, xylophone",
659
- "643": "mask",
660
- "644": "matchstick",
661
- "645": "maypole",
662
- "646": "maze, labyrinth",
663
- "647": "measuring cup",
664
- "648": "medicine chest, medicine cabinet",
665
- "649": "megalith, megalithic structure",
666
- "650": "microphone, mike",
667
- "651": "microwave, microwave oven",
668
- "652": "military uniform",
669
- "653": "milk can",
670
- "654": "minibus",
671
- "655": "miniskirt, mini",
672
- "656": "minivan",
673
- "657": "missile",
674
- "658": "mitten",
675
- "659": "mixing bowl",
676
- "660": "mobile home, manufactured home",
677
- "661": "Model T",
678
- "662": "modem",
679
- "663": "monastery",
680
- "664": "monitor",
681
- "665": "moped",
682
- "666": "mortar",
683
- "667": "mortarboard",
684
- "668": "mosque",
685
- "669": "mosquito net",
686
- "670": "motor scooter, scooter",
687
- "671": "mountain bike, all-terrain bike, off-roader",
688
- "672": "mountain tent",
689
- "673": "mouse, computer mouse",
690
- "674": "mousetrap",
691
- "675": "moving van",
692
- "676": "muzzle",
693
- "677": "nail",
694
- "678": "neck brace",
695
- "679": "necklace",
696
- "680": "nipple",
697
- "681": "notebook, notebook computer",
698
- "682": "obelisk",
699
- "683": "oboe, hautboy, hautbois",
700
- "684": "ocarina, sweet potato",
701
- "685": "odometer, hodometer, mileometer, milometer",
702
- "686": "oil filter",
703
- "687": "organ, pipe organ",
704
- "688": "oscilloscope, scope, cathode-ray oscilloscope, CRO",
705
- "689": "overskirt",
706
- "690": "oxcart",
707
- "691": "oxygen mask",
708
- "692": "packet",
709
- "693": "paddle, boat paddle",
710
- "694": "paddlewheel, paddle wheel",
711
- "695": "padlock",
712
- "696": "paintbrush",
713
- "697": "pajama, pyjama, pjs, jammies",
714
- "698": "palace",
715
- "699": "panpipe, pandean pipe, syrinx",
716
- "700": "paper towel",
717
- "701": "parachute, chute",
718
- "702": "parallel bars, bars",
719
- "703": "park bench",
720
- "704": "parking meter",
721
- "705": "passenger car, coach, carriage",
722
- "706": "patio, terrace",
723
- "707": "pay-phone, pay-station",
724
- "708": "pedestal, plinth, footstall",
725
- "709": "pencil box, pencil case",
726
- "710": "pencil sharpener",
727
- "711": "perfume, essence",
728
- "712": "Petri dish",
729
- "713": "photocopier",
730
- "714": "pick, plectrum, plectron",
731
- "715": "pickelhaube",
732
- "716": "picket fence, paling",
733
- "717": "pickup, pickup truck",
734
- "718": "pier",
735
- "719": "piggy bank, penny bank",
736
- "720": "pill bottle",
737
- "721": "pillow",
738
- "722": "ping-pong ball",
739
- "723": "pinwheel",
740
- "724": "pirate, pirate ship",
741
- "725": "pitcher, ewer",
742
- "726": "plane, carpenters plane, woodworking plane",
743
- "727": "planetarium",
744
- "728": "plastic bag",
745
- "729": "plate rack",
746
- "730": "plow, plough",
747
- "731": "plunger, plumbers helper",
748
- "732": "Polaroid camera, Polaroid Land camera",
749
- "733": "pole",
750
- "734": "police van, police wagon, paddy wagon, patrol wagon, wagon, black Maria",
751
- "735": "poncho",
752
- "736": "pool table, billiard table, snooker table",
753
- "737": "pop bottle, soda bottle",
754
- "738": "pot, flowerpot",
755
- "739": "potters wheel",
756
- "740": "power drill",
757
- "741": "prayer rug, prayer mat",
758
- "742": "printer",
759
- "743": "prison, prison house",
760
- "744": "projectile, missile",
761
- "745": "projector",
762
- "746": "puck, hockey puck",
763
- "747": "punching bag, punch bag, punching ball, punchball",
764
- "748": "purse",
765
- "749": "quill, quill pen",
766
- "750": "quilt, comforter, comfort, puff",
767
- "751": "racer, race car, racing car",
768
- "752": "racket, racquet",
769
- "753": "radiator",
770
- "754": "radio, wireless",
771
- "755": "radio telescope, radio reflector",
772
- "756": "rain barrel",
773
- "757": "recreational vehicle, RV, R.V.",
774
- "758": "reel",
775
- "759": "reflex camera",
776
- "760": "refrigerator, icebox",
777
- "761": "remote control, remote",
778
- "762": "restaurant, eating house, eating place, eatery",
779
- "763": "revolver, six-gun, six-shooter",
780
- "764": "rifle",
781
- "765": "rocking chair, rocker",
782
- "766": "rotisserie",
783
- "767": "rubber eraser, rubber, pencil eraser",
784
- "768": "rugby ball",
785
- "769": "rule, ruler",
786
- "770": "running shoe",
787
- "771": "safe",
788
- "772": "safety pin",
789
- "773": "saltshaker, salt shaker",
790
- "774": "sandal",
791
- "775": "sarong",
792
- "776": "sax, saxophone",
793
- "777": "scabbard",
794
- "778": "scale, weighing machine",
795
- "779": "school bus",
796
- "780": "schooner",
797
- "781": "scoreboard",
798
- "782": "screen, CRT screen",
799
- "783": "screw",
800
- "784": "screwdriver",
801
- "785": "seat belt, seatbelt",
802
- "786": "sewing machine",
803
- "787": "shield, buckler",
804
- "788": "shoe shop, shoe-shop, shoe store",
805
- "789": "shoji",
806
- "790": "shopping basket",
807
- "791": "shopping cart",
808
- "792": "shovel",
809
- "793": "shower cap",
810
- "794": "shower curtain",
811
- "795": "ski",
812
- "796": "ski mask",
813
- "797": "sleeping bag",
814
- "798": "slide rule, slipstick",
815
- "799": "sliding door",
816
- "800": "slot, one-armed bandit",
817
- "801": "snorkel",
818
- "802": "snowmobile",
819
- "803": "snowplow, snowplough",
820
- "804": "soap dispenser",
821
- "805": "soccer ball",
822
- "806": "sock",
823
- "807": "solar dish, solar collector, solar furnace",
824
- "808": "sombrero",
825
- "809": "soup bowl",
826
- "810": "space bar",
827
- "811": "space heater",
828
- "812": "space shuttle",
829
- "813": "spatula",
830
- "814": "speedboat",
831
- "815": "spider web, spiders web",
832
- "816": "spindle",
833
- "817": "sports car, sport car",
834
- "818": "spotlight, spot",
835
- "819": "stage",
836
- "820": "steam locomotive",
837
- "821": "steel arch bridge",
838
- "822": "steel drum",
839
- "823": "stethoscope",
840
- "824": "stole",
841
- "825": "stone wall",
842
- "826": "stopwatch, stop watch",
843
- "827": "stove",
844
- "828": "strainer",
845
- "829": "streetcar, tram, tramcar, trolley, trolley car",
846
- "830": "stretcher",
847
- "831": "studio couch, day bed",
848
- "832": "stupa, tope",
849
- "833": "submarine, pigboat, sub, U-boat",
850
- "834": "suit, suit of clothes",
851
- "835": "sundial",
852
- "836": "sunglass",
853
- "837": "sunglasses, dark glasses, shades",
854
- "838": "sunscreen, sunblock, sun blocker",
855
- "839": "suspension bridge",
856
- "840": "swab, swob, mop",
857
- "841": "sweatshirt",
858
- "842": "swimming trunks, bathing trunks",
859
- "843": "swing",
860
- "844": "switch, electric switch, electrical switch",
861
- "845": "syringe",
862
- "846": "table lamp",
863
- "847": "tank, army tank, armored combat vehicle, armoured combat vehicle",
864
- "848": "tape player",
865
- "849": "teapot",
866
- "850": "teddy, teddy bear",
867
- "851": "television, television system",
868
- "852": "tennis ball",
869
- "853": "thatch, thatched roof",
870
- "854": "theater curtain, theatre curtain",
871
- "855": "thimble",
872
- "856": "thresher, thrasher, threshing machine",
873
- "857": "throne",
874
- "858": "tile roof",
875
- "859": "toaster",
876
- "860": "tobacco shop, tobacconist shop, tobacconist",
877
- "861": "toilet seat",
878
- "862": "torch",
879
- "863": "totem pole",
880
- "864": "tow truck, tow car, wrecker",
881
- "865": "toyshop",
882
- "866": "tractor",
883
- "867": "trailer truck, tractor trailer, trucking rig, rig, articulated lorry, semi",
884
- "868": "tray",
885
- "869": "trench coat",
886
- "870": "tricycle, trike, velocipede",
887
- "871": "trimaran",
888
- "872": "tripod",
889
- "873": "triumphal arch",
890
- "874": "trolleybus, trolley coach, trackless trolley",
891
- "875": "trombone",
892
- "876": "tub, vat",
893
- "877": "turnstile",
894
- "878": "typewriter keyboard",
895
- "879": "umbrella",
896
- "880": "unicycle, monocycle",
897
- "881": "upright, upright piano",
898
- "882": "vacuum, vacuum cleaner",
899
- "883": "vase",
900
- "884": "vault",
901
- "885": "velvet",
902
- "886": "vending machine",
903
- "887": "vestment",
904
- "888": "viaduct",
905
- "889": "violin, fiddle",
906
- "890": "volleyball",
907
- "891": "waffle iron",
908
- "892": "wall clock",
909
- "893": "wallet, billfold, notecase, pocketbook",
910
- "894": "wardrobe, closet, press",
911
- "895": "warplane, military plane",
912
- "896": "washbasin, handbasin, washbowl, lavabo, wash-hand basin",
913
- "897": "washer, automatic washer, washing machine",
914
- "898": "water bottle",
915
- "899": "water jug",
916
- "900": "water tower",
917
- "901": "whiskey jug",
918
- "902": "whistle",
919
- "903": "wig",
920
- "904": "window screen",
921
- "905": "window shade",
922
- "906": "Windsor tie",
923
- "907": "wine bottle",
924
- "908": "wing",
925
- "909": "wok",
926
- "910": "wooden spoon",
927
- "911": "wool, woolen, woollen",
928
- "912": "worm fence, snake fence, snake-rail fence, Virginia fence",
929
- "913": "wreck",
930
- "914": "yawl",
931
- "915": "yurt",
932
- "916": "web site, website, internet site, site",
933
- "917": "comic book",
934
- "918": "crossword puzzle, crossword",
935
- "919": "street sign",
936
- "920": "traffic light, traffic signal, stoplight",
937
- "921": "book jacket, dust cover, dust jacket, dust wrapper",
938
- "922": "menu",
939
- "923": "plate",
940
- "924": "guacamole",
941
- "925": "consomme",
942
- "926": "hot pot, hotpot",
943
- "927": "trifle",
944
- "928": "ice cream, icecream",
945
- "929": "ice lolly, lolly, lollipop, popsicle",
946
- "930": "French loaf",
947
- "931": "bagel, beigel",
948
- "932": "pretzel",
949
- "933": "cheeseburger",
950
- "934": "hotdog, hot dog, red hot",
951
- "935": "mashed potato",
952
- "936": "head cabbage",
953
- "937": "broccoli",
954
- "938": "cauliflower",
955
- "939": "zucchini, courgette",
956
- "940": "spaghetti squash",
957
- "941": "acorn squash",
958
- "942": "butternut squash",
959
- "943": "cucumber, cuke",
960
- "944": "artichoke, globe artichoke",
961
- "945": "bell pepper",
962
- "946": "cardoon",
963
- "947": "mushroom",
964
- "948": "Granny Smith",
965
- "949": "strawberry",
966
- "950": "orange",
967
- "951": "lemon",
968
- "952": "fig",
969
- "953": "pineapple, ananas",
970
- "954": "banana",
971
- "955": "jackfruit, jak, jack",
972
- "956": "custard apple",
973
- "957": "pomegranate",
974
- "958": "hay",
975
- "959": "carbonara",
976
- "960": "chocolate sauce, chocolate syrup",
977
- "961": "dough",
978
- "962": "meat loaf, meatloaf",
979
- "963": "pizza, pizza pie",
980
- "964": "potpie",
981
- "965": "burrito",
982
- "966": "red wine",
983
- "967": "espresso",
984
- "968": "cup",
985
- "969": "eggnog",
986
- "970": "alp",
987
- "971": "bubble",
988
- "972": "cliff, drop, drop-off",
989
- "973": "coral reef",
990
- "974": "geyser",
991
- "975": "lakeside, lakeshore",
992
- "976": "promontory, headland, head, foreland",
993
- "977": "sandbar, sand bar",
994
- "978": "seashore, coast, seacoast, sea-coast",
995
- "979": "valley, vale",
996
- "980": "volcano",
997
- "981": "ballplayer, baseball player",
998
- "982": "groom, bridegroom",
999
- "983": "scuba diver",
1000
- "984": "rapeseed",
1001
- "985": "daisy",
1002
- "986": "yellow ladys slipper, yellow lady-slipper, Cypripedium calceolus, Cypripedium parviflorum",
1003
- "987": "corn",
1004
- "988": "acorn",
1005
- "989": "hip, rose hip, rosehip",
1006
- "990": "buckeye, horse chestnut, conker",
1007
- "991": "coral fungus",
1008
- "992": "agaric",
1009
- "993": "gyromitra",
1010
- "994": "stinkhorn, carrion fungus",
1011
- "995": "earthstar",
1012
- "996": "hen-of-the-woods, hen of the woods, Polyporus frondosus, Grifola frondosa",
1013
- "997": "bolete",
1014
- "998": "ear, spike, capitulum",
1015
- "999": "toilet tissue, toilet paper, bathroom tissue"
1016
- },
1017
- "vae": [
1018
- "diffusers",
1019
- "AutoencoderKLFlux2"
1020
- ]
1021
- }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
JLT-B-1-256/pipeline.py DELETED
@@ -1,548 +0,0 @@
1
- """Hub custom pipeline: JLTPipeline.
2
- Load with native Hugging Face diffusers and trust_remote_code=True.
3
- """
4
-
5
- from __future__ import annotations
6
-
7
- import importlib
8
- import json
9
- import sys
10
- from pathlib import Path
11
- from typing import Dict, List, Optional, Tuple, Union
12
-
13
- import numpy as np
14
- import torch
15
- from diffusers import AutoencoderKLFlux2
16
- from diffusers.pipelines.pipeline_utils import DiffusionPipeline, ImagePipelineOutput
17
- from diffusers.schedulers import FlowMatchEulerDiscreteScheduler, FlowMatchHeunDiscreteScheduler
18
- from diffusers.schedulers.scheduling_utils import SchedulerMixin
19
- from diffusers.utils.torch_utils import randn_tensor
20
-
21
-
22
- def configure_linear_flow_timesteps(
23
- scheduler: SchedulerMixin,
24
- num_inference_steps: int,
25
- device: Union[str, torch.device, None] = None,
26
- ) -> None:
27
- if isinstance(scheduler, FlowMatchHeunDiscreteScheduler):
28
- scheduler.num_inference_steps = num_inference_steps
29
- sigmas = np.linspace(1.0, 0.0, num_inference_steps, dtype=np.float32)
30
- sigmas_t = torch.from_numpy(sigmas).to(dtype=torch.float32, device=device)
31
- shift = scheduler.config.shift
32
- sigmas_t = shift * sigmas_t / (1 + (shift - 1) * sigmas_t)
33
- timesteps = sigmas_t * scheduler.config.num_train_timesteps
34
- timesteps = torch.cat([timesteps[:1], timesteps[1:].repeat_interleave(2)])
35
- scheduler.timesteps = timesteps.to(device=device)
36
- sigmas_t = torch.cat([sigmas_t, torch.zeros(1, device=sigmas_t.device)])
37
- scheduler.sigmas = torch.cat([sigmas_t[:1], sigmas_t[1:-1].repeat_interleave(2), sigmas_t[-1:]])
38
- scheduler._step_index = None
39
- scheduler._begin_index = None
40
- scheduler.prev_derivative = None
41
- scheduler.dt = None
42
- scheduler.sample = None
43
- return
44
-
45
- sigmas = np.linspace(1.0, 0.0, num_inference_steps, dtype=np.float32).tolist()
46
- scheduler.set_timesteps(num_inference_steps, device=device, sigmas=sigmas)
47
-
48
-
49
- def velocity_from_prediction(
50
- sample: torch.Tensor,
51
- model_output: torch.Tensor,
52
- timestep: Union[float, torch.Tensor],
53
- *,
54
- prediction_type: str = "sample",
55
- t_eps: float = 5e-2,
56
- ) -> torch.Tensor:
57
- if prediction_type == "velocity":
58
- return model_output
59
-
60
- t = torch.as_tensor(timestep, device=sample.device, dtype=sample.dtype)
61
- while t.ndim < sample.ndim:
62
- t = t.unsqueeze(-1)
63
- denom = (1.0 - t).clamp_min(t_eps)
64
- return (model_output - sample) / denom
65
-
66
-
67
- def _unpatchify_latents(latents: torch.Tensor) -> torch.Tensor:
68
- batch_size, num_channels_latents, height, width = latents.shape
69
- latents = latents.reshape(batch_size, num_channels_latents // (2 * 2), 2, 2, height, width)
70
- latents = latents.permute(0, 1, 4, 2, 5, 3)
71
- return latents.reshape(batch_size, num_channels_latents // (2 * 2), height * 2, width * 2)
72
-
73
-
74
- def _flux2_bn_stats(vae: AutoencoderKLFlux2, ref: torch.Tensor) -> tuple[torch.Tensor, torch.Tensor]:
75
- mean = vae.bn.running_mean.view(1, -1, 1, 1).to(ref.device, ref.dtype)
76
- std = torch.sqrt(
77
- vae.bn.running_var.view(1, -1, 1, 1).to(ref.device, ref.dtype) + vae.config.batch_norm_eps
78
- )
79
- return mean, std
80
-
81
-
82
- @torch.no_grad()
83
- def decode_flux2_latents(vae: AutoencoderKLFlux2, latents: torch.Tensor) -> torch.Tensor:
84
- vae_param = next(vae.parameters())
85
- latents = latents.to(device=vae_param.device, dtype=torch.float32)
86
- mean, std = _flux2_bn_stats(vae, latents)
87
- latents = latents * std + mean
88
- latents = _unpatchify_latents(latents)
89
- return vae.decode(latents.to(vae_param.dtype), return_dict=False)[0].float()
90
-
91
- _FLOW_SCHEDULERS = {
92
- "heun": FlowMatchHeunDiscreteScheduler,
93
- "euler": FlowMatchEulerDiscreteScheduler,
94
- }
95
-
96
-
97
- def _new_flow_scheduler(solver: str) -> SchedulerMixin:
98
- if solver not in _FLOW_SCHEDULERS:
99
- raise ValueError("solver must be one of: 'heun', 'euler'.")
100
- return _FLOW_SCHEDULERS[solver]()
101
-
102
-
103
- def _solver_from_scheduler(scheduler: SchedulerMixin | None) -> str:
104
- if isinstance(scheduler, FlowMatchHeunDiscreteScheduler):
105
- return "heun"
106
- if isinstance(scheduler, FlowMatchEulerDiscreteScheduler):
107
- return "euler"
108
- return "heun"
109
-
110
-
111
- class JLTPipeline(DiffusionPipeline):
112
- r"""
113
- Pipeline for class-conditional image generation with JLT (Clean-Latent JiT).
114
-
115
- Latent models (`in_channels=128`) require a FLUX.2 VAE attached for `output_type="pil"`.
116
- """
117
-
118
- model_cpu_offload_seq = "transformer->vae"
119
- _optional_components = ["vae"]
120
-
121
- def __init__(
122
- self,
123
- transformer,
124
- scheduler,
125
- vae=None,
126
- id2label=None,
127
- prediction_type="sample",
128
- t_eps=5e-2,
129
- solver="heun",
130
- ):
131
- super().__init__()
132
- if scheduler is None or isinstance(scheduler, list):
133
- scheduler = _new_flow_scheduler(solver)
134
- self.register_modules(
135
- transformer=transformer,
136
- scheduler=scheduler,
137
- vae=vae,
138
- )
139
- self.prediction_type = prediction_type
140
- self.t_eps = t_eps
141
- self.solver = solver
142
- self._id2label = self._normalize_id2label(id2label)
143
- self.labels = self._build_label2id(self._id2label)
144
- self._labels_loaded_from_model_index = bool(self._id2label)
145
-
146
- @classmethod
147
- def from_pretrained(cls, pretrained_model_name_or_path=None, subfolder=None, **kwargs):
148
- repo_root = Path(__file__).resolve().parent
149
-
150
- if pretrained_model_name_or_path in (None, "", "."):
151
- variant = repo_root
152
- else:
153
- variant = Path(pretrained_model_name_or_path)
154
- if not variant.is_absolute():
155
- candidate = (Path.cwd() / variant).resolve()
156
- variant = candidate if candidate.exists() else (repo_root / variant).resolve()
157
- if subfolder:
158
- variant = variant / subfolder
159
-
160
- model_kwargs = dict(kwargs)
161
- inserted: List[str] = []
162
-
163
- def _load_transformer():
164
- comp_dir = variant / "transformer"
165
- module_path = comp_dir / "transformer_jlt.py"
166
- if not module_path.exists() or not (comp_dir / "config.json").exists():
167
- return None
168
-
169
- comp_path = str(comp_dir)
170
- if comp_path not in sys.path:
171
- sys.path.insert(0, comp_path)
172
- inserted.append(comp_path)
173
-
174
- module = importlib.import_module("transformer_jlt")
175
- transformer_cls = getattr(module, "JLTTransformer2DModel")
176
- return transformer_cls.from_pretrained(str(comp_dir), **model_kwargs)
177
-
178
- def _load_scheduler():
179
- scheduler_dir = variant / "scheduler"
180
- config_path = scheduler_dir / "scheduler_config.json"
181
- if not config_path.exists():
182
- return _new_flow_scheduler("heun")
183
-
184
- scheduler_entry = None
185
- model_index_path = variant / "model_index.json"
186
- if model_index_path.exists():
187
- scheduler_entry = json.loads(model_index_path.read_text(encoding="utf-8")).get("scheduler")
188
-
189
- if scheduler_entry is None:
190
- class_name = json.loads(config_path.read_text(encoding="utf-8")).get("_class_name")
191
- scheduler_entry = ["diffusers", class_name]
192
-
193
- module_name, class_name = scheduler_entry
194
- if module_name == "diffusers":
195
- import diffusers.schedulers as schedulers_pkg
196
-
197
- scheduler_cls = getattr(schedulers_pkg, class_name)
198
- return scheduler_cls.from_pretrained(str(scheduler_dir), **model_kwargs)
199
-
200
- comp_path = str(scheduler_dir)
201
- if comp_path not in sys.path:
202
- sys.path.insert(0, comp_path)
203
- inserted.append(comp_path)
204
- module = importlib.import_module(module_name)
205
- scheduler_cls = getattr(module, class_name)
206
- return scheduler_cls.from_pretrained(str(scheduler_dir), **model_kwargs)
207
-
208
- def _load_vae():
209
- vae_dir = variant / "vae"
210
- if vae_dir.exists() and (vae_dir / "config.json").exists():
211
- return AutoencoderKLFlux2.from_pretrained(str(vae_dir), **model_kwargs)
212
- return None
213
-
214
- try:
215
- transformer = _load_transformer()
216
- if transformer is None:
217
- raise ValueError(f"No loadable transformer found under {variant}")
218
-
219
- scheduler = _load_scheduler()
220
- vae = _load_vae()
221
- id2label = cls._read_id2label_from_model_index(str(variant))
222
- solver = _solver_from_scheduler(scheduler)
223
- pipe = cls(
224
- transformer=transformer,
225
- scheduler=scheduler,
226
- vae=vae,
227
- id2label=id2label or None,
228
- solver=solver,
229
- )
230
- if hasattr(pipe, "register_to_config"):
231
- pipe.register_to_config(_name_or_path=str(variant))
232
- return pipe
233
- finally:
234
- for comp_path in inserted:
235
- if comp_path in sys.path:
236
- sys.path.remove(comp_path)
237
-
238
- @staticmethod
239
- def _normalize_id2label(id2label: Optional[Dict[Union[int, str], str]]) -> Dict[int, str]:
240
- if not id2label:
241
- return {}
242
- return {int(key): value for key, value in id2label.items()}
243
-
244
- @staticmethod
245
- def _read_id2label_from_model_index(variant_path: Optional[str]) -> Dict[int, str]:
246
- if not variant_path:
247
- return {}
248
- model_index_path = Path(variant_path).resolve() / "model_index.json"
249
- if not model_index_path.exists():
250
- return {}
251
- raw = json.loads(model_index_path.read_text(encoding="utf-8"))
252
- id2label = raw.get("id2label")
253
- if not isinstance(id2label, dict):
254
- return {}
255
- return {int(key): value for key, value in id2label.items()}
256
-
257
- @staticmethod
258
- def _build_label2id(id2label: Dict[int, str]) -> Dict[str, int]:
259
- label2id: Dict[str, int] = {}
260
- for class_id, value in id2label.items():
261
- for synonym in value.split(","):
262
- synonym = synonym.strip()
263
- if synonym:
264
- label2id[synonym] = int(class_id)
265
- return dict(sorted(label2id.items()))
266
-
267
- def _ensure_labels_loaded(self) -> None:
268
- if self._labels_loaded_from_model_index:
269
- return
270
- loaded = self._read_id2label_from_model_index(getattr(self.config, "_name_or_path", None))
271
- if loaded:
272
- self._id2label = loaded
273
- self.labels = self._build_label2id(self._id2label)
274
- self._labels_loaded_from_model_index = True
275
-
276
- @property
277
- def id2label(self) -> Dict[int, str]:
278
- self._ensure_labels_loaded()
279
- return self._id2label
280
-
281
- def get_label_ids(self, label: Union[str, List[str]]) -> List[int]:
282
- self._ensure_labels_loaded()
283
- if not self.labels:
284
- raise ValueError("No labels loaded. Ensure `id2label` exists in model_index.json.")
285
- if isinstance(label, str):
286
- label = [label]
287
- missing = [item for item in label if item not in self.labels]
288
- if missing:
289
- preview = ", ".join(list(self.labels.keys())[:8])
290
- raise ValueError(f"Unknown label(s): {missing}. Examples: {preview}, ...")
291
- return [self.labels[item] for item in label]
292
-
293
- def _normalize_class_labels(self, class_labels: Union[int, str, List[Union[int, str]]]) -> List[int]:
294
- if isinstance(class_labels, int):
295
- return [class_labels]
296
- if isinstance(class_labels, str):
297
- return self.get_label_ids(class_labels)
298
- if class_labels and isinstance(class_labels[0], str):
299
- return self.get_label_ids(class_labels)
300
- return list(class_labels)
301
-
302
- def _sampling_dtype(self) -> torch.dtype:
303
- model_dtype = self.transformer.dtype
304
- if model_dtype in (torch.bfloat16, torch.float16):
305
- return torch.float32
306
- return model_dtype
307
-
308
- def _predict_velocity_at_t(
309
- self,
310
- z_value: torch.Tensor,
311
- t_jlt: Union[float, torch.Tensor],
312
- class_labels: torch.Tensor,
313
- class_null: torch.Tensor,
314
- do_classifier_free_guidance: bool,
315
- guidance_scale: float,
316
- guidance_interval_min: float,
317
- guidance_interval_max: float,
318
- ) -> torch.Tensor:
319
- t_jlt = torch.as_tensor(t_jlt, device=z_value.device, dtype=z_value.dtype)
320
- if t_jlt.ndim == 0:
321
- t_jlt = t_jlt.reshape(1)
322
-
323
- if do_classifier_free_guidance:
324
- z_in = torch.cat([z_value, z_value], dim=0)
325
- labels = torch.cat([class_labels, class_null], dim=0)
326
- else:
327
- z_in = z_value
328
- labels = class_labels
329
-
330
- t_batch = t_jlt.flatten().expand(z_in.shape[0])
331
- model_dtype = self.transformer.dtype
332
- use_autocast = model_dtype != torch.float32 and z_value.is_cuda
333
- if use_autocast:
334
- with torch.autocast(device_type=z_value.device.type, dtype=model_dtype):
335
- model_out = self.transformer(
336
- z_in.to(model_dtype),
337
- timestep=t_batch,
338
- class_labels=labels,
339
- ).sample
340
- else:
341
- model_out = self.transformer(z_in, timestep=t_batch, class_labels=labels).sample
342
-
343
- v = velocity_from_prediction(
344
- z_in,
345
- model_out.to(z_value.dtype),
346
- t_jlt,
347
- prediction_type=self.prediction_type,
348
- t_eps=self.t_eps,
349
- )
350
-
351
- if not do_classifier_free_guidance:
352
- return v
353
-
354
- v_cond, v_uncond = v.chunk(2, dim=0)
355
- interval_mask = t_jlt < guidance_interval_max
356
- if guidance_interval_min != 0.0:
357
- interval_mask = interval_mask & (t_jlt > guidance_interval_min)
358
- scale = torch.where(
359
- interval_mask,
360
- torch.tensor(guidance_scale, device=z_value.device, dtype=z_value.dtype),
361
- torch.tensor(1.0, device=z_value.device, dtype=z_value.dtype),
362
- )
363
- return v_uncond + scale * (v_cond - v_uncond)
364
-
365
- def _euler_step(
366
- self,
367
- latents: torch.Tensor,
368
- t_cur: torch.Tensor,
369
- t_next: torch.Tensor,
370
- class_labels: torch.Tensor,
371
- class_null: torch.Tensor,
372
- do_classifier_free_guidance: bool,
373
- guidance_scale: float,
374
- guidance_interval_min: float,
375
- guidance_interval_max: float,
376
- ) -> torch.Tensor:
377
- dt = t_next - t_cur
378
- velocity = self._predict_velocity_at_t(
379
- latents,
380
- t_cur,
381
- class_labels,
382
- class_null,
383
- do_classifier_free_guidance,
384
- guidance_scale,
385
- guidance_interval_min,
386
- guidance_interval_max,
387
- )
388
- return latents + dt * velocity
389
-
390
- def _heun_step(
391
- self,
392
- latents: torch.Tensor,
393
- t_cur: torch.Tensor,
394
- t_next: torch.Tensor,
395
- class_labels: torch.Tensor,
396
- class_null: torch.Tensor,
397
- do_classifier_free_guidance: bool,
398
- guidance_scale: float,
399
- guidance_interval_min: float,
400
- guidance_interval_max: float,
401
- ) -> torch.Tensor:
402
- dt = t_next - t_cur
403
- velocity_1 = self._predict_velocity_at_t(
404
- latents,
405
- t_cur,
406
- class_labels,
407
- class_null,
408
- do_classifier_free_guidance,
409
- guidance_scale,
410
- guidance_interval_min,
411
- guidance_interval_max,
412
- )
413
- velocity_2 = self._predict_velocity_at_t(
414
- latents + dt * velocity_1,
415
- t_next,
416
- class_labels,
417
- class_null,
418
- do_classifier_free_guidance,
419
- guidance_scale,
420
- guidance_interval_min,
421
- guidance_interval_max,
422
- )
423
- return latents + dt * 0.5 * (velocity_1 + velocity_2)
424
-
425
- def _run_sampler(
426
- self,
427
- latents: torch.Tensor,
428
- class_labels: torch.Tensor,
429
- class_null: torch.Tensor,
430
- num_inference_steps: int,
431
- do_classifier_free_guidance: bool,
432
- guidance_scale: float,
433
- guidance_interval_min: float,
434
- guidance_interval_max: float,
435
- ) -> torch.Tensor:
436
- solver = self.solver
437
- if solver not in _FLOW_SCHEDULERS:
438
- raise ValueError("pipeline solver must be one of: 'heun', 'euler'.")
439
-
440
- device = latents.device
441
- dtype = self._sampling_dtype()
442
- latents = latents.to(dtype=dtype)
443
- ts = torch.linspace(0.0, 1.0, num_inference_steps + 1, device=device, dtype=dtype)
444
- step_kwargs = (
445
- class_labels,
446
- class_null,
447
- do_classifier_free_guidance,
448
- guidance_scale,
449
- guidance_interval_min,
450
- guidance_interval_max,
451
- )
452
-
453
- if solver == "heun":
454
- for step_idx in self.progress_bar(range(num_inference_steps - 1)):
455
- latents = self._heun_step(latents, ts[step_idx], ts[step_idx + 1], *step_kwargs)
456
- latents = self._euler_step(latents, ts[-2], ts[-1], *step_kwargs)
457
- return latents
458
-
459
- for step_idx in self.progress_bar(range(num_inference_steps)):
460
- latents = self._euler_step(latents, ts[step_idx], ts[step_idx + 1], *step_kwargs)
461
- return latents
462
-
463
- @torch.inference_mode()
464
- def __call__(
465
- self,
466
- class_labels: Union[int, str, List[Union[int, str]]],
467
- guidance_scale: Optional[float] = None,
468
- guidance_interval_min: float = 0.1,
469
- guidance_interval_max: float = 1.0,
470
- noise_scale: float = 1.0,
471
- t_eps: Optional[float] = None,
472
- generator: Optional[Union[torch.Generator, List[torch.Generator]]] = None,
473
- num_inference_steps: int = 50,
474
- output_type: Optional[str] = "pil",
475
- return_dict: bool = True,
476
- ) -> Union[ImagePipelineOutput, Tuple]:
477
- if num_inference_steps < 2:
478
- raise ValueError("num_inference_steps must be >= 2.")
479
- if output_type not in {"pil", "np", "pt", "latent"}:
480
- raise ValueError("output_type must be one of: 'pil', 'np', 'pt', 'latent'.")
481
-
482
- if t_eps is not None:
483
- self.t_eps = t_eps
484
-
485
- class_label_ids = self._normalize_class_labels(class_labels)
486
- do_classifier_free_guidance = guidance_scale is not None and guidance_scale > 1.0
487
-
488
- batch_size = len(class_label_ids)
489
- latent_size = int(self.transformer.config.sample_size)
490
- channels = int(self.transformer.config.in_channels)
491
- null_class_val = int(
492
- getattr(self.transformer.config, "num_classes", getattr(self.transformer.config, "num_class_embeds", 1000))
493
- )
494
-
495
- if guidance_scale is None:
496
- guidance_scale = 1.0
497
-
498
- latents = randn_tensor(
499
- shape=(batch_size, channels, latent_size, latent_size),
500
- generator=generator,
501
- device=self._execution_device,
502
- dtype=self._sampling_dtype(),
503
- ) * noise_scale
504
-
505
- class_labels_t = torch.tensor(class_label_ids, device=self._execution_device, dtype=torch.long).reshape(-1)
506
- class_labels_t = class_labels_t.clamp(0, null_class_val - 1)
507
- class_null = torch.full_like(class_labels_t, null_class_val)
508
-
509
- latents = self._run_sampler(
510
- latents,
511
- class_labels_t,
512
- class_null,
513
- num_inference_steps,
514
- do_classifier_free_guidance,
515
- guidance_scale,
516
- guidance_interval_min,
517
- guidance_interval_max,
518
- )
519
-
520
- if output_type == "latent":
521
- if not return_dict:
522
- return (latents,)
523
- return ImagePipelineOutput(images=latents)
524
-
525
- if self.vae is not None:
526
- images_pt = decode_flux2_latents(self.vae, latents)
527
- else:
528
- images_pt = latents
529
-
530
- if not torch.isfinite(images_pt).all():
531
- raise RuntimeError(
532
- "JLT generation produced non-finite values before image conversion. "
533
- "Restart the notebook kernel and re-run the pipeline load cell."
534
- )
535
-
536
- images_pt = ((images_pt.float().clamp(-1, 1) + 1.0) / 2.0).cpu()
537
- if output_type == "pt":
538
- images = images_pt
539
- elif output_type == "np":
540
- images = images_pt.permute(0, 2, 3, 1).numpy()
541
- else:
542
- images = self.numpy_to_pil(images_pt.permute(0, 2, 3, 1).numpy())
543
-
544
- self.maybe_free_model_hooks()
545
-
546
- if not return_dict:
547
- return (images,)
548
- return ImagePipelineOutput(images=images)
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
JLT-B-1-256/scheduler/scheduler_config.json DELETED
@@ -1,6 +0,0 @@
1
- {
2
- "_class_name": "FlowMatchHeunDiscreteScheduler",
3
- "_diffusers_version": "0.38.0",
4
- "num_train_timesteps": 1000,
5
- "shift": 4.0
6
- }
 
 
 
 
 
 
 
JLT-B-1-256/transformer/config.json DELETED
@@ -1,21 +0,0 @@
1
- {
2
- "_class_name": "JLTTransformer2DModel",
3
- "_diffusers_version": "0.38.0",
4
- "attention_dropout": 0.0,
5
- "dropout": 0.0,
6
- "hidden_size": 768,
7
- "in_channels": 128,
8
- "loop_count": 0,
9
- "loop_indices": null,
10
- "mask_prob": 0.0,
11
- "mask_ratio": 0.0,
12
- "mlp_ratio": 4.0,
13
- "model_type": "JiT-B/1",
14
- "norm_eps": 1e-06,
15
- "num_attention_heads": 12,
16
- "num_class_embeds": null,
17
- "num_classes": 1000,
18
- "num_layers": 12,
19
- "patch_size": 1,
20
- "sample_size": 16
21
- }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
JLT-B-1-256/transformer/diffusion_pytorch_model.safetensors DELETED
@@ -1,3 +0,0 @@
1
- version https://git-lfs.github.com/spec/v1
2
- oid sha256:6bdf942f527a03aca3d5e9b07d94656cec350e9c45fbfcbc4c49e9b098f45e62
3
- size 522055144
 
 
 
 
JLT-B-1-256/transformer/transformer_jlt.py DELETED
@@ -1,639 +0,0 @@
1
- """JLT (Clean-Latent) Transformer for diffusers."""
2
-
3
- from __future__ import annotations
4
-
5
- import argparse
6
- import math
7
- from collections.abc import Mapping
8
- from typing import Dict, List, Optional, Tuple
9
-
10
- import torch
11
- import torch.nn as nn
12
- import torch.nn.functional as F
13
- from diffusers.configuration_utils import ConfigMixin, register_to_config
14
- from diffusers.models.modeling_outputs import Transformer2DModelOutput
15
- from diffusers.models.modeling_utils import ModelMixin
16
- from diffusers.models.normalization import RMSNorm
17
- from einops import rearrange, repeat
18
-
19
- try:
20
- from flash_attn.cute import flash_attn_func as _flash_attn_func
21
-
22
- _HAS_FLASH_ATTN = True
23
- except ImportError:
24
- _HAS_FLASH_ATTN = False
25
-
26
-
27
- JLT_PRESET_CONFIGS: Dict[str, Dict[str, object]] = {
28
- "JiT-B/1": {
29
- "sample_size": 16,
30
- "patch_size": 1,
31
- "hidden_size": 768,
32
- "num_layers": 12,
33
- "num_attention_heads": 12,
34
- "attention_dropout": 0.0,
35
- "dropout": 0.0,
36
- },
37
- "JiT-B/2": {
38
- "sample_size": 16,
39
- "patch_size": 2,
40
- "hidden_size": 768,
41
- "num_layers": 12,
42
- "num_attention_heads": 12,
43
- "attention_dropout": 0.0,
44
- "dropout": 0.0,
45
- },
46
- "JiT-B/16": {
47
- "sample_size": 256,
48
- "patch_size": 16,
49
- "hidden_size": 768,
50
- "num_layers": 12,
51
- "num_attention_heads": 12,
52
- "attention_dropout": 0.0,
53
- "dropout": 0.0,
54
- },
55
- "JiT-B/32": {
56
- "sample_size": 512,
57
- "patch_size": 32,
58
- "hidden_size": 768,
59
- "num_layers": 12,
60
- "num_attention_heads": 12,
61
- "attention_dropout": 0.0,
62
- "dropout": 0.0,
63
- },
64
- "JiT-L/16": {
65
- "sample_size": 256,
66
- "patch_size": 16,
67
- "hidden_size": 1024,
68
- "num_layers": 24,
69
- "num_attention_heads": 16,
70
- "attention_dropout": 0.0,
71
- "dropout": 0.0,
72
- },
73
- "JiT-L/32": {
74
- "sample_size": 512,
75
- "patch_size": 32,
76
- "hidden_size": 1024,
77
- "num_layers": 24,
78
- "num_attention_heads": 16,
79
- "attention_dropout": 0.0,
80
- "dropout": 0.0,
81
- },
82
- "JiT-H/16": {
83
- "sample_size": 256,
84
- "patch_size": 16,
85
- "hidden_size": 1280,
86
- "num_layers": 32,
87
- "num_attention_heads": 16,
88
- "attention_dropout": 0.0,
89
- "dropout": 0.2,
90
- },
91
- "JiT-H/32": {
92
- "sample_size": 512,
93
- "patch_size": 32,
94
- "hidden_size": 1280,
95
- "num_layers": 32,
96
- "num_attention_heads": 16,
97
- "attention_dropout": 0.0,
98
- "dropout": 0.2,
99
- },
100
- }
101
-
102
-
103
- def remap_legacy_state_dict(state_dict: Dict[str, torch.Tensor]) -> Dict[str, torch.Tensor]:
104
- """Map legacy JLT/Denoiser checkpoint keys to native transformer keys."""
105
- remapped: Dict[str, torch.Tensor] = {}
106
- for key, value in state_dict.items():
107
- new_key = key
108
- for prefix in ("transformer.", "net."):
109
- if new_key.startswith(prefix):
110
- new_key = new_key[len(prefix) :]
111
- break
112
-
113
- if new_key.startswith("final_layer."):
114
- new_key = new_key.replace("final_layer.norm_final", "norm_final")
115
- new_key = new_key.replace("final_layer.linear", "linear_final")
116
- new_key = new_key.replace("final_layer.adaLN_modulation", "adaLN_modulation_final")
117
-
118
- remapped[new_key] = value
119
- return remapped
120
-
121
-
122
- def config_from_legacy(config: Dict[str, object]) -> Dict[str, object]:
123
- model_type = config.get("model_type") or config.get("model") or config.get("model_name")
124
- if model_type not in JLT_PRESET_CONFIGS:
125
- raise ValueError(f"Unknown JLT preset '{model_type}'. Known: {list(JLT_PRESET_CONFIGS)}")
126
-
127
- preset = dict(JLT_PRESET_CONFIGS[model_type])
128
- preset["num_classes"] = int(config.get("num_class_embeds") or config.get("num_classes") or config.get("class_num") or 1000)
129
- if config.get("attn_dropout") is not None:
130
- preset["attention_dropout"] = float(config["attn_dropout"])
131
- if config.get("proj_dropout") is not None:
132
- preset["dropout"] = float(config["proj_dropout"])
133
- if config.get("sample_size") is not None:
134
- preset["sample_size"] = int(config["sample_size"])
135
- if config.get("img_size") is not None and config.get("patch_size") is not None:
136
- preset["sample_size"] = int(config["img_size"]) // int(config.get("spatial_compression", 16))
137
- preset["model_type"] = model_type
138
- return preset
139
-
140
-
141
- def broadcat(tensors, dim=-1):
142
- num_tensors = len(tensors)
143
- shape_lens = {len(t.shape) for t in tensors}
144
- if len(shape_lens) != 1:
145
- raise ValueError("tensors must all have the same number of dimensions")
146
- shape_len = list(shape_lens)[0]
147
- dim = (dim + shape_len) if dim < 0 else dim
148
- dims = list(zip(*(list(t.shape) for t in tensors)))
149
- expandable_dims = [(i, val) for i, val in enumerate(dims) if i != dim]
150
- if not all(len(set(t[1])) <= 2 for t in expandable_dims):
151
- raise ValueError("invalid dimensions for broadcastable concatenation")
152
- max_dims = [(t[0], max(t[1])) for t in expandable_dims]
153
- expanded_dims = [(t[0], (t[1],) * num_tensors) for t in max_dims]
154
- expanded_dims.insert(dim, (dim, dims[dim]))
155
- expandable_shapes = list(zip(*(t[1] for t in expanded_dims)))
156
- tensors = [t[0].expand(*t[1]) for t in zip(tensors, expandable_shapes)]
157
- return torch.cat(tensors, dim=dim)
158
-
159
-
160
- def rotate_half(x):
161
- x = rearrange(x, "... (d r) -> ... d r", r=2)
162
- x1, x2 = x.unbind(dim=-1)
163
- x = torch.stack((-x2, x1), dim=-1)
164
- return rearrange(x, "... d r -> ... (d r)")
165
-
166
-
167
- class JLTRotaryEmbedding(nn.Module):
168
- def __init__(self, dim, pt_seq_len=16, ft_seq_len=None, theta=10000, num_cls_token=0):
169
- super().__init__()
170
- freqs = 1.0 / (theta ** (torch.arange(0, dim, 2)[: (dim // 2)].float() / dim))
171
- if ft_seq_len is None:
172
- ft_seq_len = pt_seq_len
173
- t = torch.arange(ft_seq_len) / ft_seq_len * pt_seq_len
174
-
175
- freqs = torch.einsum("..., f -> ... f", t, freqs)
176
- freqs = repeat(freqs, "... n -> ... (n r)", r=2)
177
- freqs = broadcat((freqs[:, None, :], freqs[None, :, :]), dim=-1)
178
-
179
- if num_cls_token > 0:
180
- freqs_flat = freqs.view(-1, freqs.shape[-1])
181
- cos_img = freqs_flat.cos()
182
- sin_img = freqs_flat.sin()
183
- _, dim_freq = cos_img.shape
184
- cos_pad = torch.ones(num_cls_token, dim_freq, dtype=cos_img.dtype)
185
- sin_pad = torch.zeros(num_cls_token, dim_freq, dtype=sin_img.dtype)
186
- self.register_buffer("freqs_cos", torch.cat([cos_pad, cos_img], dim=0), persistent=False)
187
- self.register_buffer("freqs_sin", torch.cat([sin_pad, sin_img], dim=0), persistent=False)
188
- else:
189
- self.register_buffer("freqs_cos", freqs.cos().view(-1, freqs.shape[-1]), persistent=False)
190
- self.register_buffer("freqs_sin", freqs.sin().view(-1, freqs.shape[-1]), persistent=False)
191
-
192
- def forward(self, tensor):
193
- seq_len = tensor.shape[1] if tensor.ndim == 4 else tensor.shape[-2]
194
- fc = self.freqs_cos[:seq_len].to(device=tensor.device, dtype=tensor.dtype)
195
- fs = self.freqs_sin[:seq_len].to(device=tensor.device, dtype=tensor.dtype)
196
- if tensor.ndim == 4:
197
- return tensor * fc[:, None, :] + rotate_half(tensor) * fs[:, None, :]
198
- return tensor * fc + rotate_half(tensor) * fs
199
-
200
-
201
- def modulate(x, shift, scale):
202
- if shift.ndim == x.ndim - 1:
203
- shift = shift.unsqueeze(1)
204
- scale = scale.unsqueeze(1)
205
- return x * (1 + scale) + shift
206
-
207
-
208
- class JLTPatchEmbed(nn.Module):
209
- def __init__(self, img_size=224, patch_size=16, in_chans=3, embed_dim=768, bias=True):
210
- super().__init__()
211
- img_size = (img_size, img_size)
212
- patch_size = (patch_size, patch_size)
213
- self.img_size = img_size
214
- self.patch_size = patch_size
215
- self.num_patches = (img_size[1] // patch_size[1]) * (img_size[0] // patch_size[0])
216
- self.proj = nn.Conv2d(in_chans, embed_dim, kernel_size=patch_size, stride=patch_size, bias=bias)
217
-
218
- def forward(self, x):
219
- batch, _, height, width = x.shape
220
- if height != self.img_size[0] or width != self.img_size[1]:
221
- raise ValueError(
222
- f"Input image size ({height}*{width}) doesn't match model ({self.img_size[0]}*{self.img_size[1]})."
223
- )
224
- return self.proj(x).flatten(2).transpose(1, 2)
225
-
226
-
227
- class JLTTimestepEmbedder(nn.Module):
228
- def __init__(self, hidden_size, frequency_embedding_size=256):
229
- super().__init__()
230
- self.mlp = nn.Sequential(
231
- nn.Linear(frequency_embedding_size, hidden_size, bias=True),
232
- nn.SiLU(),
233
- nn.Linear(hidden_size, hidden_size, bias=True),
234
- )
235
- self.frequency_embedding_size = frequency_embedding_size
236
-
237
- @staticmethod
238
- def timestep_embedding(t, dim, max_period=10000):
239
- half = dim // 2
240
- freqs = torch.exp(
241
- -math.log(max_period) * torch.arange(start=0, end=half, dtype=torch.float32, device=t.device) / half
242
- )
243
- args = t.float().unsqueeze(-1) * freqs
244
- embedding = torch.cat([torch.cos(args), torch.sin(args)], dim=-1)
245
- if dim % 2:
246
- embedding = torch.cat([embedding, torch.zeros_like(embedding[..., :1])], dim=-1)
247
- return embedding.to(t.dtype)
248
-
249
- def forward(self, t, dtype=None):
250
- t_freq = self.timestep_embedding(t, self.frequency_embedding_size)
251
- if dtype is not None:
252
- t_freq = t_freq.to(dtype=dtype)
253
- return self.mlp(t_freq)
254
-
255
-
256
- class JLTLabelEmbedder(nn.Module):
257
- def __init__(self, num_classes, hidden_size):
258
- super().__init__()
259
- self.embedding_table = nn.Embedding(num_classes + 1, hidden_size)
260
- self.num_classes = num_classes
261
-
262
- def forward(self, labels):
263
- return self.embedding_table(labels)
264
-
265
-
266
- class JLTAttention(nn.Module):
267
- def __init__(self, dim, num_heads=8, qkv_bias=True, qk_norm=True, attn_drop=0.0, proj_drop=0.0, eps=1e-6):
268
- super().__init__()
269
- self.num_heads = num_heads
270
- head_dim = dim // num_heads
271
- self.q_norm = RMSNorm(head_dim, eps=eps) if qk_norm else nn.Identity()
272
- self.k_norm = RMSNorm(head_dim, eps=eps) if qk_norm else nn.Identity()
273
- self.qkv = nn.Linear(dim, dim * 3, bias=qkv_bias)
274
- self.attn_drop = attn_drop
275
- self.proj = nn.Linear(dim, dim)
276
- self.proj_drop = nn.Dropout(proj_drop)
277
-
278
- def forward(self, x, rope=None):
279
- batch, num_tokens, channels = x.shape
280
- qkv = self.qkv(x).reshape(batch, num_tokens, 3, self.num_heads, channels // self.num_heads).permute(2, 0, 3, 1, 4)
281
- q, k, v = qkv[0], qkv[1], qkv[2]
282
- q = self.q_norm(q)
283
- k = self.k_norm(k)
284
- if rope is not None:
285
- q = q.transpose(1, 2)
286
- k = k.transpose(1, 2)
287
- q = rope(q)
288
- k = rope(k)
289
- q = q.transpose(1, 2)
290
- k = k.transpose(1, 2)
291
-
292
- if _HAS_FLASH_ATTN:
293
- attn_dtype = q.dtype if q.dtype in (torch.float16, torch.bfloat16) else torch.bfloat16
294
- q = q.transpose(1, 2).contiguous().to(attn_dtype)
295
- k = k.transpose(1, 2).contiguous().to(attn_dtype)
296
- v = v.transpose(1, 2).contiguous().to(attn_dtype)
297
- x, _ = _flash_attn_func(q, k, v, causal=False)
298
- x = x.reshape(batch, num_tokens, channels)
299
- else:
300
- dropout_p = self.attn_drop if self.training else 0.0
301
- x = F.scaled_dot_product_attention(q, k, v, dropout_p=dropout_p)
302
- x = x.transpose(1, 2).reshape(batch, num_tokens, channels)
303
-
304
- x = self.proj(x)
305
- return self.proj_drop(x)
306
-
307
-
308
- class JLTSwiGLUFFN(nn.Module):
309
- def __init__(self, dim: int, hidden_dim: int, drop=0.0, bias=True) -> None:
310
- super().__init__()
311
- hidden_dim = int(hidden_dim * 2 / 3)
312
- self.w12 = nn.Linear(dim, 2 * hidden_dim, bias=bias)
313
- self.w3 = nn.Linear(hidden_dim, dim, bias=bias)
314
- self.ffn_dropout = nn.Dropout(drop)
315
-
316
- def forward(self, x):
317
- x12 = self.w12(x)
318
- x1, x2 = x12.chunk(2, dim=-1)
319
- return self.w3(self.ffn_dropout(F.silu(x1) * x2))
320
-
321
-
322
- class JLTBlock(nn.Module):
323
- def __init__(self, hidden_size, num_heads, mlp_ratio=4.0, attn_drop=0.0, proj_drop=0.0, eps=1e-6):
324
- super().__init__()
325
- self.norm1 = RMSNorm(hidden_size, eps=eps)
326
- self.attn = JLTAttention(
327
- hidden_size,
328
- num_heads=num_heads,
329
- qkv_bias=True,
330
- qk_norm=True,
331
- attn_drop=attn_drop,
332
- proj_drop=proj_drop,
333
- eps=eps,
334
- )
335
- self.norm2 = RMSNorm(hidden_size, eps=eps)
336
- self.mlp = JLTSwiGLUFFN(hidden_size, int(hidden_size * mlp_ratio), drop=proj_drop)
337
- self.adaLN_modulation = nn.Sequential(
338
- nn.SiLU(),
339
- nn.Linear(hidden_size, 6 * hidden_size, bias=True),
340
- )
341
-
342
- def forward(self, x, c, feat_rope=None):
343
- shift_msa, scale_msa, gate_msa, shift_mlp, scale_mlp, gate_mlp = self.adaLN_modulation(c).chunk(6, dim=-1)
344
- if gate_msa.ndim == x.ndim - 1:
345
- gate_msa = gate_msa.unsqueeze(1)
346
- gate_mlp = gate_mlp.unsqueeze(1)
347
- x = x + gate_msa * self.attn(modulate(self.norm1(x), shift_msa, scale_msa), rope=feat_rope)
348
- x = x + gate_mlp * self.mlp(modulate(self.norm2(x), shift_mlp, scale_mlp))
349
- return x
350
-
351
-
352
- class JLTTransformer2DModel(ModelMixin, ConfigMixin):
353
- _supports_gradient_checkpointing = True
354
-
355
- @register_to_config
356
- def __init__(
357
- self,
358
- sample_size: int = 16,
359
- patch_size: int = 1,
360
- in_channels: int = 128,
361
- hidden_size: int = 768,
362
- num_layers: int = 12,
363
- num_attention_heads: int = 12,
364
- mlp_ratio: float = 4.0,
365
- attention_dropout: float = 0.0,
366
- dropout: float = 0.0,
367
- num_classes: int = 1000,
368
- norm_eps: float = 1e-6,
369
- model_type: str | None = None,
370
- num_class_embeds: int | None = None,
371
- mask_prob: float = 0.0,
372
- mask_ratio: float = 0.0,
373
- loop_indices: Optional[List[int]] = None,
374
- loop_count: int = 0,
375
- ):
376
- super().__init__()
377
- if num_class_embeds is not None:
378
- num_classes = int(num_class_embeds)
379
- if model_type in JLT_PRESET_CONFIGS:
380
- preset = JLT_PRESET_CONFIGS[model_type]
381
- sample_size = int(preset["sample_size"])
382
- patch_size = int(preset["patch_size"])
383
- hidden_size = int(preset["hidden_size"])
384
- num_layers = int(preset["num_layers"])
385
- num_attention_heads = int(preset["num_attention_heads"])
386
- if attention_dropout == 0.0:
387
- attention_dropout = float(preset["attention_dropout"])
388
- if dropout == 0.0:
389
- dropout = float(preset["dropout"])
390
-
391
- self.sample_size = sample_size
392
- self.patch_size = patch_size
393
- self.in_channels = in_channels
394
- self.out_channels = in_channels
395
- self.hidden_size = hidden_size
396
- self.num_layers = num_layers
397
- self.num_attention_heads = num_attention_heads
398
- self.mask_prob = float(mask_prob)
399
- self.mask_ratio = float(mask_ratio)
400
- self.loop_count = int(loop_count)
401
- self.gradient_checkpointing = False
402
-
403
- self.mask_token = nn.Parameter(torch.zeros(1, 1, hidden_size))
404
- nn.init.normal_(self.mask_token, std=0.02)
405
-
406
- self.loop_indices: Optional[Tuple[int, ...]] = None
407
- if loop_indices and self.loop_count > 0:
408
- sorted_idx = sorted(int(x) for x in loop_indices)
409
- if len(set(sorted_idx)) != len(sorted_idx):
410
- raise ValueError(f"loop_indices must be unique, got {loop_indices}.")
411
- for i in range(1, len(sorted_idx)):
412
- if sorted_idx[i] != sorted_idx[i - 1] + 1:
413
- raise ValueError(f"loop_indices must be consecutive integers, got {sorted_idx}.")
414
- if sorted_idx[0] < 0 or sorted_idx[-1] >= num_layers:
415
- raise ValueError(f"loop_indices must lie in [0, {num_layers}), got {sorted_idx}.")
416
- self.loop_indices = tuple(sorted_idx)
417
-
418
- self.t_embedder = JLTTimestepEmbedder(hidden_size)
419
- self.y_embedder = JLTLabelEmbedder(num_classes, hidden_size)
420
- self.x_embedder = JLTPatchEmbed(sample_size, patch_size, in_channels, hidden_size, bias=True)
421
-
422
- half_head_dim = hidden_size // num_attention_heads // 2
423
- hw_seq_len = sample_size // patch_size
424
- self.feat_rope = JLTRotaryEmbedding(dim=half_head_dim, pt_seq_len=hw_seq_len, num_cls_token=0)
425
-
426
- self.blocks = nn.ModuleList(
427
- [
428
- JLTBlock(
429
- hidden_size,
430
- num_attention_heads,
431
- mlp_ratio=mlp_ratio,
432
- attn_drop=attention_dropout if (num_layers // 4 * 3 > i >= num_layers // 4) else 0.0,
433
- proj_drop=dropout if (num_layers // 4 * 3 > i >= num_layers // 4) else 0.0,
434
- eps=norm_eps,
435
- )
436
- for i in range(num_layers)
437
- ]
438
- )
439
-
440
- self.norm_final = RMSNorm(hidden_size, eps=norm_eps)
441
- self.linear_final = nn.Linear(hidden_size, patch_size * patch_size * self.out_channels, bias=True)
442
- self.adaLN_modulation_final = nn.Sequential(
443
- nn.SiLU(),
444
- nn.Linear(hidden_size, 2 * hidden_size, bias=True),
445
- )
446
-
447
- self.initialize_weights()
448
-
449
- def initialize_weights(self):
450
- def _basic_init(module):
451
- if isinstance(module, nn.Linear):
452
- torch.nn.init.xavier_uniform_(module.weight)
453
- if module.bias is not None:
454
- nn.init.constant_(module.bias, 0)
455
-
456
- self.apply(_basic_init)
457
-
458
- w = self.x_embedder.proj.weight.data
459
- nn.init.xavier_uniform_(w.view([w.shape[0], -1]))
460
- nn.init.constant_(self.x_embedder.proj.bias, 0)
461
- nn.init.normal_(self.y_embedder.embedding_table.weight, std=0.02)
462
- nn.init.normal_(self.t_embedder.mlp[0].weight, std=0.02)
463
- nn.init.normal_(self.t_embedder.mlp[2].weight, std=0.02)
464
-
465
- for block in self.blocks:
466
- nn.init.constant_(block.adaLN_modulation[-1].weight, 0)
467
- nn.init.constant_(block.adaLN_modulation[-1].bias, 0)
468
-
469
- nn.init.constant_(self.adaLN_modulation_final[-1].weight, 0)
470
- nn.init.constant_(self.adaLN_modulation_final[-1].bias, 0)
471
- nn.init.constant_(self.linear_final.weight, 0)
472
- nn.init.constant_(self.linear_final.bias, 0)
473
-
474
- def _block_schedule(self) -> List[int]:
475
- if self.loop_indices is not None and self.loop_count > 0:
476
- a, b = self.loop_indices[0], self.loop_indices[-1]
477
- return list(range(0, a)) + list(range(a, b + 1)) * self.loop_count + list(range(b + 1, len(self.blocks)))
478
- return list(range(len(self.blocks)))
479
-
480
- def forward(
481
- self,
482
- sample: torch.Tensor,
483
- timestep: torch.Tensor,
484
- class_labels: torch.Tensor,
485
- return_dict: bool = True,
486
- return_features: bool = False,
487
- feature_layers: Optional[List[int]] = None,
488
- ):
489
- t = torch.as_tensor(timestep, device=sample.device)
490
- if t.ndim == 0:
491
- t = t.repeat(sample.shape[0])
492
- elif t.ndim == 1 and t.shape[0] == 1 and sample.shape[0] > 1:
493
- t = t.repeat(sample.shape[0])
494
-
495
- t_emb = self.t_embedder(t, dtype=sample.dtype)
496
- y_emb = self.y_embedder(class_labels).to(dtype=sample.dtype)
497
- if t_emb.ndim == 3:
498
- y_emb = y_emb.unsqueeze(1)
499
- c = t_emb + y_emb
500
-
501
- x = self.x_embedder(sample)
502
- if self.training and self.mask_prob > 0.0 and self.mask_ratio > 0.0:
503
- batch, num_tokens, _ = x.shape
504
- s_mask = torch.rand(batch, device=x.device) < self.mask_prob
505
- t_mask = torch.rand(batch, num_tokens, device=x.device) < self.mask_ratio
506
- mask = (s_mask.unsqueeze(1) & t_mask).unsqueeze(-1)
507
- x = torch.where(mask, self.mask_token.to(x.dtype), x)
508
-
509
- target_layers = set(feature_layers or [])
510
- features = {} if return_features else None
511
-
512
- for layer_idx in self._block_schedule():
513
- if self.training and self.gradient_checkpointing:
514
- x = torch.utils.checkpoint.checkpoint(
515
- self.blocks[layer_idx], x, c, self.feat_rope, use_reentrant=False
516
- )
517
- else:
518
- x = self.blocks[layer_idx](x, c, self.feat_rope)
519
- if return_features and layer_idx in target_layers:
520
- features[layer_idx] = x
521
-
522
- shift, scale = self.adaLN_modulation_final(c).chunk(2, dim=-1)
523
- x = modulate(self.norm_final(x), shift, scale)
524
- x = self.linear_final(x)
525
-
526
- height = width = int(x.shape[1] ** 0.5)
527
- x = x.reshape(x.shape[0], height, width, self.patch_size, self.patch_size, self.out_channels)
528
- x = torch.einsum("nhwpqc->nchpwq", x)
529
- output = x.reshape(x.shape[0], self.out_channels, height * self.patch_size, width * self.patch_size)
530
-
531
- if return_features:
532
- if not return_dict:
533
- return (output, features)
534
- return Transformer2DModelOutput(sample=output), features
535
-
536
- if not return_dict:
537
- return (output,)
538
- return Transformer2DModelOutput(sample=output)
539
-
540
- @classmethod
541
- def from_jlt_checkpoint(
542
- cls,
543
- checkpoint_path: str,
544
- weights: str = "ema1",
545
- map_location: str = "cpu",
546
- strict: bool = True,
547
- in_channels: int | None = None,
548
- ) -> Tuple["JLTTransformer2DModel", Dict[str, object]]:
549
- checkpoint = torch.load(checkpoint_path, map_location=map_location, weights_only=False)
550
- if "args" not in checkpoint:
551
- raise ValueError("Checkpoint is missing 'args', cannot infer JLT architecture config.")
552
-
553
- ckpt_args = checkpoint["args"]
554
- if isinstance(ckpt_args, argparse.Namespace):
555
- args_dict = vars(ckpt_args)
556
- elif isinstance(ckpt_args, Mapping):
557
- args_dict = dict(ckpt_args)
558
- else:
559
- raise TypeError(f"Unsupported checkpoint args type: {type(ckpt_args)}")
560
-
561
- model_type = args_dict.get("model") or args_dict.get("model_name") or args_dict.get("model_type")
562
- if model_type not in JLT_PRESET_CONFIGS:
563
- raise ValueError(f"Unknown JLT preset '{model_type}'.")
564
-
565
- config = dict(JLT_PRESET_CONFIGS[model_type])
566
- config["num_classes"] = int(args_dict.get("class_num") or args_dict.get("num_classes") or 1000)
567
- config["model_type"] = model_type
568
- config["attention_dropout"] = float(
569
- args_dict.get("attn_dropout", args_dict.get("attention_dropout", config["attention_dropout"]))
570
- )
571
- config["dropout"] = float(args_dict.get("proj_dropout", args_dict.get("dropout", config["dropout"])))
572
- if in_channels is not None:
573
- config["in_channels"] = in_channels
574
- elif args_dict.get("vae_type") == "flux2":
575
- config["in_channels"] = 128
576
-
577
- if args_dict.get("img_size") and args_dict.get("vae_type") == "flux2":
578
- spatial_compression = 16
579
- config["sample_size"] = int(args_dict["img_size"]) // spatial_compression
580
-
581
- mask_prob = float(args_dict.get("mask_prob", 0.0) or 0.0)
582
- if mask_prob > 0.0:
583
- config["mask_prob"] = mask_prob
584
- config["mask_ratio"] = float(args_dict.get("mask_ratio", 0.0) or 0.0)
585
-
586
- loop_count = int(args_dict.get("loop_count", 0) or 0)
587
- if loop_count > 0:
588
- loop_indices_raw = str(args_dict.get("loop_indices", "") or "")
589
- loop_indices = [int(x) for x in loop_indices_raw.split(",") if x.strip()]
590
- if loop_indices:
591
- config["loop_indices"] = loop_indices
592
- config["loop_count"] = loop_count
593
-
594
- model = cls(**config)
595
-
596
- if weights == "model":
597
- key = "model"
598
- else:
599
- key = f"model_{weights}" if weights in {"ema1", "ema2"} else "model"
600
-
601
- if key not in checkpoint:
602
- raise ValueError(f"Checkpoint key '{key}' not found. Available keys: {list(checkpoint.keys())}")
603
-
604
- state_dict = remap_legacy_state_dict(checkpoint[key])
605
- model.load_state_dict(state_dict, strict=strict)
606
-
607
- metadata = {
608
- "checkpoint_path": checkpoint_path,
609
- "weights": weights,
610
- "epoch": checkpoint.get("epoch"),
611
- "model_type": model_type,
612
- "source_args": checkpoint.get("args"),
613
- }
614
- return model, metadata
615
-
616
- def to_jlt_checkpoint(
617
- self,
618
- ema_mode: str = "copy_to_both",
619
- prefix: str = "net.",
620
- ) -> Dict[str, object]:
621
- base_state: Dict[str, torch.Tensor] = {}
622
- for key, value in self.state_dict().items():
623
- legacy_key = key
624
- if legacy_key.startswith("norm_final"):
625
- legacy_key = legacy_key.replace("norm_final", "final_layer.norm_final", 1)
626
- if legacy_key.startswith("linear_final"):
627
- legacy_key = legacy_key.replace("linear_final", "final_layer.linear", 1)
628
- if legacy_key.startswith("adaLN_modulation_final"):
629
- legacy_key = legacy_key.replace("adaLN_modulation_final", "final_layer.adaLN_modulation", 1)
630
- legacy_key = legacy_key.replace(".adaLN_modulation.", ".adaLN_modulation.1.")
631
- base_state[f"{prefix}{legacy_key}"] = value.detach().cpu()
632
-
633
- checkpoint = {"model": base_state}
634
- if ema_mode == "copy_to_both":
635
- checkpoint["model_ema1"] = {k: v.clone() for k, v in base_state.items()}
636
- checkpoint["model_ema2"] = {k: v.clone() for k, v in base_state.items()}
637
- elif ema_mode != "none":
638
- raise ValueError(f"Unsupported ema_mode='{ema_mode}'.")
639
- return checkpoint
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
JLT-B-1-256/vae/config.json DELETED
@@ -1,40 +0,0 @@
1
- {
2
- "_class_name": "AutoencoderKLFlux2",
3
- "_diffusers_version": "0.37.0.dev0",
4
- "_name_or_path": "black-forest-labs/FLUX.2-dev",
5
- "act_fn": "silu",
6
- "batch_norm_eps": 0.0001,
7
- "batch_norm_momentum": 0.1,
8
- "block_out_channels": [
9
- 128,
10
- 256,
11
- 512,
12
- 512
13
- ],
14
- "down_block_types": [
15
- "DownEncoderBlock2D",
16
- "DownEncoderBlock2D",
17
- "DownEncoderBlock2D",
18
- "DownEncoderBlock2D"
19
- ],
20
- "force_upcast": true,
21
- "in_channels": 3,
22
- "latent_channels": 32,
23
- "layers_per_block": 2,
24
- "mid_block_add_attention": true,
25
- "norm_num_groups": 32,
26
- "out_channels": 3,
27
- "patch_size": [
28
- 2,
29
- 2
30
- ],
31
- "sample_size": 1024,
32
- "up_block_types": [
33
- "UpDecoderBlock2D",
34
- "UpDecoderBlock2D",
35
- "UpDecoderBlock2D",
36
- "UpDecoderBlock2D"
37
- ],
38
- "use_post_quant_conv": true,
39
- "use_quant_conv": true
40
- }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
JLT-B-1-256/vae/diffusion_pytorch_model.safetensors DELETED
@@ -1,3 +0,0 @@
1
- version https://git-lfs.github.com/spec/v1
2
- oid sha256:ca70d2202afe6415bdbcb8793ba8cd99fd159cfe6192381504d6c4d3036e0f04
3
- size 168120878
 
 
 
 
JLT-H-1-256/model_index.json DELETED
@@ -1,1021 +0,0 @@
1
- {
2
- "_class_name": [
3
- "pipeline",
4
- "JLTPipeline"
5
- ],
6
- "_diffusers_version": "0.36.0",
7
- "transformer": [
8
- "transformer_jlt",
9
- "JLTTransformer2DModel"
10
- ],
11
- "scheduler": [
12
- "diffusers",
13
- "FlowMatchHeunDiscreteScheduler"
14
- ],
15
- "vae": [
16
- "diffusers",
17
- "AutoencoderKLFlux2"
18
- ],
19
- "id2label": {
20
- "0": "tench, Tinca tinca",
21
- "1": "goldfish, Carassius auratus",
22
- "2": "great white shark, white shark, man-eater, man-eating shark, Carcharodon carcharias",
23
- "3": "tiger shark, Galeocerdo cuvieri",
24
- "4": "hammerhead, hammerhead shark",
25
- "5": "electric ray, crampfish, numbfish, torpedo",
26
- "6": "stingray",
27
- "7": "cock",
28
- "8": "hen",
29
- "9": "ostrich, Struthio camelus",
30
- "10": "brambling, Fringilla montifringilla",
31
- "11": "goldfinch, Carduelis carduelis",
32
- "12": "house finch, linnet, Carpodacus mexicanus",
33
- "13": "junco, snowbird",
34
- "14": "indigo bunting, indigo finch, indigo bird, Passerina cyanea",
35
- "15": "robin, American robin, Turdus migratorius",
36
- "16": "bulbul",
37
- "17": "jay",
38
- "18": "magpie",
39
- "19": "chickadee",
40
- "20": "water ouzel, dipper",
41
- "21": "kite",
42
- "22": "bald eagle, American eagle, Haliaeetus leucocephalus",
43
- "23": "vulture",
44
- "24": "great grey owl, great gray owl, Strix nebulosa",
45
- "25": "European fire salamander, Salamandra salamandra",
46
- "26": "common newt, Triturus vulgaris",
47
- "27": "eft",
48
- "28": "spotted salamander, Ambystoma maculatum",
49
- "29": "axolotl, mud puppy, Ambystoma mexicanum",
50
- "30": "bullfrog, Rana catesbeiana",
51
- "31": "tree frog, tree-frog",
52
- "32": "tailed frog, bell toad, ribbed toad, tailed toad, Ascaphus trui",
53
- "33": "loggerhead, loggerhead turtle, Caretta caretta",
54
- "34": "leatherback turtle, leatherback, leathery turtle, Dermochelys coriacea",
55
- "35": "mud turtle",
56
- "36": "terrapin",
57
- "37": "box turtle, box tortoise",
58
- "38": "banded gecko",
59
- "39": "common iguana, iguana, Iguana iguana",
60
- "40": "American chameleon, anole, Anolis carolinensis",
61
- "41": "whiptail, whiptail lizard",
62
- "42": "agama",
63
- "43": "frilled lizard, Chlamydosaurus kingi",
64
- "44": "alligator lizard",
65
- "45": "Gila monster, Heloderma suspectum",
66
- "46": "green lizard, Lacerta viridis",
67
- "47": "African chameleon, Chamaeleo chamaeleon",
68
- "48": "Komodo dragon, Komodo lizard, dragon lizard, giant lizard, Varanus komodoensis",
69
- "49": "African crocodile, Nile crocodile, Crocodylus niloticus",
70
- "50": "American alligator, Alligator mississipiensis",
71
- "51": "triceratops",
72
- "52": "thunder snake, worm snake, Carphophis amoenus",
73
- "53": "ringneck snake, ring-necked snake, ring snake",
74
- "54": "hognose snake, puff adder, sand viper",
75
- "55": "green snake, grass snake",
76
- "56": "king snake, kingsnake",
77
- "57": "garter snake, grass snake",
78
- "58": "water snake",
79
- "59": "vine snake",
80
- "60": "night snake, Hypsiglena torquata",
81
- "61": "boa constrictor, Constrictor constrictor",
82
- "62": "rock python, rock snake, Python sebae",
83
- "63": "Indian cobra, Naja naja",
84
- "64": "green mamba",
85
- "65": "sea snake",
86
- "66": "horned viper, cerastes, sand viper, horned asp, Cerastes cornutus",
87
- "67": "diamondback, diamondback rattlesnake, Crotalus adamanteus",
88
- "68": "sidewinder, horned rattlesnake, Crotalus cerastes",
89
- "69": "trilobite",
90
- "70": "harvestman, daddy longlegs, Phalangium opilio",
91
- "71": "scorpion",
92
- "72": "black and gold garden spider, Argiope aurantia",
93
- "73": "barn spider, Araneus cavaticus",
94
- "74": "garden spider, Aranea diademata",
95
- "75": "black widow, Latrodectus mactans",
96
- "76": "tarantula",
97
- "77": "wolf spider, hunting spider",
98
- "78": "tick",
99
- "79": "centipede",
100
- "80": "black grouse",
101
- "81": "ptarmigan",
102
- "82": "ruffed grouse, partridge, Bonasa umbellus",
103
- "83": "prairie chicken, prairie grouse, prairie fowl",
104
- "84": "peacock",
105
- "85": "quail",
106
- "86": "partridge",
107
- "87": "African grey, African gray, Psittacus erithacus",
108
- "88": "macaw",
109
- "89": "sulphur-crested cockatoo, Kakatoe galerita, Cacatua galerita",
110
- "90": "lorikeet",
111
- "91": "coucal",
112
- "92": "bee eater",
113
- "93": "hornbill",
114
- "94": "hummingbird",
115
- "95": "jacamar",
116
- "96": "toucan",
117
- "97": "drake",
118
- "98": "red-breasted merganser, Mergus serrator",
119
- "99": "goose",
120
- "100": "black swan, Cygnus atratus",
121
- "101": "tusker",
122
- "102": "echidna, spiny anteater, anteater",
123
- "103": "platypus, duckbill, duckbilled platypus, duck-billed platypus, Ornithorhynchus anatinus",
124
- "104": "wallaby, brush kangaroo",
125
- "105": "koala, koala bear, kangaroo bear, native bear, Phascolarctos cinereus",
126
- "106": "wombat",
127
- "107": "jellyfish",
128
- "108": "sea anemone, anemone",
129
- "109": "brain coral",
130
- "110": "flatworm, platyhelminth",
131
- "111": "nematode, nematode worm, roundworm",
132
- "112": "conch",
133
- "113": "snail",
134
- "114": "slug",
135
- "115": "sea slug, nudibranch",
136
- "116": "chiton, coat-of-mail shell, sea cradle, polyplacophore",
137
- "117": "chambered nautilus, pearly nautilus, nautilus",
138
- "118": "Dungeness crab, Cancer magister",
139
- "119": "rock crab, Cancer irroratus",
140
- "120": "fiddler crab",
141
- "121": "king crab, Alaska crab, Alaskan king crab, Alaska king crab, Paralithodes camtschatica",
142
- "122": "American lobster, Northern lobster, Maine lobster, Homarus americanus",
143
- "123": "spiny lobster, langouste, rock lobster, crawfish, crayfish, sea crawfish",
144
- "124": "crayfish, crawfish, crawdad, crawdaddy",
145
- "125": "hermit crab",
146
- "126": "isopod",
147
- "127": "white stork, Ciconia ciconia",
148
- "128": "black stork, Ciconia nigra",
149
- "129": "spoonbill",
150
- "130": "flamingo",
151
- "131": "little blue heron, Egretta caerulea",
152
- "132": "American egret, great white heron, Egretta albus",
153
- "133": "bittern",
154
- "134": "crane",
155
- "135": "limpkin, Aramus pictus",
156
- "136": "European gallinule, Porphyrio porphyrio",
157
- "137": "American coot, marsh hen, mud hen, water hen, Fulica americana",
158
- "138": "bustard",
159
- "139": "ruddy turnstone, Arenaria interpres",
160
- "140": "red-backed sandpiper, dunlin, Erolia alpina",
161
- "141": "redshank, Tringa totanus",
162
- "142": "dowitcher",
163
- "143": "oystercatcher, oyster catcher",
164
- "144": "pelican",
165
- "145": "king penguin, Aptenodytes patagonica",
166
- "146": "albatross, mollymawk",
167
- "147": "grey whale, gray whale, devilfish, Eschrichtius gibbosus, Eschrichtius robustus",
168
- "148": "killer whale, killer, orca, grampus, sea wolf, Orcinus orca",
169
- "149": "dugong, Dugong dugon",
170
- "150": "sea lion",
171
- "151": "Chihuahua",
172
- "152": "Japanese spaniel",
173
- "153": "Maltese dog, Maltese terrier, Maltese",
174
- "154": "Pekinese, Pekingese, Peke",
175
- "155": "Shih-Tzu",
176
- "156": "Blenheim spaniel",
177
- "157": "papillon",
178
- "158": "toy terrier",
179
- "159": "Rhodesian ridgeback",
180
- "160": "Afghan hound, Afghan",
181
- "161": "basset, basset hound",
182
- "162": "beagle",
183
- "163": "bloodhound, sleuthhound",
184
- "164": "bluetick",
185
- "165": "black-and-tan coonhound",
186
- "166": "Walker hound, Walker foxhound",
187
- "167": "English foxhound",
188
- "168": "redbone",
189
- "169": "borzoi, Russian wolfhound",
190
- "170": "Irish wolfhound",
191
- "171": "Italian greyhound",
192
- "172": "whippet",
193
- "173": "Ibizan hound, Ibizan Podenco",
194
- "174": "Norwegian elkhound, elkhound",
195
- "175": "otterhound, otter hound",
196
- "176": "Saluki, gazelle hound",
197
- "177": "Scottish deerhound, deerhound",
198
- "178": "Weimaraner",
199
- "179": "Staffordshire bullterrier, Staffordshire bull terrier",
200
- "180": "American Staffordshire terrier, Staffordshire terrier, American pit bull terrier, pit bull terrier",
201
- "181": "Bedlington terrier",
202
- "182": "Border terrier",
203
- "183": "Kerry blue terrier",
204
- "184": "Irish terrier",
205
- "185": "Norfolk terrier",
206
- "186": "Norwich terrier",
207
- "187": "Yorkshire terrier",
208
- "188": "wire-haired fox terrier",
209
- "189": "Lakeland terrier",
210
- "190": "Sealyham terrier, Sealyham",
211
- "191": "Airedale, Airedale terrier",
212
- "192": "cairn, cairn terrier",
213
- "193": "Australian terrier",
214
- "194": "Dandie Dinmont, Dandie Dinmont terrier",
215
- "195": "Boston bull, Boston terrier",
216
- "196": "miniature schnauzer",
217
- "197": "giant schnauzer",
218
- "198": "standard schnauzer",
219
- "199": "Scotch terrier, Scottish terrier, Scottie",
220
- "200": "Tibetan terrier, chrysanthemum dog",
221
- "201": "silky terrier, Sydney silky",
222
- "202": "soft-coated wheaten terrier",
223
- "203": "West Highland white terrier",
224
- "204": "Lhasa, Lhasa apso",
225
- "205": "flat-coated retriever",
226
- "206": "curly-coated retriever",
227
- "207": "golden retriever",
228
- "208": "Labrador retriever",
229
- "209": "Chesapeake Bay retriever",
230
- "210": "German short-haired pointer",
231
- "211": "vizsla, Hungarian pointer",
232
- "212": "English setter",
233
- "213": "Irish setter, red setter",
234
- "214": "Gordon setter",
235
- "215": "Brittany spaniel",
236
- "216": "clumber, clumber spaniel",
237
- "217": "English springer, English springer spaniel",
238
- "218": "Welsh springer spaniel",
239
- "219": "cocker spaniel, English cocker spaniel, cocker",
240
- "220": "Sussex spaniel",
241
- "221": "Irish water spaniel",
242
- "222": "kuvasz",
243
- "223": "schipperke",
244
- "224": "groenendael",
245
- "225": "malinois",
246
- "226": "briard",
247
- "227": "kelpie",
248
- "228": "komondor",
249
- "229": "Old English sheepdog, bobtail",
250
- "230": "Shetland sheepdog, Shetland sheep dog, Shetland",
251
- "231": "collie",
252
- "232": "Border collie",
253
- "233": "Bouvier des Flandres, Bouviers des Flandres",
254
- "234": "Rottweiler",
255
- "235": "German shepherd, German shepherd dog, German police dog, alsatian",
256
- "236": "Doberman, Doberman pinscher",
257
- "237": "miniature pinscher",
258
- "238": "Greater Swiss Mountain dog",
259
- "239": "Bernese mountain dog",
260
- "240": "Appenzeller",
261
- "241": "EntleBucher",
262
- "242": "boxer",
263
- "243": "bull mastiff",
264
- "244": "Tibetan mastiff",
265
- "245": "French bulldog",
266
- "246": "Great Dane",
267
- "247": "Saint Bernard, St Bernard",
268
- "248": "Eskimo dog, husky",
269
- "249": "malamute, malemute, Alaskan malamute",
270
- "250": "Siberian husky",
271
- "251": "dalmatian, coach dog, carriage dog",
272
- "252": "affenpinscher, monkey pinscher, monkey dog",
273
- "253": "basenji",
274
- "254": "pug, pug-dog",
275
- "255": "Leonberg",
276
- "256": "Newfoundland, Newfoundland dog",
277
- "257": "Great Pyrenees",
278
- "258": "Samoyed, Samoyede",
279
- "259": "Pomeranian",
280
- "260": "chow, chow chow",
281
- "261": "keeshond",
282
- "262": "Brabancon griffon",
283
- "263": "Pembroke, Pembroke Welsh corgi",
284
- "264": "Cardigan, Cardigan Welsh corgi",
285
- "265": "toy poodle",
286
- "266": "miniature poodle",
287
- "267": "standard poodle",
288
- "268": "Mexican hairless",
289
- "269": "timber wolf, grey wolf, gray wolf, Canis lupus",
290
- "270": "white wolf, Arctic wolf, Canis lupus tundrarum",
291
- "271": "red wolf, maned wolf, Canis rufus, Canis niger",
292
- "272": "coyote, prairie wolf, brush wolf, Canis latrans",
293
- "273": "dingo, warrigal, warragal, Canis dingo",
294
- "274": "dhole, Cuon alpinus",
295
- "275": "African hunting dog, hyena dog, Cape hunting dog, Lycaon pictus",
296
- "276": "hyena, hyaena",
297
- "277": "red fox, Vulpes vulpes",
298
- "278": "kit fox, Vulpes macrotis",
299
- "279": "Arctic fox, white fox, Alopex lagopus",
300
- "280": "grey fox, gray fox, Urocyon cinereoargenteus",
301
- "281": "tabby, tabby cat",
302
- "282": "tiger cat",
303
- "283": "Persian cat",
304
- "284": "Siamese cat, Siamese",
305
- "285": "Egyptian cat",
306
- "286": "cougar, puma, catamount, mountain lion, painter, panther, Felis concolor",
307
- "287": "lynx, catamount",
308
- "288": "leopard, Panthera pardus",
309
- "289": "snow leopard, ounce, Panthera uncia",
310
- "290": "jaguar, panther, Panthera onca, Felis onca",
311
- "291": "lion, king of beasts, Panthera leo",
312
- "292": "tiger, Panthera tigris",
313
- "293": "cheetah, chetah, Acinonyx jubatus",
314
- "294": "brown bear, bruin, Ursus arctos",
315
- "295": "American black bear, black bear, Ursus americanus, Euarctos americanus",
316
- "296": "ice bear, polar bear, Ursus Maritimus, Thalarctos maritimus",
317
- "297": "sloth bear, Melursus ursinus, Ursus ursinus",
318
- "298": "mongoose",
319
- "299": "meerkat, mierkat",
320
- "300": "tiger beetle",
321
- "301": "ladybug, ladybeetle, lady beetle, ladybird, ladybird beetle",
322
- "302": "ground beetle, carabid beetle",
323
- "303": "long-horned beetle, longicorn, longicorn beetle",
324
- "304": "leaf beetle, chrysomelid",
325
- "305": "dung beetle",
326
- "306": "rhinoceros beetle",
327
- "307": "weevil",
328
- "308": "fly",
329
- "309": "bee",
330
- "310": "ant, emmet, pismire",
331
- "311": "grasshopper, hopper",
332
- "312": "cricket",
333
- "313": "walking stick, walkingstick, stick insect",
334
- "314": "cockroach, roach",
335
- "315": "mantis, mantid",
336
- "316": "cicada, cicala",
337
- "317": "leafhopper",
338
- "318": "lacewing, lacewing fly",
339
- "319": "dragonfly, darning needle, devils darning needle, sewing needle, snake feeder, snake doctor, mosquito hawk, skeeter hawk",
340
- "320": "damselfly",
341
- "321": "admiral",
342
- "322": "ringlet, ringlet butterfly",
343
- "323": "monarch, monarch butterfly, milkweed butterfly, Danaus plexippus",
344
- "324": "cabbage butterfly",
345
- "325": "sulphur butterfly, sulfur butterfly",
346
- "326": "lycaenid, lycaenid butterfly",
347
- "327": "starfish, sea star",
348
- "328": "sea urchin",
349
- "329": "sea cucumber, holothurian",
350
- "330": "wood rabbit, cottontail, cottontail rabbit",
351
- "331": "hare",
352
- "332": "Angora, Angora rabbit",
353
- "333": "hamster",
354
- "334": "porcupine, hedgehog",
355
- "335": "fox squirrel, eastern fox squirrel, Sciurus niger",
356
- "336": "marmot",
357
- "337": "beaver",
358
- "338": "guinea pig, Cavia cobaya",
359
- "339": "sorrel",
360
- "340": "zebra",
361
- "341": "hog, pig, grunter, squealer, Sus scrofa",
362
- "342": "wild boar, boar, Sus scrofa",
363
- "343": "warthog",
364
- "344": "hippopotamus, hippo, river horse, Hippopotamus amphibius",
365
- "345": "ox",
366
- "346": "water buffalo, water ox, Asiatic buffalo, Bubalus bubalis",
367
- "347": "bison",
368
- "348": "ram, tup",
369
- "349": "bighorn, bighorn sheep, cimarron, Rocky Mountain bighorn, Rocky Mountain sheep, Ovis canadensis",
370
- "350": "ibex, Capra ibex",
371
- "351": "hartebeest",
372
- "352": "impala, Aepyceros melampus",
373
- "353": "gazelle",
374
- "354": "Arabian camel, dromedary, Camelus dromedarius",
375
- "355": "llama",
376
- "356": "weasel",
377
- "357": "mink",
378
- "358": "polecat, fitch, foulmart, foumart, Mustela putorius",
379
- "359": "black-footed ferret, ferret, Mustela nigripes",
380
- "360": "otter",
381
- "361": "skunk, polecat, wood pussy",
382
- "362": "badger",
383
- "363": "armadillo",
384
- "364": "three-toed sloth, ai, Bradypus tridactylus",
385
- "365": "orangutan, orang, orangutang, Pongo pygmaeus",
386
- "366": "gorilla, Gorilla gorilla",
387
- "367": "chimpanzee, chimp, Pan troglodytes",
388
- "368": "gibbon, Hylobates lar",
389
- "369": "siamang, Hylobates syndactylus, Symphalangus syndactylus",
390
- "370": "guenon, guenon monkey",
391
- "371": "patas, hussar monkey, Erythrocebus patas",
392
- "372": "baboon",
393
- "373": "macaque",
394
- "374": "langur",
395
- "375": "colobus, colobus monkey",
396
- "376": "proboscis monkey, Nasalis larvatus",
397
- "377": "marmoset",
398
- "378": "capuchin, ringtail, Cebus capucinus",
399
- "379": "howler monkey, howler",
400
- "380": "titi, titi monkey",
401
- "381": "spider monkey, Ateles geoffroyi",
402
- "382": "squirrel monkey, Saimiri sciureus",
403
- "383": "Madagascar cat, ring-tailed lemur, Lemur catta",
404
- "384": "indri, indris, Indri indri, Indri brevicaudatus",
405
- "385": "Indian elephant, Elephas maximus",
406
- "386": "African elephant, Loxodonta africana",
407
- "387": "lesser panda, red panda, panda, bear cat, cat bear, Ailurus fulgens",
408
- "388": "giant panda, panda, panda bear, coon bear, Ailuropoda melanoleuca",
409
- "389": "barracouta, snoek",
410
- "390": "eel",
411
- "391": "coho, cohoe, coho salmon, blue jack, silver salmon, Oncorhynchus kisutch",
412
- "392": "rock beauty, Holocanthus tricolor",
413
- "393": "anemone fish",
414
- "394": "sturgeon",
415
- "395": "gar, garfish, garpike, billfish, Lepisosteus osseus",
416
- "396": "lionfish",
417
- "397": "puffer, pufferfish, blowfish, globefish",
418
- "398": "abacus",
419
- "399": "abaya",
420
- "400": "academic gown, academic robe, judge robe",
421
- "401": "accordion, piano accordion, squeeze box",
422
- "402": "acoustic guitar",
423
- "403": "aircraft carrier, carrier, flattop, attack aircraft carrier",
424
- "404": "airliner",
425
- "405": "airship, dirigible",
426
- "406": "altar",
427
- "407": "ambulance",
428
- "408": "amphibian, amphibious vehicle",
429
- "409": "analog clock",
430
- "410": "apiary, bee house",
431
- "411": "apron",
432
- "412": "ashcan, trash can, garbage can, wastebin, ash bin, ash-bin, ashbin, dustbin, trash barrel, trash bin",
433
- "413": "assault rifle, assault gun",
434
- "414": "backpack, back pack, knapsack, packsack, rucksack, haversack",
435
- "415": "bakery, bakeshop, bakehouse",
436
- "416": "balance beam, beam",
437
- "417": "balloon",
438
- "418": "ballpoint, ballpoint pen, ballpen, Biro",
439
- "419": "Band Aid",
440
- "420": "banjo",
441
- "421": "bannister, banister, balustrade, balusters, handrail",
442
- "422": "barbell",
443
- "423": "barber chair",
444
- "424": "barbershop",
445
- "425": "barn",
446
- "426": "barometer",
447
- "427": "barrel, cask",
448
- "428": "barrow, garden cart, lawn cart, wheelbarrow",
449
- "429": "baseball",
450
- "430": "basketball",
451
- "431": "bassinet",
452
- "432": "bassoon",
453
- "433": "bathing cap, swimming cap",
454
- "434": "bath towel",
455
- "435": "bathtub, bathing tub, bath, tub",
456
- "436": "beach wagon, station wagon, wagon, estate car, beach waggon, station waggon, waggon",
457
- "437": "beacon, lighthouse, beacon light, pharos",
458
- "438": "beaker",
459
- "439": "bearskin, busby, shako",
460
- "440": "beer bottle",
461
- "441": "beer glass",
462
- "442": "bell cote, bell cot",
463
- "443": "bib",
464
- "444": "bicycle-built-for-two, tandem bicycle, tandem",
465
- "445": "bikini, two-piece",
466
- "446": "binder, ring-binder",
467
- "447": "binoculars, field glasses, opera glasses",
468
- "448": "birdhouse",
469
- "449": "boathouse",
470
- "450": "bobsled, bobsleigh, bob",
471
- "451": "bolo tie, bolo, bola tie, bola",
472
- "452": "bonnet, poke bonnet",
473
- "453": "bookcase",
474
- "454": "bookshop, bookstore, bookstall",
475
- "455": "bottlecap",
476
- "456": "bow",
477
- "457": "bow tie, bow-tie, bowtie",
478
- "458": "brass, memorial tablet, plaque",
479
- "459": "brassiere, bra, bandeau",
480
- "460": "breakwater, groin, groyne, mole, bulwark, seawall, jetty",
481
- "461": "breastplate, aegis, egis",
482
- "462": "broom",
483
- "463": "bucket, pail",
484
- "464": "buckle",
485
- "465": "bulletproof vest",
486
- "466": "bullet train, bullet",
487
- "467": "butcher shop, meat market",
488
- "468": "cab, hack, taxi, taxicab",
489
- "469": "caldron, cauldron",
490
- "470": "candle, taper, wax light",
491
- "471": "cannon",
492
- "472": "canoe",
493
- "473": "can opener, tin opener",
494
- "474": "cardigan",
495
- "475": "car mirror",
496
- "476": "carousel, carrousel, merry-go-round, roundabout, whirligig",
497
- "477": "carpenters kit, tool kit",
498
- "478": "carton",
499
- "479": "car wheel",
500
- "480": "cash machine, cash dispenser, automated teller machine, automatic teller machine, automated teller, automatic teller, ATM",
501
- "481": "cassette",
502
- "482": "cassette player",
503
- "483": "castle",
504
- "484": "catamaran",
505
- "485": "CD player",
506
- "486": "cello, violoncello",
507
- "487": "cellular telephone, cellular phone, cellphone, cell, mobile phone",
508
- "488": "chain",
509
- "489": "chainlink fence",
510
- "490": "chain mail, ring mail, mail, chain armor, chain armour, ring armor, ring armour",
511
- "491": "chain saw, chainsaw",
512
- "492": "chest",
513
- "493": "chiffonier, commode",
514
- "494": "chime, bell, gong",
515
- "495": "china cabinet, china closet",
516
- "496": "Christmas stocking",
517
- "497": "church, church building",
518
- "498": "cinema, movie theater, movie theatre, movie house, picture palace",
519
- "499": "cleaver, meat cleaver, chopper",
520
- "500": "cliff dwelling",
521
- "501": "cloak",
522
- "502": "clog, geta, patten, sabot",
523
- "503": "cocktail shaker",
524
- "504": "coffee mug",
525
- "505": "coffeepot",
526
- "506": "coil, spiral, volute, whorl, helix",
527
- "507": "combination lock",
528
- "508": "computer keyboard, keypad",
529
- "509": "confectionery, confectionary, candy store",
530
- "510": "container ship, containership, container vessel",
531
- "511": "convertible",
532
- "512": "corkscrew, bottle screw",
533
- "513": "cornet, horn, trumpet, trump",
534
- "514": "cowboy boot",
535
- "515": "cowboy hat, ten-gallon hat",
536
- "516": "cradle",
537
- "517": "crane",
538
- "518": "crash helmet",
539
- "519": "crate",
540
- "520": "crib, cot",
541
- "521": "Crock Pot",
542
- "522": "croquet ball",
543
- "523": "crutch",
544
- "524": "cuirass",
545
- "525": "dam, dike, dyke",
546
- "526": "desk",
547
- "527": "desktop computer",
548
- "528": "dial telephone, dial phone",
549
- "529": "diaper, nappy, napkin",
550
- "530": "digital clock",
551
- "531": "digital watch",
552
- "532": "dining table, board",
553
- "533": "dishrag, dishcloth",
554
- "534": "dishwasher, dish washer, dishwashing machine",
555
- "535": "disk brake, disc brake",
556
- "536": "dock, dockage, docking facility",
557
- "537": "dogsled, dog sled, dog sleigh",
558
- "538": "dome",
559
- "539": "doormat, welcome mat",
560
- "540": "drilling platform, offshore rig",
561
- "541": "drum, membranophone, tympan",
562
- "542": "drumstick",
563
- "543": "dumbbell",
564
- "544": "Dutch oven",
565
- "545": "electric fan, blower",
566
- "546": "electric guitar",
567
- "547": "electric locomotive",
568
- "548": "entertainment center",
569
- "549": "envelope",
570
- "550": "espresso maker",
571
- "551": "face powder",
572
- "552": "feather boa, boa",
573
- "553": "file, file cabinet, filing cabinet",
574
- "554": "fireboat",
575
- "555": "fire engine, fire truck",
576
- "556": "fire screen, fireguard",
577
- "557": "flagpole, flagstaff",
578
- "558": "flute, transverse flute",
579
- "559": "folding chair",
580
- "560": "football helmet",
581
- "561": "forklift",
582
- "562": "fountain",
583
- "563": "fountain pen",
584
- "564": "four-poster",
585
- "565": "freight car",
586
- "566": "French horn, horn",
587
- "567": "frying pan, frypan, skillet",
588
- "568": "fur coat",
589
- "569": "garbage truck, dustcart",
590
- "570": "gasmask, respirator, gas helmet",
591
- "571": "gas pump, gasoline pump, petrol pump, island dispenser",
592
- "572": "goblet",
593
- "573": "go-kart",
594
- "574": "golf ball",
595
- "575": "golfcart, golf cart",
596
- "576": "gondola",
597
- "577": "gong, tam-tam",
598
- "578": "gown",
599
- "579": "grand piano, grand",
600
- "580": "greenhouse, nursery, glasshouse",
601
- "581": "grille, radiator grille",
602
- "582": "grocery store, grocery, food market, market",
603
- "583": "guillotine",
604
- "584": "hair slide",
605
- "585": "hair spray",
606
- "586": "half track",
607
- "587": "hammer",
608
- "588": "hamper",
609
- "589": "hand blower, blow dryer, blow drier, hair dryer, hair drier",
610
- "590": "hand-held computer, hand-held microcomputer",
611
- "591": "handkerchief, hankie, hanky, hankey",
612
- "592": "hard disc, hard disk, fixed disk",
613
- "593": "harmonica, mouth organ, harp, mouth harp",
614
- "594": "harp",
615
- "595": "harvester, reaper",
616
- "596": "hatchet",
617
- "597": "holster",
618
- "598": "home theater, home theatre",
619
- "599": "honeycomb",
620
- "600": "hook, claw",
621
- "601": "hoopskirt, crinoline",
622
- "602": "horizontal bar, high bar",
623
- "603": "horse cart, horse-cart",
624
- "604": "hourglass",
625
- "605": "iPod",
626
- "606": "iron, smoothing iron",
627
- "607": "jack-o-lantern",
628
- "608": "jean, blue jean, denim",
629
- "609": "jeep, landrover",
630
- "610": "jersey, T-shirt, tee shirt",
631
- "611": "jigsaw puzzle",
632
- "612": "jinrikisha, ricksha, rickshaw",
633
- "613": "joystick",
634
- "614": "kimono",
635
- "615": "knee pad",
636
- "616": "knot",
637
- "617": "lab coat, laboratory coat",
638
- "618": "ladle",
639
- "619": "lampshade, lamp shade",
640
- "620": "laptop, laptop computer",
641
- "621": "lawn mower, mower",
642
- "622": "lens cap, lens cover",
643
- "623": "letter opener, paper knife, paperknife",
644
- "624": "library",
645
- "625": "lifeboat",
646
- "626": "lighter, light, igniter, ignitor",
647
- "627": "limousine, limo",
648
- "628": "liner, ocean liner",
649
- "629": "lipstick, lip rouge",
650
- "630": "Loafer",
651
- "631": "lotion",
652
- "632": "loudspeaker, speaker, speaker unit, loudspeaker system, speaker system",
653
- "633": "loupe, jewelers loupe",
654
- "634": "lumbermill, sawmill",
655
- "635": "magnetic compass",
656
- "636": "mailbag, postbag",
657
- "637": "mailbox, letter box",
658
- "638": "maillot",
659
- "639": "maillot, tank suit",
660
- "640": "manhole cover",
661
- "641": "maraca",
662
- "642": "marimba, xylophone",
663
- "643": "mask",
664
- "644": "matchstick",
665
- "645": "maypole",
666
- "646": "maze, labyrinth",
667
- "647": "measuring cup",
668
- "648": "medicine chest, medicine cabinet",
669
- "649": "megalith, megalithic structure",
670
- "650": "microphone, mike",
671
- "651": "microwave, microwave oven",
672
- "652": "military uniform",
673
- "653": "milk can",
674
- "654": "minibus",
675
- "655": "miniskirt, mini",
676
- "656": "minivan",
677
- "657": "missile",
678
- "658": "mitten",
679
- "659": "mixing bowl",
680
- "660": "mobile home, manufactured home",
681
- "661": "Model T",
682
- "662": "modem",
683
- "663": "monastery",
684
- "664": "monitor",
685
- "665": "moped",
686
- "666": "mortar",
687
- "667": "mortarboard",
688
- "668": "mosque",
689
- "669": "mosquito net",
690
- "670": "motor scooter, scooter",
691
- "671": "mountain bike, all-terrain bike, off-roader",
692
- "672": "mountain tent",
693
- "673": "mouse, computer mouse",
694
- "674": "mousetrap",
695
- "675": "moving van",
696
- "676": "muzzle",
697
- "677": "nail",
698
- "678": "neck brace",
699
- "679": "necklace",
700
- "680": "nipple",
701
- "681": "notebook, notebook computer",
702
- "682": "obelisk",
703
- "683": "oboe, hautboy, hautbois",
704
- "684": "ocarina, sweet potato",
705
- "685": "odometer, hodometer, mileometer, milometer",
706
- "686": "oil filter",
707
- "687": "organ, pipe organ",
708
- "688": "oscilloscope, scope, cathode-ray oscilloscope, CRO",
709
- "689": "overskirt",
710
- "690": "oxcart",
711
- "691": "oxygen mask",
712
- "692": "packet",
713
- "693": "paddle, boat paddle",
714
- "694": "paddlewheel, paddle wheel",
715
- "695": "padlock",
716
- "696": "paintbrush",
717
- "697": "pajama, pyjama, pjs, jammies",
718
- "698": "palace",
719
- "699": "panpipe, pandean pipe, syrinx",
720
- "700": "paper towel",
721
- "701": "parachute, chute",
722
- "702": "parallel bars, bars",
723
- "703": "park bench",
724
- "704": "parking meter",
725
- "705": "passenger car, coach, carriage",
726
- "706": "patio, terrace",
727
- "707": "pay-phone, pay-station",
728
- "708": "pedestal, plinth, footstall",
729
- "709": "pencil box, pencil case",
730
- "710": "pencil sharpener",
731
- "711": "perfume, essence",
732
- "712": "Petri dish",
733
- "713": "photocopier",
734
- "714": "pick, plectrum, plectron",
735
- "715": "pickelhaube",
736
- "716": "picket fence, paling",
737
- "717": "pickup, pickup truck",
738
- "718": "pier",
739
- "719": "piggy bank, penny bank",
740
- "720": "pill bottle",
741
- "721": "pillow",
742
- "722": "ping-pong ball",
743
- "723": "pinwheel",
744
- "724": "pirate, pirate ship",
745
- "725": "pitcher, ewer",
746
- "726": "plane, carpenters plane, woodworking plane",
747
- "727": "planetarium",
748
- "728": "plastic bag",
749
- "729": "plate rack",
750
- "730": "plow, plough",
751
- "731": "plunger, plumbers helper",
752
- "732": "Polaroid camera, Polaroid Land camera",
753
- "733": "pole",
754
- "734": "police van, police wagon, paddy wagon, patrol wagon, wagon, black Maria",
755
- "735": "poncho",
756
- "736": "pool table, billiard table, snooker table",
757
- "737": "pop bottle, soda bottle",
758
- "738": "pot, flowerpot",
759
- "739": "potters wheel",
760
- "740": "power drill",
761
- "741": "prayer rug, prayer mat",
762
- "742": "printer",
763
- "743": "prison, prison house",
764
- "744": "projectile, missile",
765
- "745": "projector",
766
- "746": "puck, hockey puck",
767
- "747": "punching bag, punch bag, punching ball, punchball",
768
- "748": "purse",
769
- "749": "quill, quill pen",
770
- "750": "quilt, comforter, comfort, puff",
771
- "751": "racer, race car, racing car",
772
- "752": "racket, racquet",
773
- "753": "radiator",
774
- "754": "radio, wireless",
775
- "755": "radio telescope, radio reflector",
776
- "756": "rain barrel",
777
- "757": "recreational vehicle, RV, R.V.",
778
- "758": "reel",
779
- "759": "reflex camera",
780
- "760": "refrigerator, icebox",
781
- "761": "remote control, remote",
782
- "762": "restaurant, eating house, eating place, eatery",
783
- "763": "revolver, six-gun, six-shooter",
784
- "764": "rifle",
785
- "765": "rocking chair, rocker",
786
- "766": "rotisserie",
787
- "767": "rubber eraser, rubber, pencil eraser",
788
- "768": "rugby ball",
789
- "769": "rule, ruler",
790
- "770": "running shoe",
791
- "771": "safe",
792
- "772": "safety pin",
793
- "773": "saltshaker, salt shaker",
794
- "774": "sandal",
795
- "775": "sarong",
796
- "776": "sax, saxophone",
797
- "777": "scabbard",
798
- "778": "scale, weighing machine",
799
- "779": "school bus",
800
- "780": "schooner",
801
- "781": "scoreboard",
802
- "782": "screen, CRT screen",
803
- "783": "screw",
804
- "784": "screwdriver",
805
- "785": "seat belt, seatbelt",
806
- "786": "sewing machine",
807
- "787": "shield, buckler",
808
- "788": "shoe shop, shoe-shop, shoe store",
809
- "789": "shoji",
810
- "790": "shopping basket",
811
- "791": "shopping cart",
812
- "792": "shovel",
813
- "793": "shower cap",
814
- "794": "shower curtain",
815
- "795": "ski",
816
- "796": "ski mask",
817
- "797": "sleeping bag",
818
- "798": "slide rule, slipstick",
819
- "799": "sliding door",
820
- "800": "slot, one-armed bandit",
821
- "801": "snorkel",
822
- "802": "snowmobile",
823
- "803": "snowplow, snowplough",
824
- "804": "soap dispenser",
825
- "805": "soccer ball",
826
- "806": "sock",
827
- "807": "solar dish, solar collector, solar furnace",
828
- "808": "sombrero",
829
- "809": "soup bowl",
830
- "810": "space bar",
831
- "811": "space heater",
832
- "812": "space shuttle",
833
- "813": "spatula",
834
- "814": "speedboat",
835
- "815": "spider web, spiders web",
836
- "816": "spindle",
837
- "817": "sports car, sport car",
838
- "818": "spotlight, spot",
839
- "819": "stage",
840
- "820": "steam locomotive",
841
- "821": "steel arch bridge",
842
- "822": "steel drum",
843
- "823": "stethoscope",
844
- "824": "stole",
845
- "825": "stone wall",
846
- "826": "stopwatch, stop watch",
847
- "827": "stove",
848
- "828": "strainer",
849
- "829": "streetcar, tram, tramcar, trolley, trolley car",
850
- "830": "stretcher",
851
- "831": "studio couch, day bed",
852
- "832": "stupa, tope",
853
- "833": "submarine, pigboat, sub, U-boat",
854
- "834": "suit, suit of clothes",
855
- "835": "sundial",
856
- "836": "sunglass",
857
- "837": "sunglasses, dark glasses, shades",
858
- "838": "sunscreen, sunblock, sun blocker",
859
- "839": "suspension bridge",
860
- "840": "swab, swob, mop",
861
- "841": "sweatshirt",
862
- "842": "swimming trunks, bathing trunks",
863
- "843": "swing",
864
- "844": "switch, electric switch, electrical switch",
865
- "845": "syringe",
866
- "846": "table lamp",
867
- "847": "tank, army tank, armored combat vehicle, armoured combat vehicle",
868
- "848": "tape player",
869
- "849": "teapot",
870
- "850": "teddy, teddy bear",
871
- "851": "television, television system",
872
- "852": "tennis ball",
873
- "853": "thatch, thatched roof",
874
- "854": "theater curtain, theatre curtain",
875
- "855": "thimble",
876
- "856": "thresher, thrasher, threshing machine",
877
- "857": "throne",
878
- "858": "tile roof",
879
- "859": "toaster",
880
- "860": "tobacco shop, tobacconist shop, tobacconist",
881
- "861": "toilet seat",
882
- "862": "torch",
883
- "863": "totem pole",
884
- "864": "tow truck, tow car, wrecker",
885
- "865": "toyshop",
886
- "866": "tractor",
887
- "867": "trailer truck, tractor trailer, trucking rig, rig, articulated lorry, semi",
888
- "868": "tray",
889
- "869": "trench coat",
890
- "870": "tricycle, trike, velocipede",
891
- "871": "trimaran",
892
- "872": "tripod",
893
- "873": "triumphal arch",
894
- "874": "trolleybus, trolley coach, trackless trolley",
895
- "875": "trombone",
896
- "876": "tub, vat",
897
- "877": "turnstile",
898
- "878": "typewriter keyboard",
899
- "879": "umbrella",
900
- "880": "unicycle, monocycle",
901
- "881": "upright, upright piano",
902
- "882": "vacuum, vacuum cleaner",
903
- "883": "vase",
904
- "884": "vault",
905
- "885": "velvet",
906
- "886": "vending machine",
907
- "887": "vestment",
908
- "888": "viaduct",
909
- "889": "violin, fiddle",
910
- "890": "volleyball",
911
- "891": "waffle iron",
912
- "892": "wall clock",
913
- "893": "wallet, billfold, notecase, pocketbook",
914
- "894": "wardrobe, closet, press",
915
- "895": "warplane, military plane",
916
- "896": "washbasin, handbasin, washbowl, lavabo, wash-hand basin",
917
- "897": "washer, automatic washer, washing machine",
918
- "898": "water bottle",
919
- "899": "water jug",
920
- "900": "water tower",
921
- "901": "whiskey jug",
922
- "902": "whistle",
923
- "903": "wig",
924
- "904": "window screen",
925
- "905": "window shade",
926
- "906": "Windsor tie",
927
- "907": "wine bottle",
928
- "908": "wing",
929
- "909": "wok",
930
- "910": "wooden spoon",
931
- "911": "wool, woolen, woollen",
932
- "912": "worm fence, snake fence, snake-rail fence, Virginia fence",
933
- "913": "wreck",
934
- "914": "yawl",
935
- "915": "yurt",
936
- "916": "web site, website, internet site, site",
937
- "917": "comic book",
938
- "918": "crossword puzzle, crossword",
939
- "919": "street sign",
940
- "920": "traffic light, traffic signal, stoplight",
941
- "921": "book jacket, dust cover, dust jacket, dust wrapper",
942
- "922": "menu",
943
- "923": "plate",
944
- "924": "guacamole",
945
- "925": "consomme",
946
- "926": "hot pot, hotpot",
947
- "927": "trifle",
948
- "928": "ice cream, icecream",
949
- "929": "ice lolly, lolly, lollipop, popsicle",
950
- "930": "French loaf",
951
- "931": "bagel, beigel",
952
- "932": "pretzel",
953
- "933": "cheeseburger",
954
- "934": "hotdog, hot dog, red hot",
955
- "935": "mashed potato",
956
- "936": "head cabbage",
957
- "937": "broccoli",
958
- "938": "cauliflower",
959
- "939": "zucchini, courgette",
960
- "940": "spaghetti squash",
961
- "941": "acorn squash",
962
- "942": "butternut squash",
963
- "943": "cucumber, cuke",
964
- "944": "artichoke, globe artichoke",
965
- "945": "bell pepper",
966
- "946": "cardoon",
967
- "947": "mushroom",
968
- "948": "Granny Smith",
969
- "949": "strawberry",
970
- "950": "orange",
971
- "951": "lemon",
972
- "952": "fig",
973
- "953": "pineapple, ananas",
974
- "954": "banana",
975
- "955": "jackfruit, jak, jack",
976
- "956": "custard apple",
977
- "957": "pomegranate",
978
- "958": "hay",
979
- "959": "carbonara",
980
- "960": "chocolate sauce, chocolate syrup",
981
- "961": "dough",
982
- "962": "meat loaf, meatloaf",
983
- "963": "pizza, pizza pie",
984
- "964": "potpie",
985
- "965": "burrito",
986
- "966": "red wine",
987
- "967": "espresso",
988
- "968": "cup",
989
- "969": "eggnog",
990
- "970": "alp",
991
- "971": "bubble",
992
- "972": "cliff, drop, drop-off",
993
- "973": "coral reef",
994
- "974": "geyser",
995
- "975": "lakeside, lakeshore",
996
- "976": "promontory, headland, head, foreland",
997
- "977": "sandbar, sand bar",
998
- "978": "seashore, coast, seacoast, sea-coast",
999
- "979": "valley, vale",
1000
- "980": "volcano",
1001
- "981": "ballplayer, baseball player",
1002
- "982": "groom, bridegroom",
1003
- "983": "scuba diver",
1004
- "984": "rapeseed",
1005
- "985": "daisy",
1006
- "986": "yellow ladys slipper, yellow lady-slipper, Cypripedium calceolus, Cypripedium parviflorum",
1007
- "987": "corn",
1008
- "988": "acorn",
1009
- "989": "hip, rose hip, rosehip",
1010
- "990": "buckeye, horse chestnut, conker",
1011
- "991": "coral fungus",
1012
- "992": "agaric",
1013
- "993": "gyromitra",
1014
- "994": "stinkhorn, carrion fungus",
1015
- "995": "earthstar",
1016
- "996": "hen-of-the-woods, hen of the woods, Polyporus frondosus, Grifola frondosa",
1017
- "997": "bolete",
1018
- "998": "ear, spike, capitulum",
1019
- "999": "toilet tissue, toilet paper, bathroom tissue"
1020
- }
1021
- }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
JLT-H-1-256/pipeline.py DELETED
@@ -1,548 +0,0 @@
1
- """Hub custom pipeline: JLTPipeline.
2
- Load with native Hugging Face diffusers and trust_remote_code=True.
3
- """
4
-
5
- from __future__ import annotations
6
-
7
- import importlib
8
- import json
9
- import sys
10
- from pathlib import Path
11
- from typing import Dict, List, Optional, Tuple, Union
12
-
13
- import numpy as np
14
- import torch
15
- from diffusers import AutoencoderKLFlux2
16
- from diffusers.pipelines.pipeline_utils import DiffusionPipeline, ImagePipelineOutput
17
- from diffusers.schedulers import FlowMatchEulerDiscreteScheduler, FlowMatchHeunDiscreteScheduler
18
- from diffusers.schedulers.scheduling_utils import SchedulerMixin
19
- from diffusers.utils.torch_utils import randn_tensor
20
-
21
-
22
- def configure_linear_flow_timesteps(
23
- scheduler: SchedulerMixin,
24
- num_inference_steps: int,
25
- device: Union[str, torch.device, None] = None,
26
- ) -> None:
27
- if isinstance(scheduler, FlowMatchHeunDiscreteScheduler):
28
- scheduler.num_inference_steps = num_inference_steps
29
- sigmas = np.linspace(1.0, 0.0, num_inference_steps, dtype=np.float32)
30
- sigmas_t = torch.from_numpy(sigmas).to(dtype=torch.float32, device=device)
31
- shift = scheduler.config.shift
32
- sigmas_t = shift * sigmas_t / (1 + (shift - 1) * sigmas_t)
33
- timesteps = sigmas_t * scheduler.config.num_train_timesteps
34
- timesteps = torch.cat([timesteps[:1], timesteps[1:].repeat_interleave(2)])
35
- scheduler.timesteps = timesteps.to(device=device)
36
- sigmas_t = torch.cat([sigmas_t, torch.zeros(1, device=sigmas_t.device)])
37
- scheduler.sigmas = torch.cat([sigmas_t[:1], sigmas_t[1:-1].repeat_interleave(2), sigmas_t[-1:]])
38
- scheduler._step_index = None
39
- scheduler._begin_index = None
40
- scheduler.prev_derivative = None
41
- scheduler.dt = None
42
- scheduler.sample = None
43
- return
44
-
45
- sigmas = np.linspace(1.0, 0.0, num_inference_steps, dtype=np.float32).tolist()
46
- scheduler.set_timesteps(num_inference_steps, device=device, sigmas=sigmas)
47
-
48
-
49
- def velocity_from_prediction(
50
- sample: torch.Tensor,
51
- model_output: torch.Tensor,
52
- timestep: Union[float, torch.Tensor],
53
- *,
54
- prediction_type: str = "sample",
55
- t_eps: float = 5e-2,
56
- ) -> torch.Tensor:
57
- if prediction_type == "velocity":
58
- return model_output
59
-
60
- t = torch.as_tensor(timestep, device=sample.device, dtype=sample.dtype)
61
- while t.ndim < sample.ndim:
62
- t = t.unsqueeze(-1)
63
- denom = (1.0 - t).clamp_min(t_eps)
64
- return (model_output - sample) / denom
65
-
66
-
67
- def _unpatchify_latents(latents: torch.Tensor) -> torch.Tensor:
68
- batch_size, num_channels_latents, height, width = latents.shape
69
- latents = latents.reshape(batch_size, num_channels_latents // (2 * 2), 2, 2, height, width)
70
- latents = latents.permute(0, 1, 4, 2, 5, 3)
71
- return latents.reshape(batch_size, num_channels_latents // (2 * 2), height * 2, width * 2)
72
-
73
-
74
- def _flux2_bn_stats(vae: AutoencoderKLFlux2, ref: torch.Tensor) -> tuple[torch.Tensor, torch.Tensor]:
75
- mean = vae.bn.running_mean.view(1, -1, 1, 1).to(ref.device, ref.dtype)
76
- std = torch.sqrt(
77
- vae.bn.running_var.view(1, -1, 1, 1).to(ref.device, ref.dtype) + vae.config.batch_norm_eps
78
- )
79
- return mean, std
80
-
81
-
82
- @torch.no_grad()
83
- def decode_flux2_latents(vae: AutoencoderKLFlux2, latents: torch.Tensor) -> torch.Tensor:
84
- vae_param = next(vae.parameters())
85
- latents = latents.to(device=vae_param.device, dtype=torch.float32)
86
- mean, std = _flux2_bn_stats(vae, latents)
87
- latents = latents * std + mean
88
- latents = _unpatchify_latents(latents)
89
- return vae.decode(latents.to(vae_param.dtype), return_dict=False)[0].float()
90
-
91
- _FLOW_SCHEDULERS = {
92
- "heun": FlowMatchHeunDiscreteScheduler,
93
- "euler": FlowMatchEulerDiscreteScheduler,
94
- }
95
-
96
-
97
- def _new_flow_scheduler(solver: str) -> SchedulerMixin:
98
- if solver not in _FLOW_SCHEDULERS:
99
- raise ValueError("solver must be one of: 'heun', 'euler'.")
100
- return _FLOW_SCHEDULERS[solver]()
101
-
102
-
103
- def _solver_from_scheduler(scheduler: SchedulerMixin | None) -> str:
104
- if isinstance(scheduler, FlowMatchHeunDiscreteScheduler):
105
- return "heun"
106
- if isinstance(scheduler, FlowMatchEulerDiscreteScheduler):
107
- return "euler"
108
- return "heun"
109
-
110
-
111
- class JLTPipeline(DiffusionPipeline):
112
- r"""
113
- Pipeline for class-conditional image generation with JLT (Clean-Latent JiT).
114
-
115
- Latent models (`in_channels=128`) require a FLUX.2 VAE attached for `output_type="pil"`.
116
- """
117
-
118
- model_cpu_offload_seq = "transformer->vae"
119
- _optional_components = ["vae"]
120
-
121
- def __init__(
122
- self,
123
- transformer,
124
- scheduler,
125
- vae=None,
126
- id2label=None,
127
- prediction_type="sample",
128
- t_eps=5e-2,
129
- solver="heun",
130
- ):
131
- super().__init__()
132
- if scheduler is None or isinstance(scheduler, list):
133
- scheduler = _new_flow_scheduler(solver)
134
- self.register_modules(
135
- transformer=transformer,
136
- scheduler=scheduler,
137
- vae=vae,
138
- )
139
- self.prediction_type = prediction_type
140
- self.t_eps = t_eps
141
- self.solver = solver
142
- self._id2label = self._normalize_id2label(id2label)
143
- self.labels = self._build_label2id(self._id2label)
144
- self._labels_loaded_from_model_index = bool(self._id2label)
145
-
146
- @classmethod
147
- def from_pretrained(cls, pretrained_model_name_or_path=None, subfolder=None, **kwargs):
148
- repo_root = Path(__file__).resolve().parent
149
-
150
- if pretrained_model_name_or_path in (None, "", "."):
151
- variant = repo_root
152
- else:
153
- variant = Path(pretrained_model_name_or_path)
154
- if not variant.is_absolute():
155
- candidate = (Path.cwd() / variant).resolve()
156
- variant = candidate if candidate.exists() else (repo_root / variant).resolve()
157
- if subfolder:
158
- variant = variant / subfolder
159
-
160
- model_kwargs = dict(kwargs)
161
- inserted: List[str] = []
162
-
163
- def _load_transformer():
164
- comp_dir = variant / "transformer"
165
- module_path = comp_dir / "transformer_jlt.py"
166
- if not module_path.exists() or not (comp_dir / "config.json").exists():
167
- return None
168
-
169
- comp_path = str(comp_dir)
170
- if comp_path not in sys.path:
171
- sys.path.insert(0, comp_path)
172
- inserted.append(comp_path)
173
-
174
- module = importlib.import_module("transformer_jlt")
175
- transformer_cls = getattr(module, "JLTTransformer2DModel")
176
- return transformer_cls.from_pretrained(str(comp_dir), **model_kwargs)
177
-
178
- def _load_scheduler():
179
- scheduler_dir = variant / "scheduler"
180
- config_path = scheduler_dir / "scheduler_config.json"
181
- if not config_path.exists():
182
- return _new_flow_scheduler("heun")
183
-
184
- scheduler_entry = None
185
- model_index_path = variant / "model_index.json"
186
- if model_index_path.exists():
187
- scheduler_entry = json.loads(model_index_path.read_text(encoding="utf-8")).get("scheduler")
188
-
189
- if scheduler_entry is None:
190
- class_name = json.loads(config_path.read_text(encoding="utf-8")).get("_class_name")
191
- scheduler_entry = ["diffusers", class_name]
192
-
193
- module_name, class_name = scheduler_entry
194
- if module_name == "diffusers":
195
- import diffusers.schedulers as schedulers_pkg
196
-
197
- scheduler_cls = getattr(schedulers_pkg, class_name)
198
- return scheduler_cls.from_pretrained(str(scheduler_dir), **model_kwargs)
199
-
200
- comp_path = str(scheduler_dir)
201
- if comp_path not in sys.path:
202
- sys.path.insert(0, comp_path)
203
- inserted.append(comp_path)
204
- module = importlib.import_module(module_name)
205
- scheduler_cls = getattr(module, class_name)
206
- return scheduler_cls.from_pretrained(str(scheduler_dir), **model_kwargs)
207
-
208
- def _load_vae():
209
- vae_dir = variant / "vae"
210
- if vae_dir.exists() and (vae_dir / "config.json").exists():
211
- return AutoencoderKLFlux2.from_pretrained(str(vae_dir), **model_kwargs)
212
- return None
213
-
214
- try:
215
- transformer = _load_transformer()
216
- if transformer is None:
217
- raise ValueError(f"No loadable transformer found under {variant}")
218
-
219
- scheduler = _load_scheduler()
220
- vae = _load_vae()
221
- id2label = cls._read_id2label_from_model_index(str(variant))
222
- solver = _solver_from_scheduler(scheduler)
223
- pipe = cls(
224
- transformer=transformer,
225
- scheduler=scheduler,
226
- vae=vae,
227
- id2label=id2label or None,
228
- solver=solver,
229
- )
230
- if hasattr(pipe, "register_to_config"):
231
- pipe.register_to_config(_name_or_path=str(variant))
232
- return pipe
233
- finally:
234
- for comp_path in inserted:
235
- if comp_path in sys.path:
236
- sys.path.remove(comp_path)
237
-
238
- @staticmethod
239
- def _normalize_id2label(id2label: Optional[Dict[Union[int, str], str]]) -> Dict[int, str]:
240
- if not id2label:
241
- return {}
242
- return {int(key): value for key, value in id2label.items()}
243
-
244
- @staticmethod
245
- def _read_id2label_from_model_index(variant_path: Optional[str]) -> Dict[int, str]:
246
- if not variant_path:
247
- return {}
248
- model_index_path = Path(variant_path).resolve() / "model_index.json"
249
- if not model_index_path.exists():
250
- return {}
251
- raw = json.loads(model_index_path.read_text(encoding="utf-8"))
252
- id2label = raw.get("id2label")
253
- if not isinstance(id2label, dict):
254
- return {}
255
- return {int(key): value for key, value in id2label.items()}
256
-
257
- @staticmethod
258
- def _build_label2id(id2label: Dict[int, str]) -> Dict[str, int]:
259
- label2id: Dict[str, int] = {}
260
- for class_id, value in id2label.items():
261
- for synonym in value.split(","):
262
- synonym = synonym.strip()
263
- if synonym:
264
- label2id[synonym] = int(class_id)
265
- return dict(sorted(label2id.items()))
266
-
267
- def _ensure_labels_loaded(self) -> None:
268
- if self._labels_loaded_from_model_index:
269
- return
270
- loaded = self._read_id2label_from_model_index(getattr(self.config, "_name_or_path", None))
271
- if loaded:
272
- self._id2label = loaded
273
- self.labels = self._build_label2id(self._id2label)
274
- self._labels_loaded_from_model_index = True
275
-
276
- @property
277
- def id2label(self) -> Dict[int, str]:
278
- self._ensure_labels_loaded()
279
- return self._id2label
280
-
281
- def get_label_ids(self, label: Union[str, List[str]]) -> List[int]:
282
- self._ensure_labels_loaded()
283
- if not self.labels:
284
- raise ValueError("No labels loaded. Ensure `id2label` exists in model_index.json.")
285
- if isinstance(label, str):
286
- label = [label]
287
- missing = [item for item in label if item not in self.labels]
288
- if missing:
289
- preview = ", ".join(list(self.labels.keys())[:8])
290
- raise ValueError(f"Unknown label(s): {missing}. Examples: {preview}, ...")
291
- return [self.labels[item] for item in label]
292
-
293
- def _normalize_class_labels(self, class_labels: Union[int, str, List[Union[int, str]]]) -> List[int]:
294
- if isinstance(class_labels, int):
295
- return [class_labels]
296
- if isinstance(class_labels, str):
297
- return self.get_label_ids(class_labels)
298
- if class_labels and isinstance(class_labels[0], str):
299
- return self.get_label_ids(class_labels)
300
- return list(class_labels)
301
-
302
- def _sampling_dtype(self) -> torch.dtype:
303
- model_dtype = self.transformer.dtype
304
- if model_dtype in (torch.bfloat16, torch.float16):
305
- return torch.float32
306
- return model_dtype
307
-
308
- def _predict_velocity_at_t(
309
- self,
310
- z_value: torch.Tensor,
311
- t_jlt: Union[float, torch.Tensor],
312
- class_labels: torch.Tensor,
313
- class_null: torch.Tensor,
314
- do_classifier_free_guidance: bool,
315
- guidance_scale: float,
316
- guidance_interval_min: float,
317
- guidance_interval_max: float,
318
- ) -> torch.Tensor:
319
- t_jlt = torch.as_tensor(t_jlt, device=z_value.device, dtype=z_value.dtype)
320
- if t_jlt.ndim == 0:
321
- t_jlt = t_jlt.reshape(1)
322
-
323
- if do_classifier_free_guidance:
324
- z_in = torch.cat([z_value, z_value], dim=0)
325
- labels = torch.cat([class_labels, class_null], dim=0)
326
- else:
327
- z_in = z_value
328
- labels = class_labels
329
-
330
- t_batch = t_jlt.flatten().expand(z_in.shape[0])
331
- model_dtype = self.transformer.dtype
332
- use_autocast = model_dtype != torch.float32 and z_value.is_cuda
333
- if use_autocast:
334
- with torch.autocast(device_type=z_value.device.type, dtype=model_dtype):
335
- model_out = self.transformer(
336
- z_in.to(model_dtype),
337
- timestep=t_batch,
338
- class_labels=labels,
339
- ).sample
340
- else:
341
- model_out = self.transformer(z_in, timestep=t_batch, class_labels=labels).sample
342
-
343
- v = velocity_from_prediction(
344
- z_in,
345
- model_out.to(z_value.dtype),
346
- t_jlt,
347
- prediction_type=self.prediction_type,
348
- t_eps=self.t_eps,
349
- )
350
-
351
- if not do_classifier_free_guidance:
352
- return v
353
-
354
- v_cond, v_uncond = v.chunk(2, dim=0)
355
- interval_mask = t_jlt < guidance_interval_max
356
- if guidance_interval_min != 0.0:
357
- interval_mask = interval_mask & (t_jlt > guidance_interval_min)
358
- scale = torch.where(
359
- interval_mask,
360
- torch.tensor(guidance_scale, device=z_value.device, dtype=z_value.dtype),
361
- torch.tensor(1.0, device=z_value.device, dtype=z_value.dtype),
362
- )
363
- return v_uncond + scale * (v_cond - v_uncond)
364
-
365
- def _euler_step(
366
- self,
367
- latents: torch.Tensor,
368
- t_cur: torch.Tensor,
369
- t_next: torch.Tensor,
370
- class_labels: torch.Tensor,
371
- class_null: torch.Tensor,
372
- do_classifier_free_guidance: bool,
373
- guidance_scale: float,
374
- guidance_interval_min: float,
375
- guidance_interval_max: float,
376
- ) -> torch.Tensor:
377
- dt = t_next - t_cur
378
- velocity = self._predict_velocity_at_t(
379
- latents,
380
- t_cur,
381
- class_labels,
382
- class_null,
383
- do_classifier_free_guidance,
384
- guidance_scale,
385
- guidance_interval_min,
386
- guidance_interval_max,
387
- )
388
- return latents + dt * velocity
389
-
390
- def _heun_step(
391
- self,
392
- latents: torch.Tensor,
393
- t_cur: torch.Tensor,
394
- t_next: torch.Tensor,
395
- class_labels: torch.Tensor,
396
- class_null: torch.Tensor,
397
- do_classifier_free_guidance: bool,
398
- guidance_scale: float,
399
- guidance_interval_min: float,
400
- guidance_interval_max: float,
401
- ) -> torch.Tensor:
402
- dt = t_next - t_cur
403
- velocity_1 = self._predict_velocity_at_t(
404
- latents,
405
- t_cur,
406
- class_labels,
407
- class_null,
408
- do_classifier_free_guidance,
409
- guidance_scale,
410
- guidance_interval_min,
411
- guidance_interval_max,
412
- )
413
- velocity_2 = self._predict_velocity_at_t(
414
- latents + dt * velocity_1,
415
- t_next,
416
- class_labels,
417
- class_null,
418
- do_classifier_free_guidance,
419
- guidance_scale,
420
- guidance_interval_min,
421
- guidance_interval_max,
422
- )
423
- return latents + dt * 0.5 * (velocity_1 + velocity_2)
424
-
425
- def _run_sampler(
426
- self,
427
- latents: torch.Tensor,
428
- class_labels: torch.Tensor,
429
- class_null: torch.Tensor,
430
- num_inference_steps: int,
431
- do_classifier_free_guidance: bool,
432
- guidance_scale: float,
433
- guidance_interval_min: float,
434
- guidance_interval_max: float,
435
- ) -> torch.Tensor:
436
- solver = self.solver
437
- if solver not in _FLOW_SCHEDULERS:
438
- raise ValueError("pipeline solver must be one of: 'heun', 'euler'.")
439
-
440
- device = latents.device
441
- dtype = self._sampling_dtype()
442
- latents = latents.to(dtype=dtype)
443
- ts = torch.linspace(0.0, 1.0, num_inference_steps + 1, device=device, dtype=dtype)
444
- step_kwargs = (
445
- class_labels,
446
- class_null,
447
- do_classifier_free_guidance,
448
- guidance_scale,
449
- guidance_interval_min,
450
- guidance_interval_max,
451
- )
452
-
453
- if solver == "heun":
454
- for step_idx in self.progress_bar(range(num_inference_steps - 1)):
455
- latents = self._heun_step(latents, ts[step_idx], ts[step_idx + 1], *step_kwargs)
456
- latents = self._euler_step(latents, ts[-2], ts[-1], *step_kwargs)
457
- return latents
458
-
459
- for step_idx in self.progress_bar(range(num_inference_steps)):
460
- latents = self._euler_step(latents, ts[step_idx], ts[step_idx + 1], *step_kwargs)
461
- return latents
462
-
463
- @torch.inference_mode()
464
- def __call__(
465
- self,
466
- class_labels: Union[int, str, List[Union[int, str]]],
467
- guidance_scale: Optional[float] = None,
468
- guidance_interval_min: float = 0.1,
469
- guidance_interval_max: float = 1.0,
470
- noise_scale: float = 1.0,
471
- t_eps: Optional[float] = None,
472
- generator: Optional[Union[torch.Generator, List[torch.Generator]]] = None,
473
- num_inference_steps: int = 50,
474
- output_type: Optional[str] = "pil",
475
- return_dict: bool = True,
476
- ) -> Union[ImagePipelineOutput, Tuple]:
477
- if num_inference_steps < 2:
478
- raise ValueError("num_inference_steps must be >= 2.")
479
- if output_type not in {"pil", "np", "pt", "latent"}:
480
- raise ValueError("output_type must be one of: 'pil', 'np', 'pt', 'latent'.")
481
-
482
- if t_eps is not None:
483
- self.t_eps = t_eps
484
-
485
- class_label_ids = self._normalize_class_labels(class_labels)
486
- do_classifier_free_guidance = guidance_scale is not None and guidance_scale > 1.0
487
-
488
- batch_size = len(class_label_ids)
489
- latent_size = int(self.transformer.config.sample_size)
490
- channels = int(self.transformer.config.in_channels)
491
- null_class_val = int(
492
- getattr(self.transformer.config, "num_classes", getattr(self.transformer.config, "num_class_embeds", 1000))
493
- )
494
-
495
- if guidance_scale is None:
496
- guidance_scale = 1.0
497
-
498
- latents = randn_tensor(
499
- shape=(batch_size, channels, latent_size, latent_size),
500
- generator=generator,
501
- device=self._execution_device,
502
- dtype=self._sampling_dtype(),
503
- ) * noise_scale
504
-
505
- class_labels_t = torch.tensor(class_label_ids, device=self._execution_device, dtype=torch.long).reshape(-1)
506
- class_labels_t = class_labels_t.clamp(0, null_class_val - 1)
507
- class_null = torch.full_like(class_labels_t, null_class_val)
508
-
509
- latents = self._run_sampler(
510
- latents,
511
- class_labels_t,
512
- class_null,
513
- num_inference_steps,
514
- do_classifier_free_guidance,
515
- guidance_scale,
516
- guidance_interval_min,
517
- guidance_interval_max,
518
- )
519
-
520
- if output_type == "latent":
521
- if not return_dict:
522
- return (latents,)
523
- return ImagePipelineOutput(images=latents)
524
-
525
- if self.vae is not None:
526
- images_pt = decode_flux2_latents(self.vae, latents)
527
- else:
528
- images_pt = latents
529
-
530
- if not torch.isfinite(images_pt).all():
531
- raise RuntimeError(
532
- "JLT generation produced non-finite values before image conversion. "
533
- "Restart the notebook kernel and re-run the pipeline load cell."
534
- )
535
-
536
- images_pt = ((images_pt.float().clamp(-1, 1) + 1.0) / 2.0).cpu()
537
- if output_type == "pt":
538
- images = images_pt
539
- elif output_type == "np":
540
- images = images_pt.permute(0, 2, 3, 1).numpy()
541
- else:
542
- images = self.numpy_to_pil(images_pt.permute(0, 2, 3, 1).numpy())
543
-
544
- self.maybe_free_model_hooks()
545
-
546
- if not return_dict:
547
- return (images,)
548
- return ImagePipelineOutput(images=images)
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
JLT-H-1-256/scheduler/scheduler_config.json DELETED
@@ -1,6 +0,0 @@
1
- {
2
- "_class_name": "FlowMatchHeunDiscreteScheduler",
3
- "_diffusers_version": "0.38.0",
4
- "num_train_timesteps": 1000,
5
- "shift": 4.0
6
- }
 
 
 
 
 
 
 
JLT-H-1-256/transformer/__pycache__/transformer_jlt.cpython-312.pyc DELETED
Binary file (38.5 kB)
 
JLT-H-1-256/transformer/config.json DELETED
@@ -1,21 +0,0 @@
1
- {
2
- "_class_name": "JLTTransformer2DModel",
3
- "_diffusers_version": "0.38.0",
4
- "attention_dropout": 0.0,
5
- "dropout": 0.0,
6
- "hidden_size": 1280,
7
- "in_channels": 128,
8
- "loop_count": 0,
9
- "loop_indices": null,
10
- "mask_prob": 0.0,
11
- "mask_ratio": 0.0,
12
- "mlp_ratio": 4.0,
13
- "model_type": "JiT-H/1",
14
- "norm_eps": 1e-06,
15
- "num_attention_heads": 20,
16
- "num_class_embeds": null,
17
- "num_classes": 1000,
18
- "num_layers": 32,
19
- "patch_size": 1,
20
- "sample_size": 16
21
- }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
JLT-H-1-256/transformer/diffusion_pytorch_model.safetensors DELETED
@@ -1,3 +0,0 @@
1
- version https://git-lfs.github.com/spec/v1
2
- oid sha256:dd1463bd2ac82d085c2c951be3e1a95bd44d8a8439588b541d3f244a4cd036ea
3
- size 3805219168
 
 
 
 
JLT-H-1-256/transformer/transformer_jlt.py DELETED
@@ -1,648 +0,0 @@
1
- """JLT (Clean-Latent) Transformer for diffusers."""
2
-
3
- from __future__ import annotations
4
-
5
- import argparse
6
- import math
7
- from collections.abc import Mapping
8
- from typing import Dict, List, Optional, Tuple
9
-
10
- import torch
11
- import torch.nn as nn
12
- import torch.nn.functional as F
13
- from diffusers.configuration_utils import ConfigMixin, register_to_config
14
- from diffusers.models.modeling_outputs import Transformer2DModelOutput
15
- from diffusers.models.modeling_utils import ModelMixin
16
- from diffusers.models.normalization import RMSNorm
17
- from einops import rearrange, repeat
18
-
19
- try:
20
- from flash_attn.cute import flash_attn_func as _flash_attn_func
21
-
22
- _HAS_FLASH_ATTN = True
23
- except ImportError:
24
- _HAS_FLASH_ATTN = False
25
-
26
-
27
- JLT_PRESET_CONFIGS: Dict[str, Dict[str, object]] = {
28
- "JiT-B/1": {
29
- "sample_size": 16,
30
- "patch_size": 1,
31
- "hidden_size": 768,
32
- "num_layers": 12,
33
- "num_attention_heads": 12,
34
- "attention_dropout": 0.0,
35
- "dropout": 0.0,
36
- },
37
- "JiT-B/2": {
38
- "sample_size": 16,
39
- "patch_size": 2,
40
- "hidden_size": 768,
41
- "num_layers": 12,
42
- "num_attention_heads": 12,
43
- "attention_dropout": 0.0,
44
- "dropout": 0.0,
45
- },
46
- "JiT-B/16": {
47
- "sample_size": 256,
48
- "patch_size": 16,
49
- "hidden_size": 768,
50
- "num_layers": 12,
51
- "num_attention_heads": 12,
52
- "attention_dropout": 0.0,
53
- "dropout": 0.0,
54
- },
55
- "JiT-B/32": {
56
- "sample_size": 512,
57
- "patch_size": 32,
58
- "hidden_size": 768,
59
- "num_layers": 12,
60
- "num_attention_heads": 12,
61
- "attention_dropout": 0.0,
62
- "dropout": 0.0,
63
- },
64
- "JiT-L/16": {
65
- "sample_size": 256,
66
- "patch_size": 16,
67
- "hidden_size": 1024,
68
- "num_layers": 24,
69
- "num_attention_heads": 16,
70
- "attention_dropout": 0.0,
71
- "dropout": 0.0,
72
- },
73
- "JiT-L/32": {
74
- "sample_size": 512,
75
- "patch_size": 32,
76
- "hidden_size": 1024,
77
- "num_layers": 24,
78
- "num_attention_heads": 16,
79
- "attention_dropout": 0.0,
80
- "dropout": 0.0,
81
- },
82
- "JiT-H/1": {
83
- "sample_size": 16,
84
- "patch_size": 1,
85
- "hidden_size": 1280,
86
- "num_layers": 32,
87
- "num_attention_heads": 20,
88
- "attention_dropout": 0.0,
89
- "dropout": 0.2,
90
- },
91
- "JiT-H/16": {
92
- "sample_size": 256,
93
- "patch_size": 16,
94
- "hidden_size": 1280,
95
- "num_layers": 32,
96
- "num_attention_heads": 16,
97
- "attention_dropout": 0.0,
98
- "dropout": 0.2,
99
- },
100
- "JiT-H/32": {
101
- "sample_size": 512,
102
- "patch_size": 32,
103
- "hidden_size": 1280,
104
- "num_layers": 32,
105
- "num_attention_heads": 16,
106
- "attention_dropout": 0.0,
107
- "dropout": 0.2,
108
- },
109
- }
110
-
111
-
112
- def remap_legacy_state_dict(state_dict: Dict[str, torch.Tensor]) -> Dict[str, torch.Tensor]:
113
- """Map legacy JLT/Denoiser checkpoint keys to native transformer keys."""
114
- remapped: Dict[str, torch.Tensor] = {}
115
- for key, value in state_dict.items():
116
- new_key = key
117
- for prefix in ("transformer.", "net."):
118
- if new_key.startswith(prefix):
119
- new_key = new_key[len(prefix) :]
120
- break
121
-
122
- if new_key.startswith("final_layer."):
123
- new_key = new_key.replace("final_layer.norm_final", "norm_final")
124
- new_key = new_key.replace("final_layer.linear", "linear_final")
125
- new_key = new_key.replace("final_layer.adaLN_modulation", "adaLN_modulation_final")
126
-
127
- remapped[new_key] = value
128
- return remapped
129
-
130
-
131
- def config_from_legacy(config: Dict[str, object]) -> Dict[str, object]:
132
- model_type = config.get("model_type") or config.get("model") or config.get("model_name")
133
- if model_type not in JLT_PRESET_CONFIGS:
134
- raise ValueError(f"Unknown JLT preset '{model_type}'. Known: {list(JLT_PRESET_CONFIGS)}")
135
-
136
- preset = dict(JLT_PRESET_CONFIGS[model_type])
137
- preset["num_classes"] = int(config.get("num_class_embeds") or config.get("num_classes") or config.get("class_num") or 1000)
138
- if config.get("attn_dropout") is not None:
139
- preset["attention_dropout"] = float(config["attn_dropout"])
140
- if config.get("proj_dropout") is not None:
141
- preset["dropout"] = float(config["proj_dropout"])
142
- if config.get("sample_size") is not None:
143
- preset["sample_size"] = int(config["sample_size"])
144
- if config.get("img_size") is not None and config.get("patch_size") is not None:
145
- preset["sample_size"] = int(config["img_size"]) // int(config.get("spatial_compression", 16))
146
- preset["model_type"] = model_type
147
- return preset
148
-
149
-
150
- def broadcat(tensors, dim=-1):
151
- num_tensors = len(tensors)
152
- shape_lens = {len(t.shape) for t in tensors}
153
- if len(shape_lens) != 1:
154
- raise ValueError("tensors must all have the same number of dimensions")
155
- shape_len = list(shape_lens)[0]
156
- dim = (dim + shape_len) if dim < 0 else dim
157
- dims = list(zip(*(list(t.shape) for t in tensors)))
158
- expandable_dims = [(i, val) for i, val in enumerate(dims) if i != dim]
159
- if not all(len(set(t[1])) <= 2 for t in expandable_dims):
160
- raise ValueError("invalid dimensions for broadcastable concatenation")
161
- max_dims = [(t[0], max(t[1])) for t in expandable_dims]
162
- expanded_dims = [(t[0], (t[1],) * num_tensors) for t in max_dims]
163
- expanded_dims.insert(dim, (dim, dims[dim]))
164
- expandable_shapes = list(zip(*(t[1] for t in expanded_dims)))
165
- tensors = [t[0].expand(*t[1]) for t in zip(tensors, expandable_shapes)]
166
- return torch.cat(tensors, dim=dim)
167
-
168
-
169
- def rotate_half(x):
170
- x = rearrange(x, "... (d r) -> ... d r", r=2)
171
- x1, x2 = x.unbind(dim=-1)
172
- x = torch.stack((-x2, x1), dim=-1)
173
- return rearrange(x, "... d r -> ... (d r)")
174
-
175
-
176
- class JLTRotaryEmbedding(nn.Module):
177
- def __init__(self, dim, pt_seq_len=16, ft_seq_len=None, theta=10000, num_cls_token=0):
178
- super().__init__()
179
- freqs = 1.0 / (theta ** (torch.arange(0, dim, 2)[: (dim // 2)].float() / dim))
180
- if ft_seq_len is None:
181
- ft_seq_len = pt_seq_len
182
- t = torch.arange(ft_seq_len) / ft_seq_len * pt_seq_len
183
-
184
- freqs = torch.einsum("..., f -> ... f", t, freqs)
185
- freqs = repeat(freqs, "... n -> ... (n r)", r=2)
186
- freqs = broadcat((freqs[:, None, :], freqs[None, :, :]), dim=-1)
187
-
188
- if num_cls_token > 0:
189
- freqs_flat = freqs.view(-1, freqs.shape[-1])
190
- cos_img = freqs_flat.cos()
191
- sin_img = freqs_flat.sin()
192
- _, dim_freq = cos_img.shape
193
- cos_pad = torch.ones(num_cls_token, dim_freq, dtype=cos_img.dtype)
194
- sin_pad = torch.zeros(num_cls_token, dim_freq, dtype=sin_img.dtype)
195
- self.register_buffer("freqs_cos", torch.cat([cos_pad, cos_img], dim=0), persistent=False)
196
- self.register_buffer("freqs_sin", torch.cat([sin_pad, sin_img], dim=0), persistent=False)
197
- else:
198
- self.register_buffer("freqs_cos", freqs.cos().view(-1, freqs.shape[-1]), persistent=False)
199
- self.register_buffer("freqs_sin", freqs.sin().view(-1, freqs.shape[-1]), persistent=False)
200
-
201
- def forward(self, tensor):
202
- seq_len = tensor.shape[1] if tensor.ndim == 4 else tensor.shape[-2]
203
- fc = self.freqs_cos[:seq_len].to(device=tensor.device, dtype=tensor.dtype)
204
- fs = self.freqs_sin[:seq_len].to(device=tensor.device, dtype=tensor.dtype)
205
- if tensor.ndim == 4:
206
- return tensor * fc[:, None, :] + rotate_half(tensor) * fs[:, None, :]
207
- return tensor * fc + rotate_half(tensor) * fs
208
-
209
-
210
- def modulate(x, shift, scale):
211
- if shift.ndim == x.ndim - 1:
212
- shift = shift.unsqueeze(1)
213
- scale = scale.unsqueeze(1)
214
- return x * (1 + scale) + shift
215
-
216
-
217
- class JLTPatchEmbed(nn.Module):
218
- def __init__(self, img_size=224, patch_size=16, in_chans=3, embed_dim=768, bias=True):
219
- super().__init__()
220
- img_size = (img_size, img_size)
221
- patch_size = (patch_size, patch_size)
222
- self.img_size = img_size
223
- self.patch_size = patch_size
224
- self.num_patches = (img_size[1] // patch_size[1]) * (img_size[0] // patch_size[0])
225
- self.proj = nn.Conv2d(in_chans, embed_dim, kernel_size=patch_size, stride=patch_size, bias=bias)
226
-
227
- def forward(self, x):
228
- batch, _, height, width = x.shape
229
- if height != self.img_size[0] or width != self.img_size[1]:
230
- raise ValueError(
231
- f"Input image size ({height}*{width}) doesn't match model ({self.img_size[0]}*{self.img_size[1]})."
232
- )
233
- return self.proj(x).flatten(2).transpose(1, 2)
234
-
235
-
236
- class JLTTimestepEmbedder(nn.Module):
237
- def __init__(self, hidden_size, frequency_embedding_size=256):
238
- super().__init__()
239
- self.mlp = nn.Sequential(
240
- nn.Linear(frequency_embedding_size, hidden_size, bias=True),
241
- nn.SiLU(),
242
- nn.Linear(hidden_size, hidden_size, bias=True),
243
- )
244
- self.frequency_embedding_size = frequency_embedding_size
245
-
246
- @staticmethod
247
- def timestep_embedding(t, dim, max_period=10000):
248
- half = dim // 2
249
- freqs = torch.exp(
250
- -math.log(max_period) * torch.arange(start=0, end=half, dtype=torch.float32, device=t.device) / half
251
- )
252
- args = t.float().unsqueeze(-1) * freqs
253
- embedding = torch.cat([torch.cos(args), torch.sin(args)], dim=-1)
254
- if dim % 2:
255
- embedding = torch.cat([embedding, torch.zeros_like(embedding[..., :1])], dim=-1)
256
- return embedding.to(t.dtype)
257
-
258
- def forward(self, t, dtype=None):
259
- t_freq = self.timestep_embedding(t, self.frequency_embedding_size)
260
- if dtype is not None:
261
- t_freq = t_freq.to(dtype=dtype)
262
- return self.mlp(t_freq)
263
-
264
-
265
- class JLTLabelEmbedder(nn.Module):
266
- def __init__(self, num_classes, hidden_size):
267
- super().__init__()
268
- self.embedding_table = nn.Embedding(num_classes + 1, hidden_size)
269
- self.num_classes = num_classes
270
-
271
- def forward(self, labels):
272
- return self.embedding_table(labels)
273
-
274
-
275
- class JLTAttention(nn.Module):
276
- def __init__(self, dim, num_heads=8, qkv_bias=True, qk_norm=True, attn_drop=0.0, proj_drop=0.0, eps=1e-6):
277
- super().__init__()
278
- self.num_heads = num_heads
279
- head_dim = dim // num_heads
280
- self.q_norm = RMSNorm(head_dim, eps=eps) if qk_norm else nn.Identity()
281
- self.k_norm = RMSNorm(head_dim, eps=eps) if qk_norm else nn.Identity()
282
- self.qkv = nn.Linear(dim, dim * 3, bias=qkv_bias)
283
- self.attn_drop = attn_drop
284
- self.proj = nn.Linear(dim, dim)
285
- self.proj_drop = nn.Dropout(proj_drop)
286
-
287
- def forward(self, x, rope=None):
288
- batch, num_tokens, channels = x.shape
289
- qkv = self.qkv(x).reshape(batch, num_tokens, 3, self.num_heads, channels // self.num_heads).permute(2, 0, 3, 1, 4)
290
- q, k, v = qkv[0], qkv[1], qkv[2]
291
- q = self.q_norm(q)
292
- k = self.k_norm(k)
293
- if rope is not None:
294
- q = q.transpose(1, 2)
295
- k = k.transpose(1, 2)
296
- q = rope(q)
297
- k = rope(k)
298
- q = q.transpose(1, 2)
299
- k = k.transpose(1, 2)
300
-
301
- if _HAS_FLASH_ATTN:
302
- attn_dtype = q.dtype if q.dtype in (torch.float16, torch.bfloat16) else torch.bfloat16
303
- q = q.transpose(1, 2).contiguous().to(attn_dtype)
304
- k = k.transpose(1, 2).contiguous().to(attn_dtype)
305
- v = v.transpose(1, 2).contiguous().to(attn_dtype)
306
- x, _ = _flash_attn_func(q, k, v, causal=False)
307
- x = x.reshape(batch, num_tokens, channels)
308
- else:
309
- dropout_p = self.attn_drop if self.training else 0.0
310
- x = F.scaled_dot_product_attention(q, k, v, dropout_p=dropout_p)
311
- x = x.transpose(1, 2).reshape(batch, num_tokens, channels)
312
-
313
- x = self.proj(x)
314
- return self.proj_drop(x)
315
-
316
-
317
- class JLTSwiGLUFFN(nn.Module):
318
- def __init__(self, dim: int, hidden_dim: int, drop=0.0, bias=True) -> None:
319
- super().__init__()
320
- hidden_dim = int(hidden_dim * 2 / 3)
321
- self.w12 = nn.Linear(dim, 2 * hidden_dim, bias=bias)
322
- self.w3 = nn.Linear(hidden_dim, dim, bias=bias)
323
- self.ffn_dropout = nn.Dropout(drop)
324
-
325
- def forward(self, x):
326
- x12 = self.w12(x)
327
- x1, x2 = x12.chunk(2, dim=-1)
328
- return self.w3(self.ffn_dropout(F.silu(x1) * x2))
329
-
330
-
331
- class JLTBlock(nn.Module):
332
- def __init__(self, hidden_size, num_heads, mlp_ratio=4.0, attn_drop=0.0, proj_drop=0.0, eps=1e-6):
333
- super().__init__()
334
- self.norm1 = RMSNorm(hidden_size, eps=eps)
335
- self.attn = JLTAttention(
336
- hidden_size,
337
- num_heads=num_heads,
338
- qkv_bias=True,
339
- qk_norm=True,
340
- attn_drop=attn_drop,
341
- proj_drop=proj_drop,
342
- eps=eps,
343
- )
344
- self.norm2 = RMSNorm(hidden_size, eps=eps)
345
- self.mlp = JLTSwiGLUFFN(hidden_size, int(hidden_size * mlp_ratio), drop=proj_drop)
346
- self.adaLN_modulation = nn.Sequential(
347
- nn.SiLU(),
348
- nn.Linear(hidden_size, 6 * hidden_size, bias=True),
349
- )
350
-
351
- def forward(self, x, c, feat_rope=None):
352
- shift_msa, scale_msa, gate_msa, shift_mlp, scale_mlp, gate_mlp = self.adaLN_modulation(c).chunk(6, dim=-1)
353
- if gate_msa.ndim == x.ndim - 1:
354
- gate_msa = gate_msa.unsqueeze(1)
355
- gate_mlp = gate_mlp.unsqueeze(1)
356
- x = x + gate_msa * self.attn(modulate(self.norm1(x), shift_msa, scale_msa), rope=feat_rope)
357
- x = x + gate_mlp * self.mlp(modulate(self.norm2(x), shift_mlp, scale_mlp))
358
- return x
359
-
360
-
361
- class JLTTransformer2DModel(ModelMixin, ConfigMixin):
362
- _supports_gradient_checkpointing = True
363
-
364
- @register_to_config
365
- def __init__(
366
- self,
367
- sample_size: int = 16,
368
- patch_size: int = 1,
369
- in_channels: int = 128,
370
- hidden_size: int = 768,
371
- num_layers: int = 12,
372
- num_attention_heads: int = 12,
373
- mlp_ratio: float = 4.0,
374
- attention_dropout: float = 0.0,
375
- dropout: float = 0.0,
376
- num_classes: int = 1000,
377
- norm_eps: float = 1e-6,
378
- model_type: str | None = None,
379
- num_class_embeds: int | None = None,
380
- mask_prob: float = 0.0,
381
- mask_ratio: float = 0.0,
382
- loop_indices: Optional[List[int]] = None,
383
- loop_count: int = 0,
384
- ):
385
- super().__init__()
386
- if num_class_embeds is not None:
387
- num_classes = int(num_class_embeds)
388
- if model_type in JLT_PRESET_CONFIGS:
389
- preset = JLT_PRESET_CONFIGS[model_type]
390
- sample_size = int(preset["sample_size"])
391
- patch_size = int(preset["patch_size"])
392
- hidden_size = int(preset["hidden_size"])
393
- num_layers = int(preset["num_layers"])
394
- num_attention_heads = int(preset["num_attention_heads"])
395
- if attention_dropout == 0.0:
396
- attention_dropout = float(preset["attention_dropout"])
397
- if dropout == 0.0:
398
- dropout = float(preset["dropout"])
399
-
400
- self.sample_size = sample_size
401
- self.patch_size = patch_size
402
- self.in_channels = in_channels
403
- self.out_channels = in_channels
404
- self.hidden_size = hidden_size
405
- self.num_layers = num_layers
406
- self.num_attention_heads = num_attention_heads
407
- self.mask_prob = float(mask_prob)
408
- self.mask_ratio = float(mask_ratio)
409
- self.loop_count = int(loop_count)
410
- self.gradient_checkpointing = False
411
-
412
- self.mask_token = nn.Parameter(torch.zeros(1, 1, hidden_size))
413
- nn.init.normal_(self.mask_token, std=0.02)
414
-
415
- self.loop_indices: Optional[Tuple[int, ...]] = None
416
- if loop_indices and self.loop_count > 0:
417
- sorted_idx = sorted(int(x) for x in loop_indices)
418
- if len(set(sorted_idx)) != len(sorted_idx):
419
- raise ValueError(f"loop_indices must be unique, got {loop_indices}.")
420
- for i in range(1, len(sorted_idx)):
421
- if sorted_idx[i] != sorted_idx[i - 1] + 1:
422
- raise ValueError(f"loop_indices must be consecutive integers, got {sorted_idx}.")
423
- if sorted_idx[0] < 0 or sorted_idx[-1] >= num_layers:
424
- raise ValueError(f"loop_indices must lie in [0, {num_layers}), got {sorted_idx}.")
425
- self.loop_indices = tuple(sorted_idx)
426
-
427
- self.t_embedder = JLTTimestepEmbedder(hidden_size)
428
- self.y_embedder = JLTLabelEmbedder(num_classes, hidden_size)
429
- self.x_embedder = JLTPatchEmbed(sample_size, patch_size, in_channels, hidden_size, bias=True)
430
-
431
- half_head_dim = hidden_size // num_attention_heads // 2
432
- hw_seq_len = sample_size // patch_size
433
- self.feat_rope = JLTRotaryEmbedding(dim=half_head_dim, pt_seq_len=hw_seq_len, num_cls_token=0)
434
-
435
- self.blocks = nn.ModuleList(
436
- [
437
- JLTBlock(
438
- hidden_size,
439
- num_attention_heads,
440
- mlp_ratio=mlp_ratio,
441
- attn_drop=attention_dropout if (num_layers // 4 * 3 > i >= num_layers // 4) else 0.0,
442
- proj_drop=dropout if (num_layers // 4 * 3 > i >= num_layers // 4) else 0.0,
443
- eps=norm_eps,
444
- )
445
- for i in range(num_layers)
446
- ]
447
- )
448
-
449
- self.norm_final = RMSNorm(hidden_size, eps=norm_eps)
450
- self.linear_final = nn.Linear(hidden_size, patch_size * patch_size * self.out_channels, bias=True)
451
- self.adaLN_modulation_final = nn.Sequential(
452
- nn.SiLU(),
453
- nn.Linear(hidden_size, 2 * hidden_size, bias=True),
454
- )
455
-
456
- self.initialize_weights()
457
-
458
- def initialize_weights(self):
459
- def _basic_init(module):
460
- if isinstance(module, nn.Linear):
461
- torch.nn.init.xavier_uniform_(module.weight)
462
- if module.bias is not None:
463
- nn.init.constant_(module.bias, 0)
464
-
465
- self.apply(_basic_init)
466
-
467
- w = self.x_embedder.proj.weight.data
468
- nn.init.xavier_uniform_(w.view([w.shape[0], -1]))
469
- nn.init.constant_(self.x_embedder.proj.bias, 0)
470
- nn.init.normal_(self.y_embedder.embedding_table.weight, std=0.02)
471
- nn.init.normal_(self.t_embedder.mlp[0].weight, std=0.02)
472
- nn.init.normal_(self.t_embedder.mlp[2].weight, std=0.02)
473
-
474
- for block in self.blocks:
475
- nn.init.constant_(block.adaLN_modulation[-1].weight, 0)
476
- nn.init.constant_(block.adaLN_modulation[-1].bias, 0)
477
-
478
- nn.init.constant_(self.adaLN_modulation_final[-1].weight, 0)
479
- nn.init.constant_(self.adaLN_modulation_final[-1].bias, 0)
480
- nn.init.constant_(self.linear_final.weight, 0)
481
- nn.init.constant_(self.linear_final.bias, 0)
482
-
483
- def _block_schedule(self) -> List[int]:
484
- if self.loop_indices is not None and self.loop_count > 0:
485
- a, b = self.loop_indices[0], self.loop_indices[-1]
486
- return list(range(0, a)) + list(range(a, b + 1)) * self.loop_count + list(range(b + 1, len(self.blocks)))
487
- return list(range(len(self.blocks)))
488
-
489
- def forward(
490
- self,
491
- sample: torch.Tensor,
492
- timestep: torch.Tensor,
493
- class_labels: torch.Tensor,
494
- return_dict: bool = True,
495
- return_features: bool = False,
496
- feature_layers: Optional[List[int]] = None,
497
- ):
498
- t = torch.as_tensor(timestep, device=sample.device)
499
- if t.ndim == 0:
500
- t = t.repeat(sample.shape[0])
501
- elif t.ndim == 1 and t.shape[0] == 1 and sample.shape[0] > 1:
502
- t = t.repeat(sample.shape[0])
503
-
504
- t_emb = self.t_embedder(t, dtype=sample.dtype)
505
- y_emb = self.y_embedder(class_labels).to(dtype=sample.dtype)
506
- if t_emb.ndim == 3:
507
- y_emb = y_emb.unsqueeze(1)
508
- c = t_emb + y_emb
509
-
510
- x = self.x_embedder(sample)
511
- if self.training and self.mask_prob > 0.0 and self.mask_ratio > 0.0:
512
- batch, num_tokens, _ = x.shape
513
- s_mask = torch.rand(batch, device=x.device) < self.mask_prob
514
- t_mask = torch.rand(batch, num_tokens, device=x.device) < self.mask_ratio
515
- mask = (s_mask.unsqueeze(1) & t_mask).unsqueeze(-1)
516
- x = torch.where(mask, self.mask_token.to(x.dtype), x)
517
-
518
- target_layers = set(feature_layers or [])
519
- features = {} if return_features else None
520
-
521
- for layer_idx in self._block_schedule():
522
- if self.training and self.gradient_checkpointing:
523
- x = torch.utils.checkpoint.checkpoint(
524
- self.blocks[layer_idx], x, c, self.feat_rope, use_reentrant=False
525
- )
526
- else:
527
- x = self.blocks[layer_idx](x, c, self.feat_rope)
528
- if return_features and layer_idx in target_layers:
529
- features[layer_idx] = x
530
-
531
- shift, scale = self.adaLN_modulation_final(c).chunk(2, dim=-1)
532
- x = modulate(self.norm_final(x), shift, scale)
533
- x = self.linear_final(x)
534
-
535
- height = width = int(x.shape[1] ** 0.5)
536
- x = x.reshape(x.shape[0], height, width, self.patch_size, self.patch_size, self.out_channels)
537
- x = torch.einsum("nhwpqc->nchpwq", x)
538
- output = x.reshape(x.shape[0], self.out_channels, height * self.patch_size, width * self.patch_size)
539
-
540
- if return_features:
541
- if not return_dict:
542
- return (output, features)
543
- return Transformer2DModelOutput(sample=output), features
544
-
545
- if not return_dict:
546
- return (output,)
547
- return Transformer2DModelOutput(sample=output)
548
-
549
- @classmethod
550
- def from_jlt_checkpoint(
551
- cls,
552
- checkpoint_path: str,
553
- weights: str = "ema1",
554
- map_location: str = "cpu",
555
- strict: bool = True,
556
- in_channels: int | None = None,
557
- ) -> Tuple["JLTTransformer2DModel", Dict[str, object]]:
558
- checkpoint = torch.load(checkpoint_path, map_location=map_location, weights_only=False)
559
- if "args" not in checkpoint:
560
- raise ValueError("Checkpoint is missing 'args', cannot infer JLT architecture config.")
561
-
562
- ckpt_args = checkpoint["args"]
563
- if isinstance(ckpt_args, argparse.Namespace):
564
- args_dict = vars(ckpt_args)
565
- elif isinstance(ckpt_args, Mapping):
566
- args_dict = dict(ckpt_args)
567
- else:
568
- raise TypeError(f"Unsupported checkpoint args type: {type(ckpt_args)}")
569
-
570
- model_type = args_dict.get("model") or args_dict.get("model_name") or args_dict.get("model_type")
571
- if model_type not in JLT_PRESET_CONFIGS:
572
- raise ValueError(f"Unknown JLT preset '{model_type}'.")
573
-
574
- config = dict(JLT_PRESET_CONFIGS[model_type])
575
- config["num_classes"] = int(args_dict.get("class_num") or args_dict.get("num_classes") or 1000)
576
- config["model_type"] = model_type
577
- config["attention_dropout"] = float(
578
- args_dict.get("attn_dropout", args_dict.get("attention_dropout", config["attention_dropout"]))
579
- )
580
- config["dropout"] = float(args_dict.get("proj_dropout", args_dict.get("dropout", config["dropout"])))
581
- if in_channels is not None:
582
- config["in_channels"] = in_channels
583
- elif args_dict.get("vae_type") == "flux2":
584
- config["in_channels"] = 128
585
-
586
- if args_dict.get("img_size") and args_dict.get("vae_type") == "flux2":
587
- spatial_compression = 16
588
- config["sample_size"] = int(args_dict["img_size"]) // spatial_compression
589
-
590
- mask_prob = float(args_dict.get("mask_prob", 0.0) or 0.0)
591
- if mask_prob > 0.0:
592
- config["mask_prob"] = mask_prob
593
- config["mask_ratio"] = float(args_dict.get("mask_ratio", 0.0) or 0.0)
594
-
595
- loop_count = int(args_dict.get("loop_count", 0) or 0)
596
- if loop_count > 0:
597
- loop_indices_raw = str(args_dict.get("loop_indices", "") or "")
598
- loop_indices = [int(x) for x in loop_indices_raw.split(",") if x.strip()]
599
- if loop_indices:
600
- config["loop_indices"] = loop_indices
601
- config["loop_count"] = loop_count
602
-
603
- model = cls(**config)
604
-
605
- if weights == "model":
606
- key = "model"
607
- else:
608
- key = f"model_{weights}" if weights in {"ema1", "ema2"} else "model"
609
-
610
- if key not in checkpoint:
611
- raise ValueError(f"Checkpoint key '{key}' not found. Available keys: {list(checkpoint.keys())}")
612
-
613
- state_dict = remap_legacy_state_dict(checkpoint[key])
614
- model.load_state_dict(state_dict, strict=strict)
615
-
616
- metadata = {
617
- "checkpoint_path": checkpoint_path,
618
- "weights": weights,
619
- "epoch": checkpoint.get("epoch"),
620
- "model_type": model_type,
621
- "source_args": checkpoint.get("args"),
622
- }
623
- return model, metadata
624
-
625
- def to_jlt_checkpoint(
626
- self,
627
- ema_mode: str = "copy_to_both",
628
- prefix: str = "net.",
629
- ) -> Dict[str, object]:
630
- base_state: Dict[str, torch.Tensor] = {}
631
- for key, value in self.state_dict().items():
632
- legacy_key = key
633
- if legacy_key.startswith("norm_final"):
634
- legacy_key = legacy_key.replace("norm_final", "final_layer.norm_final", 1)
635
- if legacy_key.startswith("linear_final"):
636
- legacy_key = legacy_key.replace("linear_final", "final_layer.linear", 1)
637
- if legacy_key.startswith("adaLN_modulation_final"):
638
- legacy_key = legacy_key.replace("adaLN_modulation_final", "final_layer.adaLN_modulation", 1)
639
- legacy_key = legacy_key.replace(".adaLN_modulation.", ".adaLN_modulation.1.")
640
- base_state[f"{prefix}{legacy_key}"] = value.detach().cpu()
641
-
642
- checkpoint = {"model": base_state}
643
- if ema_mode == "copy_to_both":
644
- checkpoint["model_ema1"] = {k: v.clone() for k, v in base_state.items()}
645
- checkpoint["model_ema2"] = {k: v.clone() for k, v in base_state.items()}
646
- elif ema_mode != "none":
647
- raise ValueError(f"Unsupported ema_mode='{ema_mode}'.")
648
- return checkpoint
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
JLT-H-1-256/vae/config.json DELETED
@@ -1,40 +0,0 @@
1
- {
2
- "_class_name": "AutoencoderKLFlux2",
3
- "_diffusers_version": "0.37.0.dev0",
4
- "_name_or_path": "black-forest-labs/FLUX.2-dev",
5
- "act_fn": "silu",
6
- "batch_norm_eps": 0.0001,
7
- "batch_norm_momentum": 0.1,
8
- "block_out_channels": [
9
- 128,
10
- 256,
11
- 512,
12
- 512
13
- ],
14
- "down_block_types": [
15
- "DownEncoderBlock2D",
16
- "DownEncoderBlock2D",
17
- "DownEncoderBlock2D",
18
- "DownEncoderBlock2D"
19
- ],
20
- "force_upcast": true,
21
- "in_channels": 3,
22
- "latent_channels": 32,
23
- "layers_per_block": 2,
24
- "mid_block_add_attention": true,
25
- "norm_num_groups": 32,
26
- "out_channels": 3,
27
- "patch_size": [
28
- 2,
29
- 2
30
- ],
31
- "sample_size": 1024,
32
- "up_block_types": [
33
- "UpDecoderBlock2D",
34
- "UpDecoderBlock2D",
35
- "UpDecoderBlock2D",
36
- "UpDecoderBlock2D"
37
- ],
38
- "use_post_quant_conv": true,
39
- "use_quant_conv": true
40
- }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
JLT-H-1-256/vae/diffusion_pytorch_model.safetensors DELETED
@@ -1,3 +0,0 @@
1
- version https://git-lfs.github.com/spec/v1
2
- oid sha256:ca70d2202afe6415bdbcb8793ba8cd99fd159cfe6192381504d6c4d3036e0f04
3
- size 168120878