NagisaNao commited on
Commit
a714fc0
·
verified ·
1 Parent(s): 14c3887

fixi - sagemaker

Browse files
files_cells/notebooks/en/downloading_en.ipynb CHANGED
@@ -163,8 +163,10 @@
163
  "\n",
164
  "# === ONLY SAGEMAKER FIXIN EXTENSIONS ===\n",
165
  "if env == \"SageMaker Studio Lab\":\n",
166
- " # --- SuperMerger ---\n",
167
- " !wget -O {webui_path}/extensions/supermerger/scripts/mergers/mergers.py https://huggingface.co/NagisaNao/fast_repo/resolve/main/sagemaker/fixing/extensions/supermerger/scripts/mergers/mergers.py\n",
 
 
168
  "\n",
169
  "\n",
170
  "## Changes extensions and WebUi\n",
 
163
  "\n",
164
  "# === ONLY SAGEMAKER FIXIN EXTENSIONS ===\n",
165
  "if env == \"SageMaker Studio Lab\":\n",
166
+ " with capture.capture_output() as cap:\n",
167
+ " # --- SuperMerger ---\n",
168
+ " !wget -O {webui_path}/extensions/supermerger/scripts/mergers/mergers.py https://huggingface.co/NagisaNao/fast_repo/resolve/main/sagemaker/fixing/extensions/supermerger/scripts/mergers/mergers.py\n",
169
+ " del cap\n",
170
  "\n",
171
  "\n",
172
  "## Changes extensions and WebUi\n",
files_cells/notebooks/en/launch_en.ipynb CHANGED
@@ -28,9 +28,9 @@
28
  "import time\n",
29
  "import json\n",
30
  "import requests\n",
31
- "import cloudpickle as pickle\n",
32
  "from datetime import timedelta\n",
33
  "\n",
 
34
  "# ================= DETECT ENV =================\n",
35
  "def detect_environment():\n",
36
  " environments = {\n",
@@ -62,6 +62,8 @@
62
  "\n",
63
  "# ======================== TUNNEL ========================\n",
64
  "if env != \"SageMaker Studio Lab\":\n",
 
 
65
  " password = \"x1101\"\n",
66
  " def get_public_ip(version='ipv4'):\n",
67
  " try:\n",
@@ -80,7 +82,6 @@
80
  " tunnel = tunnel_class(tunnel_port)\n",
81
  " tunnel.add_tunnel(command=\"cl tunnel --url localhost:{port}\", name=\"cl\", pattern=re.compile(r\"[\\w-]+\\.trycloudflare\\.com\"))\n",
82
  " tunnel.add_tunnel(command=\"lt --port {port}\", name=\"lt\", pattern=re.compile(r\"[\\w-]+\\.loca\\.lt\"), note=\"Password : \" + \"\\033[32m\" + public_ipv4 + \"\\033[0m\" + \" rerun cell if 404 error.\")\n",
83
- "\n",
84
  "# ======================== TUNNEL ========================\n",
85
  "\n",
86
  "\n",
@@ -93,33 +94,23 @@
93
  "\n",
94
  "if env != \"SageMaker Studio Lab\":\n",
95
  " with tunnel:\n",
96
- " !#python -m http.server 1101\n",
97
  " %cd {webui_path}\n",
98
- "\n",
99
  " if ngrok_token:\n",
100
  " commandline_arguments += ' --ngrok ' + ngrok_token\n",
101
- " commandline_arguments += f\" --port=1101 \" # --encrypt-pass={password}\n",
102
- "\n",
103
- " !COMMANDLINE_ARGS=\"{commandline_arguments}\" python launch.py\n",
104
- "\n",
105
- " start_colab = float(open(f'{webui_path}/static/colabTimer.txt', 'r').read())\n",
106
- " time_since_start = str(timedelta(seconds=time.time()-start_colab)).split('.')[0]\n",
107
- " print(f\"\\n⌚️ \\033[0mYou have been conducting this session for - \\033[33m{time_since_start}\\033[0m\\n\\n\")\n",
108
- "\n",
109
  "else:\n",
110
  " if ngrok_token:\n",
111
  " %cd {webui_path}\n",
112
- "\n",
113
  " commandline_arguments += ' --ngrok ' + ngrok_token\n",
