bark icon indicating copy to clipboard operation
bark copied to clipboard

Can't run the example script

Open Niutonian opened this issue 1 year ago • 1 comments

Hello, I am not able to run Bark locally because it gets stuck at the "preload_models()" step. Here is the error it gives me, I have upgraded my huggingface but I still get the same error. Could you tell me why TLDR: error: TypeError: hf_hub_download() got an unexpected keyword argument 'local_dir' Full log: TypeError Traceback (most recent call last) Cell In[17], line 5 2 from IPython.display import Audio 4 # download and load all models ----> 5 preload_models() 7 # generate audio from text 8 text_prompt = """ 9 Hello, my name is Suno. And, uh — and I like pizza. [laughs] 10 But I also have other interests such as playing tic tac toe. 11 """

File E:\BARK\bark\bark\generation.py:341, in preload_models(text_use_gpu, text_use_small, coarse_use_gpu, coarse_use_small, fine_use_gpu, fine_use_small, codec_use_gpu, force_reload) 337 if _grab_best_device() == "cpu" and ( 338 text_use_gpu or coarse_use_gpu or fine_use_gpu or codec_use_gpu 339 ): 340 logger.warning("No GPU being used. Careful, inference might be very slow!") --> 341 _ = load_model( 342 model_type="text", use_gpu=text_use_gpu, use_small=text_use_small, force_reload=force_reload 343 ) 344 _ = load_model( 345 model_type="coarse", 346 use_gpu=coarse_use_gpu, 347 use_small=coarse_use_small, 348 force_reload=force_reload, 349 ) 350 _ = load_model( 351 model_type="fine", use_gpu=fine_use_gpu, use_small=fine_use_small, force_reload=force_reload 352 )

File E:\BARK\bark\bark\generation.py:298, in load_model(use_gpu, use_small, force_reload, model_type) 296 ckpt_path = _get_ckpt_path(model_type, use_small=use_small) 297 clean_models(model_key=model_key) --> 298 model = _load_model_f(ckpt_path, device) 299 models[model_key] = model 300 if model_type == "text":

File E:\BARK\bark\bark\generation.py:234, in _load_model(ckpt_path, device, use_small, model_type) 232 if not os.path.exists(ckpt_path): 233 logger.info(f"{model_type} model not found, downloading into {CACHE_DIR}.") --> 234 _download(model_info["repo_id"], model_info["file_name"], ckpt_path) 235 checkpoint = torch.load(ckpt_path, map_location=device) 236 # this is a hack

File E:\BARK\bark\bark\generation.py:168, in _download(from_hf_path, file_name, to_local_path) 166 os.makedirs(CACHE_DIR, exist_ok=True) 167 destination_file_name = to_local_path.split("/")[-1] --> 168 hf_hub_download(repo_id=from_hf_path, filename=file_name, local_dir=CACHE_DIR) 169 os.replace(os.path.join(CACHE_DIR, file_name), to_local_path)

File ~\AppData\Local\Programs\Python\Python310\lib\site-packages\huggingface_hub\utils_validators.py:124, in validate_hf_hub_args.._inner_fn(*args, **kwargs) 119 if check_use_auth_token: 120 kwargs = smoothly_deprecate_use_auth_token( 121 fn_name=fn.name, has_token=has_token, kwargs=kwargs 122 ) --> 124 return fn(*args, **kwargs)

TypeError: hf_hub_download() got an unexpected keyword argument 'local_dir'


Thanks in advance

Niutonian avatar Apr 29 '23 08:04 Niutonian

Hey hey! @Niutonian - It appears you are running an older version of huggingface_hub

Can you try running pip install --upgrade hugging face_hub that should ideally fix this issue :)

Vaibhavs10 avatar Apr 29 '23 15:04 Vaibhavs10

Hello @Vaibhavs10 , thanks a lot for helping me, I did the update of hugging face and it seems to have fixed the issue, the models are now downloading and the audio is playing, +1 to you

Niutonian avatar Apr 30 '23 09:04 Niutonian