unslothai / unsloth

Finetune Llama 3.2, Mistral, Phi, Qwen & Gemma LLMs 2-5x faster with 80% less memory
https://unsloth.ai
Apache License 2.0
17.99k stars 1.25k forks source link

Unsloth should probably not alter or delete source models. #905

Open rwl4 opened 3 months ago

rwl4 commented 3 months ago

I always keep a local copy of every model I work with regularly in a models directory on my server. I noticed that unsloth will write input_embeddings.pt and output_embeddings.pt to the source model directory, then in some cases will delete the source. This means that I now have to re-download the model. This is far from ideal.

I've tried in vain to do various workarounds such as:

But those tricks always fail.

Can you instead create a different directory under huggingface's cache directory instead? For example, maybe for Mistral-7B-v0.3 you might create a tmp directory called ~/.cache/unsloth/path-to-using-dashes-instead-of-slashes-Mistral-7B-v0.3-unsloth-work and write your diffs there. You could even be really fancy and make it attempt a symlink to the original files, then write your updated files to that directory in lieu of the symlinked version.

I'm getting to the point where I will have to switch to using ZFS copy-on-write or do an overlay mount or similar since I literally keep having to place the original model back in place on an almost daily basis

danielhanchen commented 3 months ago

Hmm interesting point and good idea - hmm weird it's deleting the entire folder? I'll check why this is happening - maybe my caching methods are not correct