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

Feat: cache_dir #133

Open
wants to merge 2 commits into
base: main
Choose a base branch
from
Open

Feat: cache_dir #133

wants to merge 2 commits into from

Conversation

wheynelau
Copy link

Small QOL change, adding a cache_dir argument to the input of from_pretrained.

In addition, removes the model after test_model runs, this reduces clutter, but may slow down frequent testing. (This can be removed or modified)

Fixes #132

Wrote a pytest to test cache_dir, also removes the folder after testing.
@ZeroCool2u
Copy link

This is much needed, as ctransformers doesn't seem to respect the TRANSFORMERS_CACHE environment variable right now.

@no-skynet
Copy link

no-skynet commented Oct 11, 2023

Noting that one can do this with the HF transformers library:

`from transformers import AutoModelForCausalLM, cache

# Set the cache directory to the location where you've copied the model
cache_dir = "/path/to/default_cache_directory/"

# Load the model without local_files_only=True
llm = AutoModelForCausalLM.from_pretrained(
"model-name", # Provide the correct model name or path
cache_dir=cache_dir
)`

Would make sense to match HF parameters as well as the "cache" import from "transformers".

@abaveja313
Copy link

abaveja313 commented Dec 5, 2023

Any reason why this hasn't been merged?

As a temporary workaround, I created a symbolic link from ~/.cache to the directory where I wanted my cache to be stored (on a different disk).

ln -s /path/to/new/.cache ~/.cache

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.

Unable to save to different folder
4 participants