Spaces:
Runtime error
Runtime error
gchhablani
commited on
Commit
β’
c399665
1
Parent(s):
86b65e9
Add kill script and port to TensorBoard
Browse files- apps/article.py +4 -3
- apps/streamlit_tensorboard.py +18 -2
apps/article.py
CHANGED
@@ -1,8 +1,9 @@
|
|
1 |
import streamlit as st
|
2 |
from apps.utils import read_markdown
|
3 |
-
from .streamlit_tensorboard import st_tensorboard
|
4 |
from .utils import Toc
|
5 |
def app(state=None):
|
|
|
6 |
toc = Toc()
|
7 |
st.info("Welcome to our Multilingual-VQA demo. Please use the navigation sidebar to move to our demo, or scroll below to read all about our project. π€ In case the sidebar isn't properly rendered, please change to a smaller window size and back to full screen.")
|
8 |
|
@@ -29,7 +30,7 @@ def app(state=None):
|
|
29 |
st.write(read_markdown("pretraining/model.md"))
|
30 |
toc.subsubheader("MLM Training Logs")
|
31 |
st.info("In case the TensorBoard logs are not displayed, please visit this link: https://huggingface.co/flax-community/multilingual-vqa-pt-ckpts/tensorboard")
|
32 |
-
st_tensorboard(logdir='./logs/pretrain_logs')
|
33 |
|
34 |
|
35 |
toc.subheader("Finetuning")
|
@@ -39,7 +40,7 @@ def app(state=None):
|
|
39 |
st.write(read_markdown("finetuning/model.md"))
|
40 |
toc.subsubheader("VQA Training Logs")
|
41 |
st.info("In case the TensorBoard logs are not displayed, please visit this link: https://huggingface.co/flax-community/multilingual-vqa-pt-60k-ft/tensorboard")
|
42 |
-
st_tensorboard(logdir='./logs/finetune_logs')
|
43 |
|
44 |
toc.header("Challenges and Technical Difficulties")
|
45 |
st.write(read_markdown("challenges.md"))
|
|
|
1 |
import streamlit as st
|
2 |
from apps.utils import read_markdown
|
3 |
+
from .streamlit_tensorboard import st_tensorboard, kill_tensorboard
|
4 |
from .utils import Toc
|
5 |
def app(state=None):
|
6 |
+
kill_tensorboard()
|
7 |
toc = Toc()
|
8 |
st.info("Welcome to our Multilingual-VQA demo. Please use the navigation sidebar to move to our demo, or scroll below to read all about our project. π€ In case the sidebar isn't properly rendered, please change to a smaller window size and back to full screen.")
|
9 |
|
|
|
30 |
st.write(read_markdown("pretraining/model.md"))
|
31 |
toc.subsubheader("MLM Training Logs")
|
32 |
st.info("In case the TensorBoard logs are not displayed, please visit this link: https://huggingface.co/flax-community/multilingual-vqa-pt-ckpts/tensorboard")
|
33 |
+
st_tensorboard(logdir='./logs/pretrain_logs', port=6006)
|
34 |
|
35 |
|
36 |
toc.subheader("Finetuning")
|
|
|
40 |
st.write(read_markdown("finetuning/model.md"))
|
41 |
toc.subsubheader("VQA Training Logs")
|
42 |
st.info("In case the TensorBoard logs are not displayed, please visit this link: https://huggingface.co/flax-community/multilingual-vqa-pt-60k-ft/tensorboard")
|
43 |
+
st_tensorboard(logdir='./logs/finetune_logs', port=6007)
|
44 |
|
45 |
toc.header("Challenges and Technical Difficulties")
|
46 |
st.write(read_markdown("challenges.md"))
|
apps/streamlit_tensorboard.py
CHANGED
@@ -6,8 +6,24 @@ import shlex
|
|
6 |
import random
|
7 |
import html
|
8 |
import json
|
|
|
9 |
|
10 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
11 |
def st_tensorboard(logdir="/logs/", port=6006, width=None, height=800, scrolling=True):
|
12 |
"""Embed Tensorboard within a Streamlit app
|
13 |
Parameters
|
@@ -52,8 +68,8 @@ def st_tensorboard(logdir="/logs/", port=6006, width=None, height=800, scrolling
|
|
52 |
</script>
|
53 |
"""
|
54 |
|
55 |
-
|
56 |
-
args_string = f"--logdir {logdir}"
|
57 |
parsed_args = shlex.split(args_string, comments=True, posix=True)
|
58 |
start_result = manager.start(parsed_args)
|
59 |
|
|
|
6 |
import random
|
7 |
import html
|
8 |
import json
|
9 |
+
import os, signal
|
10 |
|
11 |
|
12 |
+
def kill_tensorboard():
|
13 |
+
try:
|
14 |
+
|
15 |
+
# iterating through each instance of the process
|
16 |
+
for line in os.popen("ps ax | grep " + "tensorboard" + " | grep -v grep"):
|
17 |
+
fields = line.split()
|
18 |
+
|
19 |
+
# extracting Process ID from the output
|
20 |
+
pid = fields[0]
|
21 |
+
|
22 |
+
# terminating process
|
23 |
+
os.kill(int(pid), signal.SIGKILL)
|
24 |
+
except:
|
25 |
+
print("Error Encountered while running kill script")
|
26 |
+
|
27 |
def st_tensorboard(logdir="/logs/", port=6006, width=None, height=800, scrolling=True):
|
28 |
"""Embed Tensorboard within a Streamlit app
|
29 |
Parameters
|
|
|
68 |
</script>
|
69 |
"""
|
70 |
|
71 |
+
args_string = f"--logdir {logdir} --port {port}"
|
72 |
+
#args_string = f"--logdir {logdir} --host localhost"
|
73 |
parsed_args = shlex.split(args_string, comments=True, posix=True)
|
74 |
start_result = manager.start(parsed_args)
|
75 |
|