114
- "\n",
115
- " !COMMANDLINE_ARGS=\"{commandline_arguments}\" python launch.py\n",
116
- "\n",
117
- " start_colab = float(open(f'{webui_path}/static/colabTimer.txt', 'r').read())\n",
118
- " time_since_start = str(timedelta(seconds=time.time()-start_colab)).split('.')[0]\n",
119
- " print(f\"\\n⌚️ \\033[0mYou have been conducting this session for - \\033[33m{time_since_start}\\033[0m\\n\\n\")\n",
120
- "\n",
121
  " else:\n",
122
- " print(\"Oops... I think you forgot to insert the token `ngrok`..... go back to widgets and insert it to start webui... no way without it :/\\nYou can get the token here:\\n\\nhttps://dashboard.ngrok.com/get-started/your-authtoken\")"
 
 
 
 
 
 
 
123
  ]
124
  }
125
  ]
 
28
  "import time\n",
29
  "import json\n",
30
  "import requests\n",
 
31
  "from datetime import timedelta\n",
32
  "\n",
33
+ "\n",
34
  "# ================= DETECT ENV =================\n",
35
  "def detect_environment():\n",
36
  " environments = {\n",
 
62
  "\n",
63
  "# ======================== TUNNEL ========================\n",
64
  "if env != \"SageMaker Studio Lab\":\n",
65
+ " import cloudpickle as pickle\n",
66
+ "\n",
67
  " password = \"x1101\"\n",
68
  " def get_public_ip(version='ipv4'):\n",
69
  " try:\n",
 
82
  " tunnel = tunnel_class(tunnel_port)\n",
83
  " tunnel.add_tunnel(command=\"cl tunnel --url localhost:{port}\", name=\"cl\", pattern=re.compile(r\"[\\w-]+\\.trycloudflare\\.com\"))\n",
84
  " tunnel.add_tunnel(command=\"lt --port {port}\", name=\"lt\", pattern=re.compile(r\"[\\w-]+\\.loca\\.lt\"), note=\"Password : \" + \"\\033[32m\" + public_ipv4 + \"\\033[0m\" + \" rerun cell if 404 error.\")\n",
 
85
  "# ======================== TUNNEL ========================\n",
86
  "\n",
87
  "\n",
 
94
  "\n",
95
  "if env != \"SageMaker Studio Lab\":\n",
96
  " with tunnel:\n",
 
97
  " %cd {webui_path}\n",
 
98
  " if ngrok_token:\n",
99
  " commandline_arguments += ' --ngrok ' + ngrok_token\n",
100
+ " commandline_arguments += f\" --port=1101 \" # --encrypt-pass={password}\n",
 
 
 
 
 
 
 
101
  "else:\n",
102
  " if ngrok_token:\n",
103
  " %cd {webui_path}\n",
 
104
  " commandline_arguments += ' --ngrok ' + ngrok_token\n",
 
 
 
 
 
 
 
105
  " else:\n",
106
+ " print(\"Oops... I think you forgot to insert the token `ngrok`..... go back to widgets and insert it to start webui... no way without it :/\\nYou can get the token here:\\n\\nhttps://dashboard.ngrok.com/get-started/your-authtoken\")\n",
107
+ "\n",
108
+ "# launch webui\n",
109
+ "if env != \"SageMaker Studio Lab\" or ngrok_token:\n",
110
+ " !COMMANDLINE_ARGS=\"{commandline_arguments}\" python launch.py\n",
111
+ " start_colab = float(open(f'{webui_path}/static/colabTimer.txt', 'r').read())\n",
112
+ " time_since_start = str(timedelta(seconds=time.time()-start_colab)).split('.')[0]\n",
113
+ " print(f\"\\n⌚️ \\033[0mYou have been conducting this session for - \\033[33m{time_since_start}\\033[0m\\n\\n\")"
114
  ]
115
  }
116
  ]
files_cells/notebooks/ru/downloading_ru.ipynb CHANGED
@@ -163,8 +163,10 @@
163
  "\n",
164
  "# === ONLY SAGEMAKER FIXIN EXTENSIONS ===\n",
165
  "if env == \"SageMaker Studio Lab\":\n",
166
- " # --- SuperMerger ---\n",
167
- " !wget -O {webui_path}/extensions/supermerger/scripts/mergers/mergers.py https://huggingface.co/NagisaNao/fast_repo/resolve/main/sagemaker/fixing/extensions/supermerger/scripts/mergers/mergers.py\n",
 
 
168
  "\n",
