Fix: Allow loading models from directories for local checkpoints for MUSK and Hibou-L #160
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Hi there,
This PR addresses an issue that prevents loading certain models like MUSK and Hibou-Large from local checkpoints.
The Problem:
The current implementation of
BasePatchEncoder._get_weights_pathincludes a validation step (ensure_valid_weights_path) that strictly requires the weights path to be a single file. However, the specific load functions for MUSK and Hibou-Large require a path to a directory, not a single checkpoint file. This strict file check makes it impossible to load these models from a local path.The Solution:
To resolve this, I have commented out the call to
ensure_valid_weights_pathwithin_get_weights_path.This is a minimal change that makes the loading mechanism more flexible. It allows the function to return a path to a directory, which is the expected behavior for loading these types of models. The existing logic for handling single-file checkpoints remains unaffected.
This enhancement will make it much easier for users to work with a broader range of local models, especially in offline environments.
Thanks for your consideration!