huggingface / huggingface.js

Utilities to use the Hugging Face Hub API
https://hf.co/docs/huggingface.js
MIT License
1.37k stars 213 forks source link

feat(@huggingface/hub): adding `scanCacheDir` #908

Closed axel7083 closed 1 week ago

axel7083 commented 2 weeks ago

Description

Took https://github.com/huggingface/huggingface_hub/blob/main/src/huggingface_hub/utils/_cache_manager.py as heavy inspiration for the implementation.

This is a very basic implementation, which do not cover the deletion.

Related issue

Fixes https://github.com/huggingface/huggingface.js/issues/905

Usage

import { scanCacheDir } from "@huggingface/hub";

const result = await scanCacheDir();
console.log(result);
axel7083 commented 2 weeks ago

Just to be clear, is this PR intended to interact with the cache folder created by the python lib?

Yes, and hopefully the js library will allow to download model in the cache later

HuggingFaceDocBuilderDev commented 1 week ago

The docs for this PR live here. All of your documentation changes will be reflected on that endpoint. The docs are available until 30 days after the last update.

coyotte508 commented 1 week ago

Thanks!