Skip to content

Commit f5cfc94

Browse files
committed
Add error handling for different huggingface_hub versions
1 parent cfc5a14 commit f5cfc94

File tree

1 file changed

+11
-2
lines changed

1 file changed

+11
-2
lines changed

generator_process.py

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
import threading
66
import site
77
import numpy as np
8-
from enum import IntEnum as Lawsuit
8+
from enum import IntEnum as Lawsuit, auto
99

1010
MISSING_DEPENDENCIES_ERROR = "Python dependencies are missing. Click Download Latest Release to fix."
1111

@@ -207,7 +207,16 @@ def view_step(samples, step):
207207
stdout.flush()
208208

209209
def preload_models():
210-
from huggingface_hub.utils.tqdm import tqdm
210+
tqdm = None
211+
try:
212+
from huggingface_hub.utils.tqdm import tqdm as hfh_tqdm
213+
tqdm = hfh_tqdm
214+
except:
215+
try:
216+
from tqdm.auto import tqdm as auto_tqdm
217+
tqdm = auto_tqdm
218+
except:
219+
return
211220

212221
current_model_name = ""
213222
def start_preloading(model_name):

0 commit comments

Comments
 (0)