Update app1.py
Browse files
app1.py
CHANGED
@@ -1,7 +1,7 @@
|
|
1 |
import os
|
2 |
# import wandb
|
3 |
os.chdir(f"/home/xlab-app-center")
|
4 |
-
os.system(f"git clone https://
|
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")
|
@@ -46,8 +46,32 @@ 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 |
|
|
|
50 |
os.system('wandb login 5c00964de1bb95ec1ab24869d4c523c59e0fb8e3')
|
51 |
-
|
52 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
53 |
#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 & python launch.py --api --ui-settings-file /home/xlab-app-center/config.json --ui-config-file /home/xlab-app-center/ui-config.json --xformers --enable-insecure-extension-access --gradio-queue --disable-safe-unpickle --port=7861 --ngrok=2YteSlIvArBGFgXx70rY6MN1ThW_gUnTwjXzT5kbnNozZFL2")
|
|
|
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")
|
|
|
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-monitoring")
|
62 |
+
|
63 |
+
# 循环获取GPU温度和使用率并记录到WandB
|
64 |
+
while True:
|
65 |
+
# 获取GPU温度的代码
|
66 |
+
gpu_temperature_command = "nvidia-smi --query-gpu=temperature.gpu --format=csv,noheader,nounits"
|
67 |
+
gpu_temperature = int(os.popen(gpu_temperature_command).read().strip())
|
68 |
+
|
69 |
+
# 获取GPU使用率的代码
|
70 |
+
gpu_usage_command = "nvidia-smi --query-gpu=utilization.gpu --format=csv,noheader,nounits"
|
71 |
+
gpu_usage = int(os.popen(gpu_usage_command).read().strip())
|
72 |
+
|
73 |
+
# 将温度和使用率记录到WandB
|
74 |
+
wandb.log({"GPU 温度": gpu_temperature, "GPU 使用率": gpu_usage})
|
75 |
+
|
76 |
+
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")
|
77 |
#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 & python launch.py --api --ui-settings-file /home/xlab-app-center/config.json --ui-config-file /home/xlab-app-center/ui-config.json --xformers --enable-insecure-extension-access --gradio-queue --disable-safe-unpickle --port=7861 --ngrok=2YteSlIvArBGFgXx70rY6MN1ThW_gUnTwjXzT5kbnNozZFL2")
|