ramalama icon indicating copy to clipboard operation
ramalama copied to clipboard

Support user-provided HuggingFace cache

Open jcordes73 opened this issue 4 months ago • 5 comments

Feature request description

Ramalama should support HuggingFace cache as set by the user.

Suggest potential solution

Check for HF_HOME. or let a user pass it as an additional parameter.

Have you considered any alternatives?

No response

Additional context

No response

jcordes73 avatar Aug 26 '25 13:08 jcordes73

Interested in opening a PR to add this?

rhatdan avatar Aug 27 '25 10:08 rhatdan

A friendly reminder that this issue had no activity for 30 days.

github-actions[bot] avatar Sep 27 '25 00:09 github-actions[bot]

This should be as simple as adding HF_HOME as the first entry here: https://github.com/containers/ramalama/blob/499b2bc7e28797eef2689f7ab829c4f529fa6a55/ramalama/transports/huggingface.py#L204

kush-gupt avatar Oct 29 '25 13:10 kush-gupt

Please open a PR to make this change.

rhatdan avatar Oct 29 '25 14:10 rhatdan

A friendly reminder that this issue had no activity for 30 days.

github-actions[bot] avatar Nov 30 '25 00:11 github-actions[bot]

@kush-gupt is this one fixed?

rhatdan avatar Dec 11 '25 18:12 rhatdan

Unfortunately not yet, that method is actually unused within the new model store.

I believe the best path towards this feature would be a hf cache model object within the store to differentiate between directly pulled and "imported"/pointed to ones that are managed by hf

kush-gupt avatar Dec 11 '25 18:12 kush-gupt

@rhatdan @engelmi if this type of path would be preferred, I have a draft (that would need to be rebased) over here: https://github.com/kush-gupt/ramalama/pull/18

kush-gupt avatar Dec 11 '25 18:12 kush-gupt

@olliewalsh PTAL

rhatdan avatar Dec 12 '25 08:12 rhatdan

@kush-gupt I think this is closely related to https://github.com/containers/ramalama/issues/2098 - be it local files from the ollama or hf cache or something else. I agree that having a hf cache object to distinguish between downloaded and locally available models. One issue pointed out in #2098 is ownership vs disk space of the model. If Ramalama only links to the files in the hf cache directory, then ramalama doesn't "fully manage" it and has to do additional sanity checks. If Ramalama copies these files, we are in full control, but require unnecessary disk space. AFAIK we currently have support for the later with the LocalModelFile, which you pass to the model store for performing the copy. I think we should aim for the former for the hf/ollama cache and improve on the sanity checks and cleanup. This means also when pulling a model, we first check the configured cache directories.

engelmi avatar Dec 12 '25 14:12 engelmi