Skip to content

Replace urllib.request.urlretrieve with requests library#601

Open
ianandersonlol wants to merge 2 commits intojwohlwend:mainfrom
ianandersonlol:fix-huggingface-redirect-handling
Open

Replace urllib.request.urlretrieve with requests library#601
ianandersonlol wants to merge 2 commits intojwohlwend:mainfrom
ianandersonlol:fix-huggingface-redirect-handling

Conversation

@ianandersonlol
Copy link

The current implementation using urllib.request.urlretrieve doesn't properly handle HuggingFace redirect responses, which can cause download failures when fetching model weights and data files.

This PR replaces those calls with a new download_file_with_progress function that uses the requests library with proper redirect handling (allow_redirects=True) and streaming support.

Changes:

  • Added download_file_with_progress() function using requests library
  • Updated download_boltz2() to use the new function for all Boltz-2 downloads (mols.tar, boltz2_conf.ckpt, boltz2_aff.ckpt)
  • Maintains existing fallback URL logic and error handling

The current implementation using urllib.request.urlretrieve doesn't properly
handle HuggingFace redirect responses, which can cause download failures when
fetching model weights and data files. This change replaces those calls with
a new download_file_with_progress function that uses the requests library with
proper redirect handling (allow_redirects=True) and streaming support.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant