Add a .gitignore and make HF deps fully optional #323
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.
Enable
Accelerate
integration by fully making HF deps optionalWhat does this add?
This PR adds import guards across
unsloth
for the various integration libs, making sure that core imports are still possible without triggering external lib imports.It does so by following an
is_x_available
workflow, similar to what we use at HF.This PR also adds in a
.gitignore
relative to working with a python file, as I found it a bit cumbersome not being able to dogit add .
. If we want to remove it, that's quite alright 😉Who is it for?
Users of
unsloth
who want to try out the cool gradient offloading mechanism, while only having the core parts ofunsloth
installed.Why is it needed?
There are areas in the code that do a large deal of patching to
transformers
andpeft
. This simply guards said patching so its only done if the lib is available.What parts of the API does this impact?
User-facing:
None
Internal structure:
Adds new library imports checks for: