Commit
·
bd7ffdb
1
Parent(s):
ac6ce45
Upload 6 files
Browse files
mass_compute_v2/control_net_downloader.py
ADDED
@@ -0,0 +1,127 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
import os
|
2 |
+
import subprocess
|
3 |
+
import requests
|
4 |
+
from tqdm import tqdm
|
5 |
+
import math
|
6 |
+
|
7 |
+
repo_url = "https://github.com/Mikubill/sd-webui-controlnet"
|
8 |
+
target_folder = r"stable-diffusion-webui/extensions"
|
9 |
+
urls = [
|
10 |
+
"https://huggingface.co/lllyasviel/sd_control_collection/resolve/main/kohya_controllllite_xl_blur.safetensors",
|
11 |
+
"https://huggingface.co/lllyasviel/sd_control_collection/resolve/main/kohya_controllllite_xl_blur_anime.safetensors",
|
12 |
+
"https://huggingface.co/lllyasviel/sd_control_collection/resolve/main/kohya_controllllite_xl_blur_anime_beta.safetensors",
|
13 |
+
"https://huggingface.co/lllyasviel/sd_control_collection/resolve/main/kohya_controllllite_xl_canny.safetensors",
|
14 |
+
"https://huggingface.co/lllyasviel/sd_control_collection/resolve/main/kohya_controllllite_xl_depth.safetensors",
|
15 |
+
"https://huggingface.co/lllyasviel/sd_control_collection/resolve/main/t2i-adapter_diffusers_xl_canny.safetensors",
|
16 |
+
"https://huggingface.co/lllyasviel/sd_control_collection/resolve/main/t2i-adapter_diffusers_xl_depth_midas.safetensors",
|
17 |
+
"https://huggingface.co/lllyasviel/sd_control_collection/resolve/main/t2i-adapter_diffusers_xl_depth_zoe.safetensors",
|
18 |
+
"https://huggingface.co/lllyasviel/sd_control_collection/resolve/main/t2i-adapter_diffusers_xl_lineart.safetensors",
|
19 |
+
"https://huggingface.co/lllyasviel/sd_control_collection/resolve/main/t2i-adapter_diffusers_xl_openpose.safetensors",
|
20 |
+
"https://huggingface.co/lllyasviel/sd_control_collection/resolve/main/t2i-adapter_diffusers_xl_sketch.safetensors",
|
21 |
+
"https://huggingface.co/lllyasviel/ControlNet-v1-1/resolve/main/control_v11e_sd15_ip2p.pth",
|
22 |
+
"https://huggingface.co/lllyasviel/ControlNet-v1-1/resolve/main/control_v11e_sd15_shuffle.pth",
|
23 |
+
"https://huggingface.co/lllyasviel/ControlNet-v1-1/resolve/main/control_v11f1e_sd15_tile.pth",
|
24 |
+
"https://huggingface.co/lllyasviel/ControlNet-v1-1/resolve/main/control_v11f1p_sd15_depth.pth",
|
25 |
+
"https://huggingface.co/lllyasviel/ControlNet-v1-1/resolve/main/control_v11p_sd15_canny.pth",
|
26 |
+
"https://huggingface.co/lllyasviel/ControlNet-v1-1/resolve/main/control_v11p_sd15_inpaint.pth",
|
27 |
+
"https://huggingface.co/lllyasviel/ControlNet-v1-1/resolve/main/control_v11p_sd15_lineart.pth",
|
28 |
+
"https://huggingface.co/lllyasviel/ControlNet-v1-1/resolve/main/control_v11p_sd15_mlsd.pth",
|
29 |
+
"https://huggingface.co/lllyasviel/ControlNet-v1-1/resolve/main/control_v11p_sd15_normalbae.pth",
|
30 |
+
"https://huggingface.co/lllyasviel/ControlNet-v1-1/resolve/main/control_v11p_sd15_openpose.pth",
|
31 |
+
"https://huggingface.co/lllyasviel/ControlNet-v1-1/resolve/main/control_v11p_sd15_scribble.pth",
|
32 |
+
"https://huggingface.co/lllyasviel/ControlNet-v1-1/resolve/main/control_v11p_sd15_seg.pth",
|
33 |
+
"https://huggingface.co/lllyasviel/ControlNet-v1-1/resolve/main/control_v11p_sd15_softedge.pth",
|
34 |
+
"https://huggingface.co/lllyasviel/ControlNet-v1-1/resolve/main/control_v11p_sd15s2_lineart_anime.pth",
|
35 |
+
"https://huggingface.co/TencentARC/T2I-Adapter/resolve/main/models/t2iadapter_style_sd14v1.pth",
|
36 |
+
"https://huggingface.co/lllyasviel/sd_control_collection/resolve/main/diffusers_xl_canny_full.safetensors",
|
37 |
+
"https://huggingface.co/lllyasviel/sd_control_collection/resolve/main/diffusers_xl_depth_full.safetensors",
|
38 |
+
"https://huggingface.co/lllyasviel/sd_control_collection/resolve/main/ioclab_sd15_recolor.safetensors",
|
39 |
+
"https://huggingface.co/lllyasviel/sd_control_collection/resolve/main/ip-adapter_sd15_plus.pth",
|
40 |
+
"https://huggingface.co/lllyasviel/sd_control_collection/resolve/main/ip-adapter_xl.pth",
|
41 |
+
"https://huggingface.co/lllyasviel/sd_control_collection/resolve/main/kohya_controllllite_xl_canny_anime.safetensors",
|
42 |
+
"https://huggingface.co/lllyasviel/sd_control_collection/resolve/main/kohya_controllllite_xl_depth_anime.safetensors",
|
43 |
+
"https://huggingface.co/lllyasviel/sd_control_collection/resolve/main/kohya_controllllite_xl_openpose_anime.safetensors",
|
44 |
+
"https://huggingface.co/lllyasviel/sd_control_collection/resolve/main/kohya_controllllite_xl_openpose_anime_v2.safetensors",
|
45 |
+
"https://huggingface.co/lllyasviel/sd_control_collection/resolve/main/kohya_controllllite_xl_scribble_anime.safetensors",
|
46 |
+
"https://huggingface.co/lllyasviel/sd_control_collection/resolve/main/sai_xl_canny_256lora.safetensors",
|
47 |
+
"https://huggingface.co/lllyasviel/sd_control_collection/resolve/main/sai_xl_depth_256lora.safetensors",
|
48 |
+
"https://huggingface.co/lllyasviel/sd_control_collection/resolve/main/sai_xl_recolor_256lora.safetensors",
|
49 |
+
"https://huggingface.co/lllyasviel/sd_control_collection/resolve/main/sai_xl_sketch_256lora.safetensors",
|
50 |
+
"https://huggingface.co/lllyasviel/sd_control_collection/resolve/main/sargezt_xl_depth.safetensors",
|
51 |
+
"https://huggingface.co/lllyasviel/sd_control_collection/resolve/main/sargezt_xl_depth_faid_vidit.safetensors",
|
52 |
+
"https://huggingface.co/lllyasviel/sd_control_collection/resolve/main/sargezt_xl_depth_zeed.safetensors",
|
53 |
+
"https://huggingface.co/lllyasviel/sd_control_collection/resolve/main/sargezt_xl_softedge.safetensors",
|
54 |
+
"https://huggingface.co/lllyasviel/sd_control_collection/resolve/main/t2i-adapter_xl_canny.safetensors",
|
55 |
+
"https://huggingface.co/lllyasviel/sd_control_collection/resolve/main/t2i-adapter_xl_openpose.safetensors",
|
56 |
+
"https://huggingface.co/lllyasviel/sd_control_collection/resolve/main/t2i-adapter_xl_sketch.safetensors",
|
57 |
+
"https://huggingface.co/lllyasviel/sd_control_collection/resolve/main/thibaud_xl_openpose.safetensors",
|
58 |
+
"https://huggingface.co/h94/IP-Adapter/resolve/main/sdxl_models/ip-adapter-plus-face_sdxl_vit-h.safetensors",
|
59 |
+
"https://huggingface.co/h94/IP-Adapter/resolve/main/sdxl_models/ip-adapter-plus_sdxl_vit-h.safetensors",
|
60 |
+
"https://huggingface.co/h94/IP-Adapter-FaceID/resolve/main/ip-adapter-faceid-plusv2_sdxl.bin",
|
61 |
+
"https://huggingface.co/h94/IP-Adapter-FaceID/resolve/main/ip-adapter-faceid-plusv2_sd15.bin"
|
62 |
+
]
|
63 |
+
|
64 |
+
# Create the target folder if it doesn't exist
|
65 |
+
os.makedirs(target_folder, exist_ok=True)
|
66 |
+
|
67 |
+
# Change the current working directory to the target folder
|
68 |
+
os.chdir(target_folder)
|
69 |
+
|
70 |
+
print("Current Directory:", os.getcwd())
|
71 |
+
|
72 |
+
# Run the git clone command
|
73 |
+
subprocess.run(["git", "clone", repo_url])
|
74 |
+
|
75 |
+
print("ControlNet cloned successfully.")
|
76 |
+
|
77 |
+
# Change the current working directory to the cloned repository folder
|
78 |
+
repo_name = os.path.basename(repo_url)
|
79 |
+
|
80 |
+
os.chdir('sd-webui-controlnet')
|
81 |
+
|
82 |
+
print("Current Directory:", os.getcwd())
|
83 |
+
# Run the git clone command
|
84 |
+
subprocess.run(["git", "pull", repo_url])
|
85 |
+
|
86 |
+
print("ControlNet updated successfully.")
|
87 |
+
|
88 |
+
# Download the files into the models folder
|
89 |
+
models_folder = os.path.join(os.getcwd(), "models")
|
90 |
+
print("Current Directory:", os.getcwd())
|
91 |
+
print("models_folder Directory:", models_folder)
|
92 |
+
os.makedirs(models_folder, exist_ok=True)
|
93 |
+
|
94 |
+
total_files = len(urls)
|
95 |
+
downloaded_files = 0
|
96 |
+
print(f"Downloaded ({downloaded_files}/{total_files})")
|
97 |
+
for url in urls:
|
98 |
+
# Extract the filename from the URL
|
99 |
+
filename = os.path.basename(url)
|
100 |
+
|
101 |
+
# Set the path for saving the file
|
102 |
+
filepath = os.path.join(models_folder, filename)
|
103 |
+
|
104 |
+
# Skip downloading if the file already exists and its size matches the expected size
|
105 |
+
if os.path.exists(filepath):
|
106 |
+
downloaded_files += 1
|
107 |
+
print(f"Skipped {filename} Make sure that it was fully Downloaded! ({downloaded_files}/{total_files})")
|
108 |
+
continue
|
109 |
+
|
110 |
+
# Send a GET request to download the file
|
111 |
+
response = requests.get(url, stream=True)
|
112 |
+
|
113 |
+
# Get the total file size in bytes
|
114 |
+
total_length = int(response.headers.get("content-length"))
|
115 |
+
|
116 |
+
# Download the file in chunks and display progress
|
117 |
+
with open(filepath, "wb") as file, tqdm(
|
118 |
+
desc=f"Downloading {filename}", total=total_length, unit="B", unit_scale=True
|
119 |
+
) as progress_bar:
|
120 |
+
for data in response.iter_content(chunk_size=4096):
|
121 |
+
file.write(data)
|
122 |
+
progress_bar.update(len(data))
|
123 |
+
|
124 |
+
downloaded_files += 1
|
125 |
+
print(f"Downloaded {filename} ({downloaded_files}/{total_files})")
|
126 |
+
|
127 |
+
print("All files downloaded successfully.")
|
mass_compute_v2/download_ip_adapter_and_instantid.py
ADDED
@@ -0,0 +1,68 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
import os
|
2 |
+
import requests
|
3 |
+
import time
|
4 |
+
|
5 |
+
def download_file(url, path, filename, retries=9, timeout=120):
|
6 |
+
"""
|
7 |
+
Download a file from a given URL and save it to the specified path with resume support.
|
8 |
+
|
9 |
+
Parameters:
|
10 |
+
- url (str): URL of the file to be downloaded.
|
11 |
+
- path (str): Directory where the file will be saved.
|
12 |
+
- filename (str): Name of the file to be saved.
|
13 |
+
- retries (int): Number of retries if the download fails. Default is 9.
|
14 |
+
- timeout (int): Timeout for the download request in seconds. Default is 120.
|
15 |
+
"""
|
16 |
+
|
17 |
+
# Create the directory if it does not exist
|
18 |
+
os.makedirs(path, exist_ok=True)
|
19 |
+
|
20 |
+
file_path = os.path.join(path, filename)
|
21 |
+
print(f"\nDownloading {filename} to {file_path}")
|
22 |
+
|
23 |
+
try:
|
24 |
+
with requests.get(url, stream=True, timeout=timeout) as response:
|
25 |
+
response.raise_for_status()
|
26 |
+
total_size = int(response.headers.get('content-length', 0))
|
27 |
+
block_size = 2048576 # 2 MB
|
28 |
+
|
29 |
+
with open(file_path, 'wb') as file:
|
30 |
+
start_time = time.time()
|
31 |
+
for data in response.iter_content(block_size):
|
32 |
+
file.write(data)
|
33 |
+
downloaded_size = file.tell()
|
34 |
+
elapsed_time = time.time() - start_time
|
35 |
+
download_speed = downloaded_size / elapsed_time / 1024 # Speed in KiB/s
|
36 |
+
|
37 |
+
# Display download progress and speed
|
38 |
+
progress = (downloaded_size / total_size) * 100
|
39 |
+
print(f"Downloaded {downloaded_size}/{total_size} bytes "
|
40 |
+
f"({progress:.2f}%) at {download_speed:.2f} KiB/s", end='\r')
|
41 |
+
|
42 |
+
print(f"\nDownload completed: {filename}")
|
43 |
+
return file_path
|
44 |
+
|
45 |
+
except requests.RequestException as e:
|
46 |
+
if retries > 0:
|
47 |
+
print(f"\nError occurred: {e}. Retrying...")
|
48 |
+
return download_file(url, path, filename, retries=retries-1, timeout=timeout)
|
49 |
+
else:
|
50 |
+
print("\nDownload failed after multiple retries.")
|
51 |
+
return None
|
52 |
+
|
53 |
+
# Example usage
|
54 |
+
download_file('https://huggingface.co/h94/IP-Adapter-FaceID/resolve/main/ip-adapter-faceid-plusv2_sd15_lora.safetensors',
|
55 |
+
'stable-diffusion-webui/models/Lora',
|
56 |
+
'ip-adapter-faceid-plusv2_sd15_lora.safetensors')
|
57 |
+
|
58 |
+
download_file('https://huggingface.co/h94/IP-Adapter-FaceID/resolve/main/ip-adapter-faceid-plusv2_sdxl_lora.safetensors',
|
59 |
+
'stable-diffusion-webui/models/Lora',
|
60 |
+
'ip-adapter-faceid-plusv2_sdxl_lora.safetensors')
|
61 |
+
|
62 |
+
download_file('https://huggingface.co/InstantX/InstantID/resolve/main/ip-adapter.bin',
|
63 |
+
'stable-diffusion-webui/models/ControlNet',
|
64 |
+
'ip-adapter_instant_id_sdxl.bin')
|
65 |
+
|
66 |
+
download_file('https://huggingface.co/InstantX/InstantID/resolve/main/ControlNetModel/diffusion_pytorch_model.safetensors',
|
67 |
+
'stable-diffusion-webui/models/ControlNet',
|
68 |
+
'control_instant_id_sdxl.safetensors')
|
mass_compute_v2/download_models.py
ADDED
@@ -0,0 +1,73 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
import os
|
2 |
+
import platform
|
3 |
+
import requests
|
4 |
+
import time
|
5 |
+
import zipfile
|
6 |
+
|
7 |
+
def download_file(url, base_path, sub_path, filename, retries=9, timeout=120):
|
8 |
+
"""
|
9 |
+
Download a file from a given URL and save it to the specified path with resume support.
|
10 |
+
|
11 |
+
Parameters:
|
12 |
+
- url (str): URL of the file to be downloaded.
|
13 |
+
- base_path (str): Base directory where the file will be saved.
|
14 |
+
- sub_path (str): Subdirectory under the base directory where the file will be saved.
|
15 |
+
- filename (str): Name of the file to be saved.
|
16 |
+
- retries (int): Number of retries if the download fails. Default is 3.
|
17 |
+
- timeout (int): Timeout for the download request in seconds. Default is 10.
|
18 |
+
"""
|
19 |
+
|
20 |
+
print(f"\nDownloading {filename}!")
|
21 |
+
# Construct the full file path using os.path.join
|
22 |
+
file_path = os.path.join(base_path, sub_path, filename)
|
23 |
+
|
24 |
+
downloaded_size = 0
|
25 |
+
if os.path.exists(file_path):
|
26 |
+
downloaded_size = os.path.getsize(file_path)
|
27 |
+
|
28 |
+
headers = {}
|
29 |
+
if downloaded_size:
|
30 |
+
headers['Range'] = f"bytes={downloaded_size}-"
|
31 |
+
|
32 |
+
try:
|
33 |
+
response = requests.get(url, headers=headers, stream=True, timeout=timeout)
|
34 |
+
response.raise_for_status()
|
35 |
+
|
36 |
+
total_size = downloaded_size + int(response.headers.get('content-length', 0))
|
37 |
+
|
38 |
+
block_size = 2048576 # 1 MB
|
39 |
+
|
40 |
+
with open(file_path, 'ab') as file:
|
41 |
+
start_time = time.time()
|
42 |
+
for data in response.iter_content(block_size):
|
43 |
+
file.write(data)
|
44 |
+
|
45 |
+
downloaded_size += len(data)
|
46 |
+
elapsed_time = time.time() - start_time
|
47 |
+
download_speed = downloaded_size / elapsed_time / 1024 # Speed in KiB/s
|
48 |
+
|
49 |
+
# Display download progress and speed
|
50 |
+
progress = (downloaded_size / total_size) * 100
|
51 |
+
print(f"Downloaded {downloaded_size}/{total_size} bytes "
|
52 |
+
f"({progress:.2f}%) at {download_speed:.2f} KiB/s", end='\r')
|
53 |
+
|
54 |
+
print(f"\nDownload completed {filename}!")
|
55 |
+
return file_path
|
56 |
+
|
57 |
+
except requests.RequestException as e:
|
58 |
+
if retries > 0:
|
59 |
+
print(f"Error occurred: {e}. Retrying...")
|
60 |
+
return download_file(url, base_path, sub_path, filename, retries=retries-1, timeout=timeout)
|
61 |
+
else:
|
62 |
+
print("Download failed after multiple retries.")
|
63 |
+
return None
|
64 |
+
|
65 |
+
|
66 |
+
download_file('https://huggingface.co/SG161222/Realistic_Vision_V6.0_B1_noVAE/resolve/main/Realistic_Vision_V6.0_NV_B1.safetensors',
|
67 |
+
'stable-diffusion-webui', 'models/Stable-diffusion', 'Realistic_Vision_6.0.safetensors')
|
68 |
+
download_file('https://huggingface.co/stabilityai/stable-diffusion-xl-base-1.0/resolve/main/sd_xl_base_1.0_0.9vae.safetensors',
|
69 |
+
'stable-diffusion-webui', 'models/Stable-diffusion', 'sd_xl_base_1.0.safetensors')
|
70 |
+
download_file('https://huggingface.co/SG161222/RealVisXL_V4.0/resolve/main/RealVisXL_V4.0.safetensors',
|
71 |
+
'stable-diffusion-webui', 'models/Stable-diffusion', 'RealVisXL_V4.safetensors')
|
72 |
+
download_file('https://huggingface.co/MonsterMMORPG/Stable-Diffusion/resolve/main/best_realism.safetensors',
|
73 |
+
'stable-diffusion-webui', 'models/Stable-diffusion', 'Hyper_Realism_V3.safetensors')
|
mass_compute_v2/install_TensorRT.sh
ADDED
@@ -0,0 +1,24 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
|
2 |
+
source /home/Ubuntu/apps/stable-diffusion-webui/venv/bin/activate
|
3 |
+
|
4 |
+
cd /home/Ubuntu/apps/stable-diffusion-webui
|
5 |
+
git pull
|
6 |
+
cd /home/Ubuntu/apps/stable-diffusion-webui/extensions
|
7 |
+
git clone https://github.com/NVIDIA/Stable-Diffusion-WebUI-TensorRT
|
8 |
+
|
9 |
+
|
10 |
+
cd /home/Ubuntu/apps/stable-diffusion-webui
|
11 |
+
|
12 |
+
wget https://huggingface.co/MonsterMMORPG/SECourses/resolve/main/styles.csv -O styles.csv
|
13 |
+
|
14 |
+
pip install nvidia-cudnn-cu11==8.9.4.25 --no-cache-dir
|
15 |
+
|
16 |
+
pip install --pre --extra-index-url https://pypi.nvidia.com tensorrt==9.0.1.post11.dev4 --no-cache-dir
|
17 |
+
|
18 |
+
pip install polygraphy --extra-index-url https://pypi.ngc.nvidia.com
|
19 |
+
|
20 |
+
pip install protobuf==3.20.2
|
21 |
+
|
22 |
+
pip install onnx-graphsurgeon --extra-index-url https://pypi.ngc.nvidia.com
|
23 |
+
|
24 |
+
pip install optimum
|
mass_compute_v2/update_sd1111.sh
ADDED
@@ -0,0 +1,14 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
cd /home/Ubuntu/apps/stable-diffusion-webui
|
2 |
+
git pull
|
3 |
+
wget https://huggingface.co/MonsterMMORPG/SECourses/resolve/main/styles.csv -O styles.csv
|
4 |
+
cd /home/Ubuntu/apps/stable-diffusion-webui/extensions
|
5 |
+
git clone https://github.com/Bing-su/adetailer
|
6 |
+
git clone https://github.com/Mikubill/sd-webui-controlnet
|
7 |
+
git clone https://github.com/diffus-me/sd-webui-facefusion
|
8 |
+
source /home/Ubuntu/apps/stable-diffusion-webui/venv/bin/activate
|
9 |
+
conda install -c conda-forge gcc_linux-64 gxx_linux-64 --yes
|
10 |
+
pip install insightface==0.7.3
|
11 |
+
pip install torch==2.2.0 torchvision torchaudio --index-url https://download.pytorch.org/whl/cu121 --upgrade
|
12 |
+
pip install xformers==0.0.24
|
13 |
+
pip install basicsr
|
14 |
+
pip install realesrgan
|
mass_compute_v2/upload_hugging_face.ipynb
ADDED
@@ -0,0 +1,110 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
{
|
2 |
+
"cells": [
|
3 |
+
{
|
4 |
+
"cell_type": "code",
|
5 |
+
"execution_count": null,
|
6 |
+
"id": "caa74bef",
|
7 |
+
"metadata": {},
|
8 |
+
"outputs": [],
|
9 |
+
"source": [
|
10 |
+
"!pip install huggingface_hub --upgrade\n",
|
11 |
+
"\n",
|
12 |
+
"!pip install ipywidgets --upgrade"
|
13 |
+
]
|
14 |
+
},
|
15 |
+
{
|
16 |
+
"cell_type": "code",
|
17 |
+
"execution_count": null,
|
18 |
+
"id": "e10d4e70-b7c5-476b-916c-14cce7e436e5",
|
19 |
+
"metadata": {},
|
20 |
+
"outputs": [],
|
21 |
+
"source": [
|
22 |
+
"from huggingface_hub import login\n",
|
23 |
+
"login()"
|
24 |
+
]
|
25 |
+
},
|
26 |
+
{
|
27 |
+
"cell_type": "code",
|
28 |
+
"execution_count": null,
|
29 |
+
"id": "0502703b-8b44-4e58-af2c-82f67d713548",
|
30 |
+
"metadata": {},
|
31 |
+
"outputs": [],
|
32 |
+
"source": [
|
33 |
+
"from huggingface_hub import HfApi\n",
|
34 |
+
"api = HfApi()\n",
|
35 |
+
"api.upload_file(\n",
|
36 |
+
" path_or_fileobj=r\"/home/Ubuntu/apps/stable-diffusion-webui/models/Stable-diffusion/model_name.safetensors\",\n",
|
37 |
+
" path_in_repo=\"model_name.safetensors\",\n",
|
38 |
+
" repo_id=\"YourUserName/reponame\",\n",
|
39 |
+
" repo_type=\"model\",\n",
|
40 |
+
")"
|
41 |
+
]
|
42 |
+
},
|
43 |
+
{
|
44 |
+
"cell_type": "code",
|
45 |
+
"execution_count": null,
|
46 |
+
"id": "3be9367c-a04d-4d05-83ad-c8504e0383b4",
|
47 |
+
"metadata": {},
|
48 |
+
"outputs": [],
|
49 |
+
"source": [
|
50 |
+
"from huggingface_hub import HfApi\n",
|
51 |
+
"api = HfApi()\n",
|
52 |
+
"api.upload_folder(\n",
|
53 |
+
" folder_path=r\"/home/Ubuntu/apps/stable-diffusion-webui/models/Stable-diffusion\",\n",
|
54 |
+
" repo_id=\"YourUserName/reponame\",\n",
|
55 |
+
" repo_type=\"model\",\n",
|
56 |
+
")"
|
57 |
+
]
|
58 |
+
},
|
59 |
+
{
|
60 |
+
"cell_type": "code",
|
61 |
+
"execution_count": null,
|
62 |
+
"id": "6fc96104",
|
63 |
+
"metadata": {},
|
64 |
+
"outputs": [],
|
65 |
+
"source": [
|
66 |
+
"from huggingface_hub import HfApi\n",
|
67 |
+
"from huggingface_hub import get_collection, delete_collection_item\n",
|
68 |
+
"from huggingface_hub import upload_file\n",
|
69 |
+
"from huggingface_hub import (\n",
|
70 |
+
" HfFolder,\n",
|
71 |
+
" ModelCard,\n",
|
72 |
+
" ModelCardData,\n",
|
73 |
+
" create_repo,\n",
|
74 |
+
" hf_hub_download,\n",
|
75 |
+
" upload_folder,\n",
|
76 |
+
" whoami,\n",
|
77 |
+
")\n",
|
78 |
+
"api = HfApi()\n",
|
79 |
+
"upload_folder(\n",
|
80 |
+
" folder_path=r\"/home/Ubuntu/apps/stable-diffusion-webui/models/Stable-diffusion\",\n",
|
81 |
+
" repo_id=\"YourUserName/reponame\",\n",
|
82 |
+
" repo_type=\"model\",\n",
|
83 |
+
" multi_commits=True,\n",
|
84 |
+
" multi_commits_verbose=True,\n",
|
85 |
+
")\n"
|
86 |
+
]
|
87 |
+
}
|
88 |
+
],
|
89 |
+
"metadata": {
|
90 |
+
"kernelspec": {
|
91 |
+
"display_name": "Python 3 (ipykernel)",
|
92 |
+
"language": "python",
|
93 |
+
"name": "python3"
|
94 |
+
},
|
95 |
+
"language_info": {
|
96 |
+
"codemirror_mode": {
|
97 |
+
"name": "ipython",
|
98 |
+
"version": 3
|
99 |
+
},
|
100 |
+
"file_extension": ".py",
|
101 |
+
"mimetype": "text/x-python",
|
102 |
+
"name": "python",
|
103 |
+
"nbconvert_exporter": "python",
|
104 |
+
"pygments_lexer": "ipython3",
|
105 |
+
"version": "3.10.13"
|
106 |
+
}
|
107 |
+
},
|
108 |
+
"nbformat": 4,
|
109 |
+
"nbformat_minor": 5
|
110 |
+
}
|