Skip to content

Commit

Permalink
Merge pull request deforum-art#960 from viking1304/basicsr_deprication
Browse files Browse the repository at this point in the history
fix remaining files affected by basicsr deprecation
  • Loading branch information
XmYx committed Mar 13, 2024
2 parents d3463ae + 8da9db0 commit 3224268
Show file tree
Hide file tree
Showing 4 changed files with 14 additions and 6 deletions.
8 changes: 6 additions & 2 deletions scripts/deforum_helpers/frame_interpolation.py
Original file line number Diff line number Diff line change
Expand Up @@ -190,7 +190,11 @@ def prepare_film_inference(deforum_models_path, x_am, sl_enabled, sl_am, keep_im
return interp_vid_path

def check_and_download_film_model(model_name, model_dest_folder):
from basicsr.utils.download_util import load_file_from_url
try:
from modules.modelloader import load_file_from_url
except:
print("Try to fallback to basicsr with older modules")
from basicsr.utils.download_util import load_file_from_url
if model_name == 'film_net_fp16.pt':
model_dest_path = os.path.join(model_dest_folder, model_name)
download_url = 'https://github.com/hithereai/frame-interpolation-pytorch/releases/download/film_net_fp16.pt/film_net_fp16.pt'
Expand All @@ -202,7 +206,7 @@ def check_and_download_film_model(model_name, model_dest_folder):
try:
os.makedirs(model_dest_folder, exist_ok=True)
# download film model from url
load_file_from_url(download_url, model_dest_folder)
load_file_from_url(url=download_url, model_dir=model_dest_folder)
# verify checksum
if checksum(model_dest_path) != film_model_hash:
raise Exception(f"Error while downloading {model_name}. Please download from: {download_url}, and put in: {model_dest_folder}")
Expand Down
8 changes: 6 additions & 2 deletions scripts/deforum_helpers/src/rife/rife_new_gen/RIFE_HDv3.py
Original file line number Diff line number Diff line change
Expand Up @@ -102,7 +102,11 @@ def download_rife_model(path, deforum_models_path):
target_file = f"{path}.pkl"
target_path = os.path.join(deforum_models_path, target_file)
if not os.path.exists(target_path):
from basicsr.utils.download_util import load_file_from_url
load_file_from_url(options[path][1], deforum_models_path)
try:
from modules.modelloader import load_file_from_url
except:
print("Try to fallback to basicsr with older modules")
from basicsr.utils.download_util import load_file_from_url
load_file_from_url(url=options[path][1], model_dir=deforum_models_path)
if checksum(target_path) != options[path][0]:
raise Exception(f"Error while downloading {target_file}. Please download from here: {options[path][1]} and place in: " + deforum_models_path)
2 changes: 1 addition & 1 deletion scripts/deforum_helpers/upscaling.py
Original file line number Diff line number Diff line change
Expand Up @@ -119,7 +119,7 @@ def check_and_download_realesrgan_ncnn(models_folder, current_user_os):
try:
os.makedirs(realesrgan_ncnn_folder, exist_ok=True)
# download exec and model files from url
load_file_from_url(download_url, realesrgan_ncnn_folder)
load_file_from_url(url=download_url, model_dir=realesrgan_ncnn_folder)
# check downloaded zip's hash
with open(realesrgan_zip_path, 'rb') as f:
file_hash = checksum(realesrgan_zip_path)
Expand Down
2 changes: 1 addition & 1 deletion scripts/deforum_helpers/video_audio_utilities.py
Original file line number Diff line number Diff line change
Expand Up @@ -401,7 +401,7 @@ def check_and_download_gifski(models_folder, current_user_os):
file_path = os.path.join(models_folder, file_name)

if not os.path.exists(file_path):
load_file_from_url(download_url, models_folder)
load_file_from_url(url=download_url, model_dir=models_folder)
if current_user_os in ['Linux','Mac']:
os.chmod(file_path, 0o755)
if current_user_os == 'Mac':
Expand Down

0 comments on commit 3224268

Please sign in to comment.