Repository navigation
61 lines (49 loc) · 1.62 KB
/
Copy pathcreate_model_cache.yml
File metadata and controls
61 lines (49 loc) · 1.62 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
name: Create Model Cache
on:
workflow_dispatch:
inputs:
force_update:
description: "Force the (re-)download, overriding the cached versions if exist"
type: boolean
default: false
env:
HF_TOKEN: ${{ secrets.HF_HUB_READ_TOKEN }}
UV_SYSTEM_PYTHON: true
permissions: {}
jobs:
create-cache:
permissions:
actions: write
contents: read
if: github.event_name == 'workflow_dispatch'
runs-on: ubuntu-22.04
steps:
- name: Checkout code
uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
- name: Setup Python
uses: actions/setup-python@5fda3b95a4ea91299a34e894583c3862153e4b97 # v7.0.0
with:
python-version: "3.11"
- name: Install dependencies
run: |
pip install --upgrade pip uv
uv pip install .[tests]
- name: Restore existing cache
if: ${{ !inputs.force_update }}
uses: actions/cache/restore@55cc8345863c7cc4c66a329aec7e433d2d1c52a9 # v6.1.0
with:
path: ~/.cache/huggingface/hub
key: hf-models
- name: Download models for cache
run: python tests/scripts/download_cached_models.py
env:
FORCE_DOWNLOAD: ${{ inputs.force_update }}
- name: Delete existing cache entry
run: gh cache delete hf-models --repo ${{ github.repository }} || true
env:
GH_TOKEN: ${{ github.token }}
- name: Save HF models cache
uses: actions/cache/save@55cc8345863c7cc4c66a329aec7e433d2d1c52a9 # v6.1.0
with:
path: ~/.cache/huggingface/hub
key: hf-models