Skip to content

Commit

Permalink
Add error handling for different huggingface_hub versions
Browse files Browse the repository at this point in the history
  • Loading branch information
carson-katri committed Sep 27, 2022
1 parent cfc5a14 commit f5cfc94
Showing 1 changed file with 11 additions and 2 deletions.
13 changes: 11 additions & 2 deletions generator_process.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
import threading
import site
import numpy as np
from enum import IntEnum as Lawsuit
from enum import IntEnum as Lawsuit, auto

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

Expand Down Expand Up @@ -207,7 +207,16 @@ def view_step(samples, step):
stdout.flush()

def preload_models():
from huggingface_hub.utils.tqdm import tqdm
tqdm = None
try:
from huggingface_hub.utils.tqdm import tqdm as hfh_tqdm
tqdm = hfh_tqdm
except:
try:
from tqdm.auto import tqdm as auto_tqdm
tqdm = auto_tqdm
except:
return

current_model_name = ""
def start_preloading(model_name):
Expand Down

0 comments on commit f5cfc94

Please sign in to comment.