ACCA225 commited on
Commit
de7f595
1 Parent(s): 824111c

Upload app1 (1).py

Browse files
Files changed (1) hide show
  1. app1 (1).py +94 -0
app1 (1).py ADDED
@@ -0,0 +1,94 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ import os
2
+ # import wandb
3
+ os.chdir(f"/home/xlab-app-center")
4
+ os.system(f"git clone https://openi.pcl.ac.cn/2575044704/stable-diffusion-webui-v1.6.1 /home/xlab-app-center/stable-diffusion-webui")
5
+ os.system(f"cp /home/xlab-app-center/styles.csv /home/xlab-app-center/stable-diffusion-webui/styles.csv")
6
+ os.chdir(f"/home/xlab-app-center/stable-diffusion-webui")
7
+ os.system(f"git lfs install")
8
+ os.system(f"git reset --hard")
9
+ os.chdir(f"/home/xlab-app-center/stable-diffusion-webui/extensions")
10
+
11
+ plugins = [
12
+ "https://gitcode.net/overbill1683/stable-diffusion-webui-localization-zh_Hans",
13
+ "https://gitcode.net/ranting8323/multidiffusion-upscaler-for-automatic1111",
14
+ "https://gitcode.net/ranting8323/adetailer",
15
+ "https://gitcode.net/ranting8323/sd-webui-prompt-all-in-one",
16
+ "https://gitcode.net/ranting8323/sd-webui-inpaint-anything",
17
+ "https://gitcode.net/ranting8323/a1111-sd-webui-tagcomplete",
18
+ "https://gitcode.net/nightaway/sd-webui-infinite-image-browsing",
19
+ "https://openi.pcl.ac.cn/2575044704/sd-extension-system-info",
20
+ "https://openi.pcl.ac.cn/2575044704/batchlinks-webui"
21
+ ]
22
+
23
+ for plugin in plugins:
24
+ os.system(f"git clone {plugin}")
25
+ os.makedirs('/home/xlab-app-center/stable-diffusion-webui/models/adetailer', exist_ok=True)
26
+ os.chdir(f"/home/xlab-app-center/stable-diffusion-webui/models/adetailer")
27
+ os.system(f"aria2c --console-log-level=error -c -x 16 -s 16 -k 1M https://hf-mirror.com/Bingsu/adetailer/resolve/main/hand_yolov8s.pt -d /home/xlab-app-center/stable-diffusion-webui/models/adetailer -o hand_yolov8s.pt")
28
+ os.system(f"aria2c --console-log-level=error -c -x 16 -s 16 -k 1M https://hf-mirror.com/Bingsu/adetailer/resolve/main/hand_yolov8n.pt -d /home/xlab-app-center/stable-diffusion-webui/models/adetailer -o hand_yolov8n.pt")
29
+ os.system(f"aria2c --console-log-level=error -c -x 16 -s 16 -k 1M https://hf-mirror.com/datasets/ACCC1380/private-model/resolve/main/kaggle/input/museum/131-half.safetensors -d /home/xlab-app-center/stable-diffusion-webui/models/Stable-diffusion -o 131-half.safetensors")
30
+ os.system(f"aria2c --console-log-level=error -c -x 16 -s 16 -k 1M https://hf-mirror.com/datasets/ACCC1380/private-model/resolve/main/ba.safetensors -d /home/xlab-app-center/stable-diffusion-webui/models/Lora -o ba.safetensors")
31
+ os.system(f"aria2c --console-log-level=error -c -x 16 -s 16 -k 1M https://hf-mirror.com/datasets/ACCC1380/private-model/resolve/main/racaco2.safetensors -d /home/xlab-app-center/stable-diffusion-webui/models/Lora -o racaco2.safetensors")
32
+ os.system(f"aria2c --console-log-level=error -c -x 16 -s 16 -k 1M https://hf-mirror.com/coinz/Add-detail/resolve/main/add_detail.safetensors -d /home/xlab-app-center/stable-diffusion-webui/models/Lora -o add_detail.safetensors")
33
+ os.system(f"aria2c --console-log-level=error -c -x 16 -s 16 -k 1M https://hf-mirror.com/datasets/VASVASVAS/vae/resolve/main/pastel-waifu-diffusion.vae.pt -d /home/xlab-app-center/stable-diffusion-webui/models/VAE -o pastel-waifu-diffusion.vae.pt")
34
+ # os.system(f"aria2c --console-log-level=error -c -x 16 -s 16 -k 1M https://download.openxlab.org.cn/models/camenduru/sdxl-refiner-1.0/weight//sd_xl_refiner_1.0.safetensors -d /home/xlab-app-center/stable-diffusion-webui/models/Stable-diffusion -o sd_xl_refiner_1.0.safetensors")
35
+ # os.system(f"aria2c --console-log-level=error -c -x 16 -s 16 -k 1M https://download.openxlab.org.cn/models/camenduru/cyber-realistic/weight//cyberrealistic_v32.safetensors -d /home/xlab-app-center/stable-diffusion-webui/models/Stable-diffusion -o cyberrealistic_v32.safetensors")
36
+ os.chdir(f"/home/xlab-app-center/stable-diffusion-webui")
37
+ print('webui launching...')
38
+ package_envs = [
39
+ {"env": "STABLE_DIFFUSION_REPO", "url": os.environ.get('STABLE_DIFFUSION_REPO', "https://gitcode.net/overbill1683/stablediffusion")},
40
+ {"env": "STABLE_DIFFUSION_XL_REPO", "url": os.environ.get('STABLE_DIFFUSION_XL_REPO', "https://gitcode.net/overbill1683/generative-models")},
41
+ {"env": "K_DIFFUSION_REPO", "url": os.environ.get('K_DIFFUSION_REPO', "https://gitcode.net/overbill1683/k-diffusion")},
42
+ {"env": "CODEFORMER_REPO", "url": os.environ.get('CODEFORMER_REPO', "https://gitcode.net/overbill1683/CodeFormer")},
43
+ {"env": "BLIP_REPO", "url": os.environ.get('BLIP_REPO', "https://gitcode.net/overbill1683/BLIP")},
44
+ ]
45
+ os.environ["PIP_INDEX_URL"] = "https://mirrors.aliyun.com/pypi/simple/"
46
+ for i in package_envs:
47
+ os.environ[i["env"]] = i["url"]
48
+
49
+ import os
50
+ import time
51
+ import wandb
52
+
53
+ import os
54
+ import time
55
+ import wandb
56
+
57
+ # WandB登录
58
+ os.system('wandb login 5c00964de1bb95ec1ab24869d4c523c59e0fb8e3')
59
+
60
+ # 初始化WandB项目
61
+ wandb.init(project="gpu-temperature-monitor")
62
+
63
+ import os
64
+ import threading
65
+ import wandb
66
+ import time
67
+ def wandb():
68
+ # Assuming you have initialized WandB before this function call
69
+ # ...
70
+
71
+ while True:
72
+ # Loop to continuously monitor GPU temperature and usage
73
+ gpu_temperature_command = "nvidia-smi --query-gpu=temperature.gpu --format=csv,noheader,nounits"
74
+ gpu_temperature = int(os.popen(gpu_temperature_command).read().strip())
75
+ gpu_usage_command = "nvidia-smi --query-gpu=utilization.gpu --format=csv,noheader,nounits"
76
+ gpu_usage = int(os.popen(gpu_usage_command).read().strip())
77
+
78
+ wandb.log({"GPU 温度": gpu_temperature, "GPU 使用率": gpu_usage})
79
+ time.sleep(60)
80
+
81
+ def start():
82
+ os.system(f"python launch.py --api --xformers --enable-insecure-extension-access --ui-settings-file /home/xlab-app-center/config.json --ui-config-file /home/xlab-app-center/ui-config.json --gradio-queue --disable-safe-unpickle --ngrok=2Z4gIgLcc0W20vmdmTHTgwlWXdR_5aHNP91mnkn1mFYXUKKEz")
83
+
84
+ # Create threads for each function
85
+ wandb_thread = threading.Thread(target=wandb)
86
+ start_thread = threading.Thread(target=start)
87
+
88
+ # Start the threads
89
+ wandb_thread.start()
90
+ start_thread.start()
91
+
92
+ # Wait for both threads to finish
93
+ wandb_thread.join()
94
+ start_thread.join()