Spaces:
Running
on
T4
Running
on
T4
ffreemt
commited on
Commit
•
60d0767
1
Parent(s):
0ad7d21
Update check nvidia-smi with subproces.run
Browse files- app.py +9 -0
- requirements.txt +1 -1
app.py
CHANGED
@@ -34,6 +34,7 @@ GenerationConfig {
|
|
34 |
# pylint: disable=line-too-long, invalid-name, no-member, redefined-outer-name, missing-function-docstring, missing-class-docstring, broad-except,
|
35 |
import gc
|
36 |
import os
|
|
|
37 |
import sys
|
38 |
import time
|
39 |
from collections import deque
|
@@ -43,6 +44,7 @@ from types import SimpleNamespace
|
|
43 |
from typing import List, Optional
|
44 |
|
45 |
import gradio as gr
|
|
|
46 |
import torch
|
47 |
from loguru import logger
|
48 |
from transformers import AutoModelForCausalLM, AutoTokenizer
|
@@ -538,4 +540,11 @@ with gr.Blocks(
|
|
538 |
|
539 |
if __name__ == "__main__":
|
540 |
logger.info("Just record start time")
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
541 |
block.queue(max_size=8).launch(debug=True)
|
|
|
34 |
# pylint: disable=line-too-long, invalid-name, no-member, redefined-outer-name, missing-function-docstring, missing-class-docstring, broad-except,
|
35 |
import gc
|
36 |
import os
|
37 |
+
import subprocess as sp
|
38 |
import sys
|
39 |
import time
|
40 |
from collections import deque
|
|
|
44 |
from typing import List, Optional
|
45 |
|
46 |
import gradio as gr
|
47 |
+
import rich
|
48 |
import torch
|
49 |
from loguru import logger
|
50 |
from transformers import AutoModelForCausalLM, AutoTokenizer
|
|
|
540 |
|
541 |
if __name__ == "__main__":
|
542 |
logger.info("Just record start time")
|
543 |
+
ret = sp.run("nvidia-smi", capture_output=1, check=0, shell=1, encoding='utf8')
|
544 |
+
if ret.stdout:
|
545 |
+
rich.print(ret.stdout)
|
546 |
+
if ret.stderr:
|
547 |
+
rich.print("[red bold]" + ret.stdout)
|
548 |
+
|
549 |
+
|
550 |
block.queue(max_size=8).launch(debug=True)
|
requirements.txt
CHANGED
@@ -1,5 +1,5 @@
|
|
1 |
# https://www.zhihu.com/question/309583980
|
2 |
-
cudatoolkit
|
3 |
|
4 |
# transformers==4.31.0
|
5 |
transformers # ==4.30.2
|
|
|
1 |
# https://www.zhihu.com/question/309583980
|
2 |
+
# cudatoolkit # this is for conda only
|
3 |
|
4 |
# transformers==4.31.0
|
5 |
transformers # ==4.30.2
|