Fix GGUF converter sibling imports#661
Conversation
There was a problem hiding this comment.
Code Review
This pull request updates _load_module_from_path in unsloth_zoo/llama_cpp.py to include the script's directory in sys.path, allowing for the resolution of sibling imports. A new test case was added to verify this behavior. Feedback suggests that modifying sys.path globally can cause side effects and recommends restoring the original path after execution in both the library code and the test suite to prevent environment pollution.
07079b2 to
49d8d01
Compare
|
Addressed the review feedback by restoring sys.path after executing the cached converter module. The regression test now also snapshots/restores sys.path and asserts the temporary converter directory is not left in sys.path after the load completes. Validation: pytest tests/test_llama_cpp_loader.py |
|
Thanks this works! |
Fixes #5495
Summary
Root cause
llama.cpp convert_hf_to_gguf.py imports sibling helper modules by bare name. Unsloth caches the script under ~/.unsloth/llama.cpp and executes it by path, but that directory was not on sys.path, so Kaggle could fail with ModuleNotFoundError: No module named conversion.
Validation