Spaces:
Runtime error
Runtime error
ljy266987
commited on
Commit
·
9540f3e
1
Parent(s):
3b1bd69
try
Browse files
app.py
CHANGED
@@ -66,6 +66,21 @@ def generate(
|
|
66 |
top_k: int = 50,
|
67 |
repetition_penalty: float = 1.2,
|
68 |
) -> Iterator[str]:
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
69 |
conversation = []
|
70 |
if system_prompt:
|
71 |
conversation.append({"role": "system", "content": system_prompt})
|
|
|
66 |
top_k: int = 50,
|
67 |
repetition_penalty: float = 1.2,
|
68 |
) -> Iterator[str]:
|
69 |
+
|
70 |
+
## check inside function
|
71 |
+
# 检查CUDA是否可用
|
72 |
+
if torch.cuda.is_available():
|
73 |
+
print("check inside function: CUDA is available. Listing available GPUs:")
|
74 |
+
# 获取并打印GPU数量
|
75 |
+
num_gpus = torch.cuda.device_count()
|
76 |
+
for i in range(num_gpus):
|
77 |
+
print(f"check inside function: GPU {i}: {torch.cuda.get_device_name(i)}")
|
78 |
+
# 其他相关信息,例如内存
|
79 |
+
print(f"check inside function: Memory Allocated: {torch.cuda.memory_allocated(i) / 1024 ** 2:.0f} MB")
|
80 |
+
print(f"check inside function: Memory Reserved: {torch.cuda.memory_reserved(i) / 1024 ** 2:.0f} MB")
|
81 |
+
else:
|
82 |
+
print("check inside function: CUDA is not available.")
|
83 |
+
|
84 |
conversation = []
|
85 |
if system_prompt:
|
86 |
conversation.append({"role": "system", "content": system_prompt})
|