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CBmY9H7"
|
8 |
+
},
|
9 |
+
"outputs": [],
|
10 |
+
"source": [
|
11 |
+
"!pip install pygit2==1.15.1\n",
|
12 |
+
"%cd /content\n",
|
13 |
+
"!git clone https://github.com/lllyasviel/Fooocus.git"
|
14 |
+
]
|
15 |
+
},
|
16 |
+
{
|
17 |
+
"cell_type": "code",
|
18 |
+
"execution_count": null,
|
19 |
+
"metadata": {
|
20 |
+
"id": "7XPqy05QY9bo"
|
21 |
+
},
|
22 |
+
"outputs": [],
|
23 |
+
"source": [
|
24 |
+
"import os\n",
|
25 |
+
"import requests\n",
|
26 |
+
"from tqdm import tqdm # Install tqdm if not already installed: pip install tqdm\n",
|
27 |
+
"\n",
|
28 |
+
"# Define the file URL and target directory\n",
|
29 |
+
"file_url = \"https://huggingface.co/Akkumar001/MOMies/resolve/main/Illustrious-HD2_6gb.json\"\n",
|
30 |
+
"target_dir = \"/content/Fooocus/presets\"\n",
|
31 |
+
"\n",
|
32 |
+
"# Extract the file name from the URL\n",
|
33 |
+
"file_name = os.path.basename(file_url)\n",
|
34 |
+
"\n",
|
35 |
+
"# Target file path\n",
|
36 |
+
"target_file = os.path.join(target_dir, file_name)\n",
|
37 |
+
"\n",
|
38 |
+
"# Hugging Face access token\n",
|
39 |
+
"hf_token = \"YOUR HUGGING FACE TOKEN\" # Replace with your token\n",
|
40 |
+
"\n",
|
41 |
+
"# Ensure the target directory exists\n",
|
42 |
+
"os.makedirs(target_dir, exist_ok=True)\n",
|
43 |
+
"\n",
|
44 |
+
"# Download the file with streaming\n",
|
45 |
+
"headers = {\"Authorization\": f\"Bearer {hf_token}\"}\n",
|
46 |
+
"response = requests.get(file_url, headers=headers, stream=True)\n",
|
47 |
+
"\n",
|
48 |
+
"if response.status_code == 200:\n",
|
49 |
+
" # Get the total file size from headers\n",
|
50 |
+
" total_size = int(response.headers.get(\"content-length\", 0))\n",
|
51 |
+
" chunk_size = 1024 # 1 KB per chunk\n",
|
52 |
+
"\n",
|
53 |
+
" # Use tqdm for progress bar\n",
|
54 |
+
" with open(target_file, \"wb\") as f, tqdm(\n",
|
55 |
+
" desc=f\"Downloading {file_name}\",\n",
|
56 |
+
" total=total_size,\n",
|
57 |
+
" unit=\"B\",\n",
|
58 |
+
" unit_scale=True,\n",
|
59 |
+
" unit_divisor=1024,\n",
|
60 |
+
" ) as progress_bar:\n",
|
61 |
+
" for chunk in response.iter_content(chunk_size=chunk_size):\n",
|
62 |
+
" if chunk: # Filter out keep-alive chunks\n",
|
63 |
+
" f.write(chunk)\n",
|
64 |
+
" progress_bar.update(len(chunk))\n",
|
65 |
+
" print(f\"\\nFile successfully downloaded to {target_file}\")\n",
|
66 |
+
"else:\n",
|
67 |
+
" print(f\"Failed to download the file. Status code: {response.status_code}\")\n"
|
68 |
+
]
|
69 |
+
},
|
70 |
+
{
|
71 |
+
"cell_type": "code",
|
72 |
+
"execution_count": null,
|
73 |
+
"metadata": {
|
74 |
+
"id": "Z4hXeXiGP83c"
|
75 |
+
},
|
76 |
+
"outputs": [],
|
77 |
+
"source": [
|
78 |
+
"import os\n",
|
79 |
+
"import requests\n",
|
80 |
+
"from tqdm import tqdm # Install tqdm if not already installed: pip install tqdm\n",
|
81 |
+
"\n",
|
82 |
+
"# Define the file URL and target directory\n",
|
83 |
+
"file_url = \"https://huggingface.co/Akkumar001/MOMies/resolve/main/Nohara_Misae_CrayonShinchan.safetensors\"\n",
|
84 |
+
"target_dir = \"/content/Fooocus/models/loras\"\n",
|
85 |
+
"\n",
|
86 |
+
"# Extract the file name from the URL\n",
|
87 |
+
"file_name = os.path.basename(file_url)\n",
|
88 |
+
"\n",
|
89 |
+
"# Target file path\n",
|
90 |
+
"target_file = os.path.join(target_dir, file_name)\n",
|
91 |
+
"\n",
|
92 |
+
"# Hugging Face access token\n",
|
93 |
+
"hf_token = \"YOUR HUGGING FACE TOKEN\" # Replace with your token\n",
|
94 |
+
"\n",
|
95 |
+
"# Ensure the target directory exists\n",
|
96 |
+
"os.makedirs(target_dir, exist_ok=True)\n",
|
97 |
+
"\n",
|
98 |
+
"# Download the file with streaming\n",
|
99 |
+
"headers = {\"Authorization\": f\"Bearer {hf_token}\"}\n",
|
100 |
+
"response = requests.get(file_url, headers=headers, stream=True)\n",
|
101 |
+
"\n",
|
102 |
+
"if response.status_code == 200:\n",
|
103 |
+
" # Get the total file size from headers\n",
|
104 |
+
" total_size = int(response.headers.get(\"content-length\", 0))\n",
|
105 |
+
" chunk_size = 1024 # 1 KB per chunk\n",
|
106 |
+
"\n",
|
107 |
+
" # Use tqdm for progress bar\n",
|
108 |
+
" with open(target_file, \"wb\") as f, tqdm(\n",
|
109 |
+
" desc=f\"Downloading {file_name}\",\n",
|
110 |
+
" total=total_size,\n",
|
111 |
+
" unit=\"B\",\n",
|
112 |
+
" unit_scale=True,\n",
|
113 |
+
" unit_divisor=1024,\n",
|
114 |
+
" ) as progress_bar:\n",
|
115 |
+
" for chunk in response.iter_content(chunk_size=chunk_size):\n",
|
116 |
+
" if chunk: # Filter out keep-alive chunks\n",
|
117 |
+
" f.write(chunk)\n",
|
118 |
+
" progress_bar.update(len(chunk))\n",
|
119 |
+
" print(f\"\\nFile successfully downloaded to {target_file}\")\n",
|
120 |
+
"else:\n",
|
121 |
+
" print(f\"Failed to download the file. Status code: {response.status_code}\")\n"
|
122 |
+
]
|
123 |
+
},
|
124 |
+
{
|
125 |
+
"cell_type": "code",
|
126 |
+
"execution_count": null,
|
127 |
+
"metadata": {
|
128 |
+
"id": "G8i2a_nxaNPN"
|
129 |
+
},
|
130 |
+
"outputs": [],
|
131 |
+
"source": [
|
132 |
+
"import os\n",
|
133 |
+
"import requests\n",
|
134 |
+
"from tqdm import tqdm # Install tqdm if not already installed: pip install tqdm\n",
|
135 |
+
"\n",
|
136 |
+
"# Define the file URL and target directory\n",
|
137 |
+
"file_url = \"https://huggingface.co/Akkumar001/MOMies/resolve/main/MITSE_SHINCHAIN_PROMPT.txt\"\n",
|
138 |
+
"target_dir = \"/content/\"\n",
|
139 |
+
"\n",
|
140 |
+
"# Extract the file name from the URL\n",
|
141 |
+
"file_name = os.path.basename(file_url)\n",
|
142 |
+
"\n",
|
143 |
+
"# Target file path\n",
|
144 |
+
"target_file = os.path.join(target_dir, file_name)\n",
|
145 |
+
"\n",
|
146 |
+
"# Hugging Face access token\n",
|
147 |
+
"hf_token = \"YOUR HUGGING FACE TOKEN\" # Replace with your token\n",
|
148 |
+
"\n",
|
149 |
+
"# Ensure the target directory exists\n",
|
150 |
+
"os.makedirs(target_dir, exist_ok=True)\n",
|
151 |
+
"\n",
|
152 |
+
"# Download the file with streaming\n",
|
153 |
+
"headers = {\"Authorization\": f\"Bearer {hf_token}\"}\n",
|
154 |
+
"response = requests.get(file_url, headers=headers, stream=True)\n",
|
155 |
+
"\n",
|
156 |
+
"if response.status_code == 200:\n",
|
157 |
+
" # Get the total file size from headers\n",
|
158 |
+
" total_size = int(response.headers.get(\"content-length\", 0))\n",
|
159 |
+
" chunk_size = 1024 # 1 KB per chunk\n",
|
160 |
+
"\n",
|
161 |
+
" # Use tqdm for progress bar\n",
|
162 |
+
" with open(target_file, \"wb\") as f, tqdm(\n",
|
163 |
+
" desc=f\"Downloading {file_name}\",\n",
|
164 |
+
" total=total_size,\n",
|
165 |
+
" unit=\"B\",\n",
|
166 |
+
" unit_scale=True,\n",
|
167 |
+
" unit_divisor=1024,\n",
|
168 |
+
" ) as progress_bar:\n",
|
169 |
+
" for chunk in response.iter_content(chunk_size=chunk_size):\n",
|
170 |
+
" if chunk: # Filter out keep-alive chunks\n",
|
171 |
+
" f.write(chunk)\n",
|
172 |
+
" progress_bar.update(len(chunk))\n",
|
173 |
+
" print(f\"\\nFile successfully downloaded to {target_file}\")\n",
|
174 |
+
"else:\n",
|
175 |
+
" print(f\"Failed to download the file. Status code: {response.status_code}\")\n"
|
176 |
+
]
|
177 |
+
},
|
178 |
+
{
|
179 |
+
"cell_type": "code",
|
180 |
+
"execution_count": null,
|
181 |
+
"metadata": {
|
182 |
+
"id": "VjYy0F2gZIPR"
|
183 |
+
},
|
184 |
+
"outputs": [],
|
185 |
+
"source": [
|
186 |
+
"%cd /content/Fooocus\n",
|
187 |
+
"!python entry_with_update.py --share --always-high-vram\n"
|
188 |
+
]
|
189 |
+
}
|
190 |
+
],
|
191 |
+
"metadata": {
|
192 |
+
"accelerator": "GPU",
|
193 |
+
"colab": {
|
194 |
+
"gpuType": "T4",
|
195 |
+
"provenance": []
|
196 |
+
},
|
197 |
+
"kernelspec": {
|
198 |
+
"display_name": "Python 3",
|
199 |
+
"name": "python3"
|
200 |
+
},
|
201 |
+
"language_info": {
|
202 |
+
"name": "python"
|
203 |
+
}
|
204 |
+
},
|
205 |
+
"nbformat": 4,
|
206 |
+
"nbformat_minor": 0
|
207 |
+
}
|