169
  "\n",
170
  "## Changes extensions and WebUi\n",
 
163
  "\n",
164
  "# === ONLY SAGEMAKER FIXIN EXTENSIONS ===\n",
165
  "if env == \"SageMaker Studio Lab\":\n",
166
+ " with capture.capture_output() as cap:\n",
167
+ " # --- SuperMerger ---\n",
168
+ " !wget -O {webui_path}/extensions/supermerger/scripts/mergers/mergers.py https://huggingface.co/NagisaNao/fast_repo/resolve/main/sagemaker/fixing/extensions/supermerger/scripts/mergers/mergers.py\n",
169
+ " del cap\n",
170
  "\n",
171
  "\n",
172
  "## Changes extensions and WebUi\n",
files_cells/notebooks/ru/launch_ru.ipynb CHANGED
@@ -28,9 +28,9 @@
28
  "import time\n",
29
  "import json\n",
30
  "import requests\n",
31
- "import cloudpickle as pickle\n",
32
  "from datetime import timedelta\n",
33
  "\n",
 
34
  "# ================= DETECT ENV =================\n",
35
  "def detect_environment():\n",
36
  " environments = {\n",
@@ -62,6 +62,8 @@
62
  "\n",
63
  "# ======================== TUNNEL ========================\n",
64
  "if env != \"SageMaker Studio Lab\":\n",
 
 
65
  " password = \"x1101\"\n",
66
  " def get_public_ip(version='ipv4'):\n",
67
  " try:\n",
@@ -80,7 +82,6 @@
80
  " tunnel = tunnel_class(tunnel_port)\n",
81
  " tunnel.add_tunnel(command=\"cl tunnel --url localhost:{port}\", name=\"cl\", pattern=re.compile(r\"[\\w-]+\\.trycloudflare\\.com\"))\n",
82
  " tunnel.add_tunnel(command=\"lt --port {port}\", name=\"lt\", pattern=re.compile(r\"[\\w-]+\\.loca\\.lt\"), note=\"Password : \" + \"\\033[32m\" + public_ipv4 + \"\\033[0m\" + \" rerun cell if 404 error.\")\n",
83
- "\n",
84
  "# ======================== TUNNEL ========================\n",
85
  "\n",
86
  "\n",
@@ -93,33 +94,23 @@
93
  "\n",
94
  "if env != \"SageMaker Studio Lab\":\n",
95
  " with tunnel:\n",
96
- " !#python -m http.server 1101\n",
97
  " %cd {webui_path}\n",
98
- "\n",
99
  " if ngrok_token:\n",
100
  " commandline_arguments += ' --ngrok ' + ngrok_token\n",
101
- " commandline_arguments += f\" --port=1101 \" # --encrypt-pass={password}\n",
102
- "\n",
103
- " !COMMANDLINE_ARGS=\"{commandline_arguments}\" python launch.py\n",
104
- "\n",
105
- " start_colab = float(open(f'{webui_path}/static/colabTimer.txt', 'r').read())\n",
106
- " time_since_start = str(timedelta(seconds=time.time()-start_colab)).split('.')[0]\n",
107
- " print(f\"\\n⌚️ \\033[0mВы проводите эту сессию в течение - \\033[33m{time_since_start}\\033[0m\\n\\n\")\n",
108
- "\n",
109
  "else:\n",
110
  " if ngrok_token:\n",
111
  " %cd {webui_path}\n",
112
- "\n",
113
  " commandline_arguments += ' --ngrok ' + ngrok_token\n",
114
- "\n",
115
- " !COMMANDLINE_ARGS=\"{commandline_arguments}\" python launch.py\n",
116
- "\n",
117
- " start_colab = float(open(f'{webui_path}/static/colabTimer.txt', 'r').read())\n",
118
- " time_since_start = str(timedelta(seconds=time.time()-start_colab)).split('.')[0]\n",
119
- " print(f\"\\n⌚️ \\033[0mВы проводите эту сессию в течение - \\033[33m{time_since_start}\\033[0m\\n\\n\")\n",
120
- "\n",
121
  " else:\n",
