Spaces:
Running
on
Zero
Running
on
Zero
Merge branch 'main' of https://huggingface.co/spaces/TIGER-Lab/GenAI-Arena
Browse files- model/model_manager.py +2 -2
- model/model_registry.py +10 -0
- model/models/__init__.py +1 -1
- model/pre_download.py +10 -7
- requirements.txt +1 -1
model/model_manager.py
CHANGED
|
@@ -7,7 +7,7 @@ import spaces
|
|
| 7 |
from PIL import Image
|
| 8 |
from .models import IMAGE_GENERATION_MODELS, IMAGE_EDITION_MODELS, VIDEO_GENERATION_MODELS, MUSEUM_UNSUPPORTED_MODELS, DESIRED_APPEAR_MODEL, load_pipeline
|
| 9 |
from .fetch_museum_results import draw_from_imagen_museum, draw2_from_imagen_museum, draw_from_videogen_museum, draw2_from_videogen_museum
|
| 10 |
-
from .pre_download import pre_download_all_models,
|
| 11 |
from transformers import AutoTokenizer, AutoModelForCausalLM
|
| 12 |
import torch
|
| 13 |
import re
|
|
@@ -82,7 +82,7 @@ class ModelManager:
|
|
| 82 |
self.load_guard(enable_nsfw)
|
| 83 |
self.loaded_models = {}
|
| 84 |
if do_pre_download:
|
| 85 |
-
pre_download_all_models()
|
| 86 |
if do_debug_packages:
|
| 87 |
debug_packages()
|
| 88 |
|
|
|
|
| 7 |
from PIL import Image
|
| 8 |
from .models import IMAGE_GENERATION_MODELS, IMAGE_EDITION_MODELS, VIDEO_GENERATION_MODELS, MUSEUM_UNSUPPORTED_MODELS, DESIRED_APPEAR_MODEL, load_pipeline
|
| 9 |
from .fetch_museum_results import draw_from_imagen_museum, draw2_from_imagen_museum, draw_from_videogen_museum, draw2_from_videogen_museum
|
| 10 |
+
from .pre_download import pre_download_all_models, pre_download_image_models_gen, pre_download_image_models_edit, pre_download_video_models_gen
|
| 11 |
from transformers import AutoTokenizer, AutoModelForCausalLM
|
| 12 |
import torch
|
| 13 |
import re
|
|
|
|
| 82 |
self.load_guard(enable_nsfw)
|
| 83 |
self.loaded_models = {}
|
| 84 |
if do_pre_download:
|
| 85 |
+
pre_download_all_models(include_video=False)
|
| 86 |
if do_debug_packages:
|
| 87 |
debug_packages()
|
| 88 |
|
model/model_registry.py
CHANGED
|
@@ -321,6 +321,16 @@ register_model_info(
|
|
| 321 |
"image_edition"
|
| 322 |
)
|
| 323 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 324 |
register_model_info(
|
| 325 |
["fal_stable-cascade_text2image"],
|
| 326 |
"StableCascade",
|
|
|
|
| 321 |
"image_edition"
|
| 322 |
)
|
| 323 |
|
| 324 |
+
register_model_info(
|
| 325 |
+
["imagenhub_AURORA_edition"],
|
| 326 |
+
"AURORA",
|
| 327 |
+
"https://aurora-editing.github.io/",
|
| 328 |
+
"AURORA (Action Reasoning Object Attribute) enables training an instruction-guided image editing model that can perform action and reasoning-centric edits.",
|
| 329 |
+
"MIT",
|
| 330 |
+
"McGill NLP",
|
| 331 |
+
"image_edition"
|
| 332 |
+
)
|
| 333 |
+
|
| 334 |
register_model_info(
|
| 335 |
["fal_stable-cascade_text2image"],
|
| 336 |
"StableCascade",
|
model/models/__init__.py
CHANGED
|
@@ -15,7 +15,7 @@ IMAGE_GENERATION_MODELS = ['imagenhub_SDXLTurbo_generation','imagenhub_SDXL_gene
|
|
| 15 |
IMAGE_EDITION_MODELS = ['imagenhub_CycleDiffusion_edition', 'imagenhub_Pix2PixZero_edition', 'imagenhub_Prompt2prompt_edition',
|
| 16 |
'imagenhub_SDEdit_edition', 'imagenhub_InstructPix2Pix_edition',
|
| 17 |
'imagenhub_MagicBrush_edition', 'imagenhub_PNP_edition',
|
| 18 |
-
'imagenhub_InfEdit_edition', 'imagenhub_CosXLEdit_edition', 'imagenhub_UltraEdit_edition']
|
| 19 |
VIDEO_GENERATION_MODELS = ['fal_AnimateDiff_text2video',
|
| 20 |
'fal_AnimateDiffTurbo_text2video',
|
| 21 |
#'videogenhub_LaVie_generation',
|
|
|
|
| 15 |
IMAGE_EDITION_MODELS = ['imagenhub_CycleDiffusion_edition', 'imagenhub_Pix2PixZero_edition', 'imagenhub_Prompt2prompt_edition',
|
| 16 |
'imagenhub_SDEdit_edition', 'imagenhub_InstructPix2Pix_edition',
|
| 17 |
'imagenhub_MagicBrush_edition', 'imagenhub_PNP_edition',
|
| 18 |
+
'imagenhub_InfEdit_edition', 'imagenhub_CosXLEdit_edition', 'imagenhub_UltraEdit_edition', 'imagenhub_AURORA_edition']
|
| 19 |
VIDEO_GENERATION_MODELS = ['fal_AnimateDiff_text2video',
|
| 20 |
'fal_AnimateDiffTurbo_text2video',
|
| 21 |
#'videogenhub_LaVie_generation',
|
model/pre_download.py
CHANGED
|
@@ -1,16 +1,19 @@
|
|
| 1 |
from .models import IMAGE_GENERATION_MODELS, IMAGE_EDITION_MODELS, VIDEO_GENERATION_MODELS
|
| 2 |
|
| 3 |
-
def pre_download_all_models():
|
| 4 |
"""
|
| 5 |
Pre-download all models to avoid download delay during the first user request
|
| 6 |
"""
|
| 7 |
-
imagen_dl_error =
|
| 8 |
-
imagedit_dl_error =
|
| 9 |
-
|
|
|
|
|
|
|
|
|
|
| 10 |
print("All models downloaded.")
|
| 11 |
print("Models that encountered download error:", "Image Generation:", imagen_dl_error, "Image Edition:", imagedit_dl_error, "Video Generation:", videogen_dl_error)
|
| 12 |
|
| 13 |
-
def
|
| 14 |
"""
|
| 15 |
Pre-download image models to avoid download delay during the first user request
|
| 16 |
"""
|
|
@@ -33,7 +36,7 @@ def pre_download_image_models():
|
|
| 33 |
pass
|
| 34 |
return errored_models
|
| 35 |
|
| 36 |
-
def
|
| 37 |
"""
|
| 38 |
Pre-download image models to avoid download delay during the first user request
|
| 39 |
"""
|
|
@@ -56,7 +59,7 @@ def pre_download_image_models():
|
|
| 56 |
pass
|
| 57 |
return errored_models
|
| 58 |
|
| 59 |
-
def
|
| 60 |
"""
|
| 61 |
Pre-download video models to avoid download delay during the first user request
|
| 62 |
"""
|
|
|
|
| 1 |
from .models import IMAGE_GENERATION_MODELS, IMAGE_EDITION_MODELS, VIDEO_GENERATION_MODELS
|
| 2 |
|
| 3 |
+
def pre_download_all_models(include_video=True):
|
| 4 |
"""
|
| 5 |
Pre-download all models to avoid download delay during the first user request
|
| 6 |
"""
|
| 7 |
+
imagen_dl_error = pre_download_image_models_gen()
|
| 8 |
+
imagedit_dl_error = pre_download_image_models_edit()
|
| 9 |
+
if include_video:
|
| 10 |
+
videogen_dl_error = pre_download_video_models_gen()
|
| 11 |
+
else:
|
| 12 |
+
videogen_dl_error = ["None"]
|
| 13 |
print("All models downloaded.")
|
| 14 |
print("Models that encountered download error:", "Image Generation:", imagen_dl_error, "Image Edition:", imagedit_dl_error, "Video Generation:", videogen_dl_error)
|
| 15 |
|
| 16 |
+
def pre_download_image_models_gen():
|
| 17 |
"""
|
| 18 |
Pre-download image models to avoid download delay during the first user request
|
| 19 |
"""
|
|
|
|
| 36 |
pass
|
| 37 |
return errored_models
|
| 38 |
|
| 39 |
+
def pre_download_image_models_edit():
|
| 40 |
"""
|
| 41 |
Pre-download image models to avoid download delay during the first user request
|
| 42 |
"""
|
|
|
|
| 59 |
pass
|
| 60 |
return errored_models
|
| 61 |
|
| 62 |
+
def pre_download_video_models_gen():
|
| 63 |
"""
|
| 64 |
Pre-download video models to avoid download delay during the first user request
|
| 65 |
"""
|
requirements.txt
CHANGED
|
@@ -68,5 +68,5 @@ tensorboard
|
|
| 68 |
timm
|
| 69 |
bitsandbytes
|
| 70 |
wandb
|
| 71 |
-
pandarallel
|
| 72 |
kaleido
|
|
|
|
|
|
| 68 |
timm
|
| 69 |
bitsandbytes
|
| 70 |
wandb
|
|
|
|
| 71 |
kaleido
|
| 72 |
+
pandarallel
|