File size: 4,548 Bytes
b2f4caf
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
import os
import time
import torch
#os.environ['HF_ENDPOINT']="https://hf-mirror.com"
from huggingface_hub import hf_hub_download

class OMG_download():
    def __init__(self) -> None:
        self.download_model_sam()
        print("download efficientvit sam")

        self.download_model_yoloworld()
        print("download yoloworld")

        self.download_controlNet()
        print("download controlNet")

        self.download_styles()
        print("download styles")

        self.download_antelopev2()
        print("download antelopev2")

        self.download_instantid()
        print("download instantid")


    def download_model_sam(self):
        REPO_ID = 'han-cai/efficientvit-sam'
        filename_list = ['xl1.pt']
        if not os.path.exists('/home/user/app/checkpoint/sam/'):
            os.makedirs('/home/user/app/checkpoint/sam/')
        for filename in filename_list:
            local_file = os.path.join('/home/user/app/checkpoint/sam/', filename)

            if not os.path.exists(local_file):
                hf_hub_download(repo_id=REPO_ID, filename=filename, local_dir='/home/user/app/checkpoint/sam/', local_dir_use_symlinks=False)

    def download_model_yoloworld(self):
        REPO_ID = 'Fucius/OMG'
        filename_list = ['yolo-world.pt']
        if not os.path.exists('/tmp/cache/yolo_world/l/'):
            os.makedirs('/tmp/cache/yolo_world/l/')
        for filename in filename_list:
            local_file = os.path.join('/tmp/cache/yolo_world/l/', filename)
            if not os.path.exists(local_file):
                hf_hub_download(repo_id=REPO_ID, filename=filename, local_dir='/tmp/cache/yolo_world/l/', local_dir_use_symlinks=False)

    def download_controlNet(self):
        REPO_ID = 'lllyasviel/ControlNet'
        filename_list = ['annotator/ckpts/body_pose_model.pth']
        if not os.path.exists('/home/user/app/checkpoint/ControlNet/'):
            os.makedirs('/home/user/app/checkpoint/ControlNet/')
        for filename in filename_list:
            local_file = os.path.join('/home/user/app/checkpoint/ControlNet/', filename)

            if not os.path.exists(local_file):
                hf_hub_download(repo_id=REPO_ID, filename=filename, local_dir='/home/user/app/checkpoint/ControlNet/',
                                local_dir_use_symlinks=False)


    def download_styles(self):
        REPO_ID = 'Fucius/OMG'
        filename_list = ['style/EldritchPaletteKnife.safetensors', 'style/Cinematic Hollywood Film.safetensors', 'style/Anime_Sketch_SDXL.safetensors']
        if not os.path.exists('/home/user/app/checkpoint/'):
            os.makedirs('/home/user/app/checkpoint/')
        for filename in filename_list:
            local_file = os.path.join('/home/user/app/checkpoint/', filename)

            if not os.path.exists(local_file):
                hf_hub_download(repo_id=REPO_ID, filename=filename, local_dir='/home/user/app/checkpoint/',
                                local_dir_use_symlinks=False)

    def download_antelopev2(self):
        REPO_ID = 'Fucius/OMG'
        filename_list = ['antelopev2/models/antelopev2/1k3d68.onnx', 'antelopev2/models/antelopev2/2d106det.onnx', 'antelopev2/models/antelopev2/genderage.onnx', 'antelopev2/models/antelopev2/glintr100.onnx', 'antelopev2/models/antelopev2/scrfd_10g_bnkps.onnx']
        if not os.path.exists('/home/user/app/checkpoint/'):
            os.makedirs('/home/user/app/checkpoint/')
        for filename in filename_list:
            local_file = os.path.join('/home/user/app/checkpoint/', filename)

            if not os.path.exists(local_file):
                hf_hub_download(repo_id=REPO_ID, filename=filename, local_dir='/home/user/app/checkpoint/',
                                local_dir_use_symlinks=False)

    def download_instantid(self):
        REPO_ID = 'InstantX/InstantID'
        filename_list = ['ip-adapter.bin', 'ControlNetModel/config.json', 'ControlNetModel/diffusion_pytorch_model.safetensors']
        if not os.path.exists('/home/user/app/checkpoint/InstantID'):
            os.makedirs('/home/user/app/checkpoint/InstantID')
        for filename in filename_list:
            local_file = os.path.join('/home/user/app/checkpoint/InstantID', filename)

            if not os.path.exists(local_file):
                hf_hub_download(repo_id=REPO_ID, filename=filename, local_dir='/home/user/app/checkpoint/InstantID',
                                local_dir_use_symlinks=False)

if __name__ == '__main__':
    down = OMG_download()
    print("finished download")