122
- " print(\"Упс... Я думаю, вы забыли вставить токен `ngrok`..... вернитесь к виджетам и вставьте его, чтобы запустить webui... без него никак :/\\nВы можете получить токен здесь:\\n\\nhttps://dashboard.ngrok.com/get-started/your-authtoken\")"
 
 
 
 
 
 
 
123
  ]
124
  }
125
  ]
 
28
  "import time\n",
29
  "import json\n",
30
  "import requests\n",
 
31
  "from datetime import timedelta\n",
32
  "\n",
33
+ "\n",
34
  "# ================= DETECT ENV =================\n",
35
  "def detect_environment():\n",
36
  " environments = {\n",
 
62
  "\n",
63
  "# ======================== TUNNEL ========================\n",
64
  "if env != \"SageMaker Studio Lab\":\n",
65
+ " import cloudpickle as pickle\n",
66
+ "\n",
67
  " password = \"x1101\"\n",
68
  " def get_public_ip(version='ipv4'):\n",
69
  " try:\n",
 
82
  " tunnel = tunnel_class(tunnel_port)\n",
83
  " tunnel.add_tunnel(command=\"cl tunnel --url localhost:{port}\", name=\"cl\", pattern=re.compile(r\"[\\w-]+\\.trycloudflare\\.com\"))\n",
84
  " tunnel.add_tunnel(command=\"lt --port {port}\", name=\"lt\", pattern=re.compile(r\"[\\w-]+\\.loca\\.lt\"), note=\"Password : \" + \"\\033[32m\" + public_ipv4 + \"\\033[0m\" + \" rerun cell if 404 error.\")\n",
 
85
  "# ======================== TUNNEL ========================\n",
86
  "\n",
87
  "\n",
 
94
  "\n",
95
  "if env != \"SageMaker Studio Lab\":\n",
96
  " with tunnel:\n",
 
97
  " %cd {webui_path}\n",
 
98
  " if ngrok_token:\n",
99
  " commandline_arguments += ' --ngrok ' + ngrok_token\n",
100
+ " commandline_arguments += f\" --port=1101 \" # --encrypt-pass={password}\n",
 
 
 
 
 
 
 
101
  "else:\n",
102
  " if ngrok_token:\n",
103
  " %cd {webui_path}\n",
 
104
  " commandline_arguments += ' --ngrok ' + ngrok_token\n",
 
 
 
 
 
 
 
105
  " else:\n",
106
+ " print(\"Упс... Я думаю, вы забыли вставить токен `ngrok`..... вернитесь к виджетам и вставьте его, чтобы запустить webui... без него никак :/\\nВы можете получить токен здесь:\\n\\nhttps://dashboard.ngrok.com/get-started/your-authtoken\")\n",
107
+ "\n",
108
+ "# launch webui\n",
109
+ "if env != \"SageMaker Studio Lab\" or ngrok_token:\n",
110
+ " !COMMANDLINE_ARGS=\"{commandline_arguments}\" python launch.py\n",
111
+ " start_colab = float(open(f'{webui_path}/static/colabTimer.txt', 'r').read())\n",
112
+ " time_since_start = str(timedelta(seconds=time.time()-start_colab)).split('.')[0]\n",
113
+ " print(f\"\\n⌚️ \\033[0mВы проводите эту сессию в течение - \\033[33m{time_since_start}\\033[0m\\n\\n\")"
114
  ]
115
  }
116
  ]
files_cells/python/en/downloading_en.py CHANGED
@@ -150,8 +150,10 @@ else:
150
 
151
  # === ONLY SAGEMAKER FIXIN EXTENSIONS ===
152
  if env == "SageMaker Studio Lab":
153
- # --- SuperMerger ---
154
- get_ipython().system('wget -O {webui_path}/extensions/supermerger/scripts/mergers/mergers.py https://huggingface.co/NagisaNao/fast_repo/resolve/main/sagemaker/fixing/extensions/supermerger/scripts/mergers/mergers.py')
 
 
155
 
156
 
157
  ## Changes extensions and WebUi
 
150
 
151
  # === ONLY SAGEMAKER FIXIN EXTENSIONS ===
152
  if env == "SageMaker Studio Lab":
153
+ with capture.capture_output() as cap:
154
+ # --- SuperMerger ---
155
+ get_ipython().system('wget -O {webui_path}/extensions/supermerger/scripts/mergers/mergers.py https://huggingface.co/NagisaNao/fast_repo/resolve/main/sagemaker/fixing/extensions/supermerger/scripts/mergers/mergers.py')
156
+ del cap
157
 
