You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardexpand all lines: README.md
+25-2
Original file line number
Diff line number
Diff line change
@@ -4,18 +4,41 @@ The purpose of this docker image is to provide a convenient way to download mode
4
4
5
5
## Usage
6
6
7
+
### Basic
8
+
7
9
```bash
8
10
docker run -it --rm -v $(PWD):/models amikos/hf-model-downloader sentence-transformers/all-MiniLM-L6-v2
9
11
```
10
12
11
-
With HF Token:
13
+
### With cache:
14
+
15
+
You can use the image to download models to a existing HF cache (`~/.cache/torch/sentence_transformers`) by setting `USE_CACHE=true` and mounting the cache directory.
16
+
17
+
```bash
18
+
docker run -it --rm -e USE_CACHE=true -v ~/.cache/torch/sentence_transformers:/models amikos/hf-model-downloader sentence-transformers/all-MiniLM-L6-v2
19
+
```
20
+
21
+
> Note: An alternative location for HF models is `~/.cache/huggingface/hub/`
22
+
23
+
> Note: You can use a different cache directory by mounting a different directory.
24
+
25
+
Using HF sentence-transformers with custom cache dir:
26
+
27
+
```py
28
+
from sentence_transformers import SentenceTransformer
29
+
model = SentenceTransformer("sentence-transformers/all-MiniLM-L6-v2", cache_folder="/models")
30
+
```
31
+
32
+
### With HF Token:
33
+
34
+
Using HF token can be useful if your model is private.
12
35
13
36
```bash
14
37
export HF_TOKEN="your_huggingface_token"
15
38
docker run -it --rm -e HF_TOKEN="$HF_TOKEN" -v $(PWD):/models amikos/hf-model-downloader sentence-transformers/all-MiniLM-L6-v2
0 commit comments