Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update _base.py - Remote (.bin) model load fix #465

Merged
merged 1 commit into from
Dec 4, 2023

Conversation

Shades-en
Copy link
Contributor

Whats happening -
.bin Model is unable to load - FIleNotFound error.

When you load a model from huggingface remotely with use_safetensors = False, there are two extensions to work with - .bin, .pt.
Line 834, checks the cached model directory for the model base name with the above extensions in the same order as above.

Case - 1: If no model found with either extensions, the original code works as expected (throws error).
Case - 2: If models with both extensions found or if only .pt extension is found, the model with .pt extension loads. Although in the former case, the user has no liberty to choose between the two models.
Case - 3: If only .bin model exists. then it throws a FileNotFoundError as in the first case.

The fix -
A simple fix with temp variable, which hold the latest found model in order to prevent the resolved_archive_file variable defaulting to None incase the model with next search extension is not found.

Model load fix
Copy link
Collaborator

@fxmarty fxmarty left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM thank you for the fix!

@fxmarty fxmarty merged commit 1b7990e into AutoGPTQ:main Dec 4, 2023
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.

2 participants