File size: 2,294 Bytes
0278d2a
4a75a39
31fabd8
b8d8d45
31fabd8
 
 
b8d8d45
18bc029
4a75a39
095ffb4
31fabd8
090409c
b8d8d45
31fabd8
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
4a75a39
31fabd8
 
0554c47
 
31fabd8
0554c47
31fabd8
22601f7
31fabd8
 
4a75a39
31fabd8
 
18bc029
 
b392eba
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
import os, sys, time, shlex, subprocess
from IPython import get_ipython
from pathlib import Path

xxx = Path("/kaggle/working")
zzz = Path("/kaggle/working/asd")
tmp = Path("/kaggle/temp")

pantat = f"curl -sLo {xxx}/pantat88.py https://raw.githubusercontent.com/gutris1/segsmaker/main/kaggle/script/pantat88.py"
get_ipython().system(pantat)

sys.path.append(str(xxx))
from pantat88 import pull, say, download

def nenen():
    os.chdir(zzz)
    say("【 {red} Installing Stable Diffusion {d} 】 {red}")
    
    time.sleep(2)
    pull(f"https://github.com/gutris1/segsmaker asd {zzz}")
    
    req_list = [
        f"https://huggingface.co/pantat88/ui/resolve/main/embeddings.zip {zzz}",
        f"https://huggingface.co/pantat88/ui/resolve/main/4x-UltraSharp.pth {zzz}/models/ESRGAN",
        f"https://huggingface.co/pantat88/ui/resolve/main/4x-AnimeSharp.pth {zzz}/models/ESRGAN",
        f"https://huggingface.co/pantat88/ui/resolve/main/4x_NMKD-Superscale-SP_178000_G.pth {zzz}/models/ESRGAN",
        f"https://huggingface.co/pantat88/ui/resolve/main/4x_RealisticRescaler_100000_G.pth {zzz}/models/ESRGAN",
        f"https://huggingface.co/pantat88/ui/resolve/main/8x_RealESRGAN.pth {zzz}/models/ESRGAN",
        f"https://huggingface.co/pantat88/ui/resolve/main/4x_foolhardy_Remacri.pth {zzz}/models/ESRGAN",
        f"https://huggingface.co/stabilityai/sd-vae-ft-mse-original/resolve/main/vae-ft-mse-840000-ema-pruned.safetensors {zzz}/models/VAE"]
    
    for lines in req_list:
        download(lines)
    
    unzip = f"unzip -qo {zzz}/embeddings.zip -d {zzz}/embeddings && rm {zzz}/embeddings.zip"
    get_ipython().system(unzip)
    
    cmd = [
        f"rm -rf {tmp}/* {zzz}/models/Stable-diffusion/tmp_ckpt {zzz}/models/Lora/tmp_lora {zzz}/outputs",
        f"mkdir -p {zzz}/models/Lora",
        f"ln -vs {tmp}/ckpt {zzz}/models/Stable-diffusion/tmp_ckpt",
        f"ln -vs {tmp}/lora {zzz}/models/Lora/tmp_lora",
        f"ln -vs {tmp}/outputs {zzz}/outputs",
        f"mkdir -p {tmp}/ckpt {tmp}/lora {tmp}/outputs {tmp}/svd {tmp}/z123"]
    
    for lines in cmd:
        subprocess.run(shlex.split(lines), stdout=subprocess.DEVNULL, stderr=subprocess.DEVNULL)

nenen()
(xxx / 'nenen88.py').unlink()
get_ipython().run_line_magic('run', f'{xxx}/pantat88.py')
os.chdir(xxx)