158
 
159
  ## Changes extensions and WebUi
files_cells/python/en/launch_en.py CHANGED
@@ -10,9 +10,9 @@ import sys
10
  import time
11
  import json
12
  import requests
13
- import cloudpickle as pickle
14
  from datetime import timedelta
15
 
 
16
  # ================= DETECT ENV =================
17
  def detect_environment():
18
  environments = {
@@ -44,6 +44,8 @@ commandline_arguments = settings['commandline_arguments']
44
 
45
  # ======================== TUNNEL ========================
46
  if env != "SageMaker Studio Lab":
 
 
47
  password = "x1101"
48
  def get_public_ip(version='ipv4'):
49
  try:
@@ -62,7 +64,6 @@ if env != "SageMaker Studio Lab":
62
  tunnel = tunnel_class(tunnel_port)
63
  tunnel.add_tunnel(command="cl tunnel --url localhost:{port}", name="cl", pattern=re.compile(r"[\w-]+\.trycloudflare\.com"))
64
  tunnel.add_tunnel(command="lt --port {port}", name="lt", pattern=re.compile(r"[\w-]+\.loca\.lt"), note="Password : " + "\033[32m" + public_ipv4 + "\033[0m" + " rerun cell if 404 error.")
65
-
66
  # ======================== TUNNEL ========================
67
 
68
 
@@ -75,31 +76,21 @@ get_ipython().system('sed -i \'s/"sd_checkpoint_hash": ".*"/"sd_checkpoint_hash"
75
 
76
  if env != "SageMaker Studio Lab":
77
  with tunnel:
78
- get_ipython().system('#python -m http.server 1101')
79
  get_ipython().run_line_magic('cd', '{webui_path}')
80
-
81
  if ngrok_token:
82
  commandline_arguments += ' --ngrok ' + ngrok_token
83
- commandline_arguments += f" --port=1101 " # --encrypt-pass={password}
84
-
85
- get_ipython().system('COMMANDLINE_ARGS="{commandline_arguments}" python launch.py')
86
-
87
- start_colab = float(open(f'{webui_path}/static/colabTimer.txt', 'r').read())
88
- time_since_start = str(timedelta(seconds=time.time()-start_colab)).split('.')[0]
89
- print(f"\n⌚️ \033[0mYou have been conducting this session for - \033[33m{time_since_start}\033[0m\n\n")
90
-
91
  else:
92
  if ngrok_token:
93
  get_ipython().run_line_magic('cd', '{webui_path}')
94
-
95
  commandline_arguments += ' --ngrok ' + ngrok_token
96
-
97
- get_ipython().system('COMMANDLINE_ARGS="{commandline_arguments}" python launch.py')
98
-
99
- start_colab = float(open(f'{webui_path}/static/colabTimer.txt', 'r').read())
100
- time_since_start = str(timedelta(seconds=time.time()-start_colab)).split('.')[0]
101
- print(f"\n⌚️ \033[0mYou have been conducting this session for - \033[33m{time_since_start}\033[0m\n\n")
102
-
103
  else:
104
  print("Oops... I think you forgot to insert the token `ngrok`..... go back to widgets and insert it to start webui... no way without it :/\nYou can get the token here:\n\nhttps://dashboard.ngrok.com/get-started/your-authtoken")
105
 
 
 
 
 
 
 
 
 
10
  import time
11
  import json
12
  import requests
 
13
  from datetime import timedelta
14
 
15
+
16
  # ================= DETECT ENV =================
17
  def detect_environment():
18
  environments = {
 
44
 
45
  # ======================== TUNNEL ========================
46
  if env != "SageMaker Studio Lab":
47
+ import cloudpickle as pickle
48
+
49
  password = "x1101"
50
  def get_public_ip(version='ipv4'):
51
  try:
 
64
  tunnel = tunnel_class(tunnel_port)
65
  tunnel.add_tunnel(command="cl tunnel --url localhost:{port}", name="cl", pattern=re.compile(r"[\w-]+\.trycloudflare\.com"))
66
  tunnel.add_tunnel(command="lt --port {port}", name="lt", pattern=re.compile(r"[\w-]+\.loca\.lt"), note="Password : " + "\033[32m" + public_ipv4 + "\033[0m" + " rerun cell if 404 error.")
 
67
  # ======================== TUNNEL ========================
68
 
69
 
 
76
 
77
  if env != "SageMaker Studio Lab":
78
  with tunnel:
 
79
  get_ipython().run_line_magic('cd', '{webui_path}')
 
80
  if ngrok_token:
81
  commandline_arguments += ' --ngrok ' + ngrok_token
82
+ commandline_arguments += f" --port=1101 " # --encrypt-pass={password}
 
 
 
 
 
 
 
83
  else:
84
  if ngrok_token:
85
  get_ipython().run_line_magic('cd', '{webui_path}')
 
86
  commandline_arguments += ' --ngrok ' + ngrok_token
 
 
 
 
 
 
 
87
  else:
88
  print("Oops... I think you forgot to insert the token `ngrok`..... go back to widgets and insert it to start webui... no way without it :/\nYou can get the token here:\n\nhttps://dashboard.ngrok.com/get-started/your-authtoken")
89
 
90
+ # launch webui
91
+ if env != "SageMaker Studio Lab" or ngrok_token:
92
+ get_ipython().system('COMMANDLINE_ARGS="{commandline_arguments}" python launch.py')
93
+ start_colab = float(open(f'{webui_path}/static/colabTimer.txt', 'r').read())
94
+ time_since_start = str(timedelta(seconds=time.time()-start_colab)).split('.')[0]
95
+ print(f"\n⌚️ \033[0mYou have been conducting this session for - \033[33m{time_since_start}\033[0m\n\n")
96
+
files_cells/python/ru/downloading_ru.py CHANGED
@@ -150,8 +150,10 @@ else:
150
 
151
  # === ONLY SAGEMAKER FIXIN EXTENSIONS ===
152
  if env == "SageMaker Studio Lab":
153
- # --- SuperMerger ---
154
- get_ipython().system('wget -O {webui_path}/extensions/supermerger/scripts/mergers/mergers.py https://huggingface.co/NagisaNao/fast_repo/resolve/main/sagemaker/fixing/extensions/supermerger/scripts/mergers/mergers.py')
 
 
155
 
156
 
157
  ## Changes extensions and WebUi
 
150
 
151
  # === ONLY SAGEMAKER FIXIN EXTENSIONS ===
152
  if env == "SageMaker Studio Lab":
153
+ with capture.capture_output() as cap:
154
+ # --- SuperMerger ---
155
+ get_ipython().system('wget -O {webui_path}/extensions/supermerger/scripts/mergers/mergers.py https://huggingface.co/NagisaNao/fast_repo/resolve/main/sagemaker/fixing/extensions/supermerger/scripts/mergers/mergers.py')
156
+ del cap
157
 
158
 
159
  ## Changes extensions and WebUi
files_cells/python/ru/launch_ru.py CHANGED
@@ -10,9 +10,9 @@ import sys
10
  import time
11
  import json
12
  import requests
13
- import cloudpickle as pickle
14
  from datetime import timedelta
15
 
 
16
  # ================= DETECT ENV =================
17
  def detect_environment():
18
  environments = {
@@ -44,6 +44,8 @@ commandline_arguments = settings['commandline_arguments']
44
 
45
  # ======================== TUNNEL ========================
46
  if env != "SageMaker Studio Lab":
 
 
47
  password = "x1101"
48
  def get_public_ip(version='ipv4'):
49
  try:
@@ -62,7 +64,6 @@ if env != "SageMaker Studio Lab":
62
  tunnel = tunnel_class(tunnel_port)
63
  tunnel.add_tunnel(command="cl tunnel --url localhost:{port}", name="cl", pattern=re.compile(r"[\w-]+\.trycloudflare\.com"))
64
  tunnel.add_tunnel(command="lt --port {port}", name="lt", pattern=re.compile(r"[\w-]+\.loca\.lt"), note="Password : " + "\033[32m" + public_ipv4 + "\033[0m" + " rerun cell if 404 error.")
65
-
66
  # ======================== TUNNEL ========================
67
 
68
 
@@ -75,31 +76,21 @@ get_ipython().system('sed -i \'s/"sd_checkpoint_hash": ".*"/"sd_checkpoint_hash"
75
 
76
  if env != "SageMaker Studio Lab":
77
  with tunnel:
78
- get_ipython().system('#python -m http.server 1101')
79
  get_ipython().run_line_magic('cd', '{webui_path}')
80
-
81
  if ngrok_token:
82
  commandline_arguments += ' --ngrok ' + ngrok_token
83
- commandline_arguments += f" --port=1101 " # --encrypt-pass={password}
84
-
85
- get_ipython().system('COMMANDLINE_ARGS="{commandline_arguments}" python launch.py')
86
-
87
- start_colab = float(open(f'{webui_path}/static/colabTimer.txt', 'r').read())
88
- time_since_start = str(timedelta(seconds=time.time()-start_colab)).split('.')[0]
89
- print(f"\n⌚️ \033[0mВы проводите эту сессию в течение - \033[33m{time_since_start}\033[0m\n\n")
90
-
91
  else:
92
  if ngrok_token:
93
  get_ipython().run_line_magic('cd', '{webui_path}')
94
-
95
  commandline_arguments += ' --ngrok ' + ngrok_token
96
-
97
- get_ipython().system('COMMANDLINE_ARGS="{commandline_arguments}" python launch.py')
98
-
99
- start_colab = float(open(f'{webui_path}/static/colabTimer.txt', 'r').read())
100
- time_since_start = str(timedelta(seconds=time.time()-start_colab)).split('.')[0]
101
- print(f"\n⌚️ \033[0mВы проводите эту сессию в течение - \033[33m{time_since_start}\033[0m\n\n")
102
-
103
  else:
104
  print("Упс... Я думаю, вы забыли вставить токен `ngrok`..... вернитесь к виджетам и вставьте его, чтобы запустить webui... без него никак :/\nВы можете получить токен здесь:\n\nhttps://dashboard.ngrok.com/get-started/your-authtoken")
105
 
 
 
 
 
 
 
 
 
10
  import time
11
  import json
12
  import requests
 
13
  from datetime import timedelta
14
 
15
+
16
  # ================= DETECT ENV =================
17
  def detect_environment():
18
  environments = {
 
44
 
45
  # ======================== TUNNEL ========================
46
  if env != "SageMaker Studio Lab":
47
+ import cloudpickle as pickle
48
+
49
  password = "x1101"
50
  def get_public_ip(version='ipv4'):
51
  try:
 
64
  tunnel = tunnel_class(tunnel_port)
65
  tunnel.add_tunnel(command="cl tunnel --url localhost:{port}", name="cl", pattern=re.compile(r"[\w-]+\.trycloudflare\.com"))
66
  tunnel.add_tunnel(command="lt --port {port}", name="lt", pattern=re.compile(r"[\w-]+\.loca\.lt"), note="Password : " + "\033[32m" + public_ipv4 + "\033[0m" + " rerun cell if 404 error.")
 
67
  # ======================== TUNNEL ========================
68
 
69
 
 
76
 
77
  if env != "SageMaker Studio Lab":
78
  with tunnel:
 
79
  get_ipython().run_line_magic('cd', '{webui_path}')
 
80
  if ngrok_token:
81
  commandline_arguments += ' --ngrok ' + ngrok_token
82
+ commandline_arguments += f" --port=1101 " # --encrypt-pass={password}
 
 
 
 
 
 
 
83
  else:
84
  if ngrok_token:
85
  get_ipython().run_line_magic('cd', '{webui_path}')
 
86
  commandline_arguments += ' --ngrok ' + ngrok_token
 
 
 
 
 
 
 
87
  else:
88
  print("Упс... Я думаю, вы забыли вставить токен `ngrok`..... вернитесь к виджетам и вставьте его, чтобы запустить webui... без него никак :/\nВы можете получить токен здесь:\n\nhttps://dashboard.ngrok.com/get-started/your-authtoken")
89
 
90
+ # launch webui
91
+ if env != "SageMaker Studio Lab" or ngrok_token:
92
+ get_ipython().system('COMMANDLINE_ARGS="{commandline_arguments}" python launch.py')
93
+ start_colab = float(open(f'{webui_path}/static/colabTimer.txt', 'r').read())
94
+ time_since_start = str(timedelta(seconds=time.time()-start_colab)).split('.')[0]
95
+ print(f"\n⌚️ \033[0mВы проводите эту сессию в течение - \033[33m{time_since_start}\033[0m\n\n")
96
+