File tree Expand file tree Collapse file tree 1 file changed +41
-0
lines changed
Expand file tree Collapse file tree 1 file changed +41
-0
lines changed Original file line number Diff line number Diff line change 1+ # This scripy is used to install models from huggingface
2+ # Only support MaixCAM2 platform
3+
4+ import os
5+ os .environ ['HF_ENDPOINT' ] = 'https://hf-mirror.com' # or 'https://huggingface.co'
6+
7+ from huggingface_hub import snapshot_download
8+ from huggingface_hub .utils import tqdm
9+
10+ CAPTURE_PROGRESS = False
11+ class Tqdm (tqdm ):
12+ def __init__ (self , * args , ** kwargs ):
13+ super ().__init__ (* args , ** kwargs )
14+ if CAPTURE_PROGRESS :
15+ print (f"[INIT] { self .desc } | { self .n } /{ self .total } ({ self .n / self .total * 100 :.2f} %)" )
16+ else :
17+ print ('' )
18+
19+ def update (self , n = 1 ):
20+ super ().update (n )
21+ if CAPTURE_PROGRESS :
22+ print (f"[UPDATE] { self .desc } | { self .n } /{ self .total } ({ self .n / self .total * 100 :.2f} %)" )
23+ else :
24+ print ('' )
25+
26+ def close (self ):
27+ super ().close ()
28+ if CAPTURE_PROGRESS :
29+ print (f"[CLOSE] { self .desc } | { self .n } /{ self .total } ({ self .n / self .total * 100 :.2f} %)" )
30+ else :
31+ print ('' )
32+
33+ model_name = 'lcm-lora-sdv1-5-maixcam2'
34+ repo_id = f'sipeed/{ model_name } '
35+ local_dir = f'/root/models/{ model_name } '
36+ snapshot_download (
37+ repo_id = repo_id ,
38+ local_dir = local_dir ,
39+ # allow_patterns="*.py",
40+ tqdm_class = Tqdm ,
41+ )
You can’t perform that action at this time.
0 commit comments