Toggle navigation
Toggle navigation
This project
Loading...
Sign in
graykode
/
commit-autosuggestions
Go to a project
Toggle navigation
Toggle navigation pinning
Projects
Groups
Snippets
Help
Project
Activity
Repository
Pipelines
Graphs
Issues
0
Merge Requests
0
Wiki
Snippets
Network
Create a new issue
Builds
Commits
Issue Boards
Authored by
Seonglae Cho
2020-12-01 23:48:08 +0900
Browse Files
Options
Browse Files
Download
Plain Diff
Committed by
GitHub
2020-12-01 23:48:08 +0900
Commit
cde42862aedb64143bb770102d7fd6633a3bba3f
cde42862
2 parents
d390cfa0
83b9a86a
Merge pull request #2 from seongland/master
Resolve Colab Nodebook Issue
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
55 additions
and
1 deletions
commit_autosuggestions.ipynb
commit_autosuggestions.ipynb
View file @
cde4286
...
...
@@ -77,6 +77,8 @@
"DIFF_MODEL='1--gcVVix92_Fp75A-mWH0pJS0ahlni5m'
\n
"
,
"
\n
"
,
"!pip install gdown
\\\n
"
,
" && mkdir -p weight/added
\\\n
"
,
" && mkdir -p weight/diff
\\\n
"
,
" && gdown
\"
https://drive.google.com/uc?id=$ADD_MODEL
\"
-O weight/added/pytorch_model.bin
\\\n
"
,
" && gdown
\"
https://drive.google.com/uc?id=$DIFF_MODEL
\"
-O weight/diff/pytorch_model.bin"
],
...
...
@@ -185,8 +187,60 @@
"with open('ngrok.conf', 'w') as f:
\n
"
,
" f.write(config)"
],
"execution_count"
:
1
,
"outputs"
:
[
{
"output_type"
:
"error"
,
"ename"
:
"NameError"
,
"evalue"
:
"name 'authtoken' is not defined"
,
"traceback"
:
[
"
\u
001b[1;31m---------------------------------------------------------------------------
\u
001b[0m"
,
"
\u
001b[1;31mNameError
\u
001b[0m Traceback (most recent call last)"
,
"
\u
001b[1;32m<ipython-input-1-7305b3f78ded>
\u
001b[0m in
\u
001b[0;36m<module>
\u
001b[1;34m
\u
001b[0m
\n\u
001b[0;32m 1
\u
001b[0m
\u
001b[0mconfig
\u
001b[0m
\u
001b[1;33m=
\u
001b[0m
\u
001b[0;31m
\\\u
001b[0m
\u
001b[1;33m
\u
001b[0m
\u
001b[1;33m
\u
001b[0m
\u
001b[0m
\n\u
001b[0;32m 2
\u
001b[0m f
\"\"\"\n\u
001b[1;32m----> 3
\u
001b[1;33m
\u
001b[0mauthtoken
\u
001b[0m
\u
001b[1;33m:
\u
001b[0m
\u
001b[1;33m{
\u
001b[0m
\u
001b[0mauthtoken
\u
001b[0m
\u
001b[1;33m}
\u
001b[0m
\u
001b[1;33m
\u
001b[0m
\u
001b[1;33m
\u
001b[0m
\u
001b[0m
\n\u
001b[0m
\u
001b[0;32m 4
\u
001b[0m
\u
001b[0mregion
\u
001b[0m
\u
001b[1;33m:
\u
001b[0m
\u
001b[1;33m{
\u
001b[0m
\u
001b[0mregion
\u
001b[0m
\u
001b[1;33m}
\u
001b[0m
\u
001b[1;33m
\u
001b[0m
\u
001b[1;33m
\u
001b[0m
\u
001b[0m
\n\u
001b[0;32m 5
\u
001b[0m
\u
001b[0mconsole_ui
\u
001b[0m
\u
001b[1;33m:
\u
001b[0m
\u
001b[1;32mFalse
\u
001b[0m
\u
001b[1;33m
\u
001b[0m
\u
001b[1;33m
\u
001b[0m
\u
001b[0m
\n
"
,
"
\u
001b[1;31mNameError
\u
001b[0m: name 'authtoken' is not defined"
]
}
]
},
{
"cell_type"
:
"code"
,
"execution_count"
:
null
,
"outputs"
:
[]
"metadata"
:
{},
"outputs"
:
[],
"source"
:
[
"from subprocess import Popen, PIPE
\n
"
,
"import shlex
\n
"
,
"import json
\n
"
,
"import time
\n
"
,
"
\n
"
,
"
\n
"
,
"def run_with_pipe(command):
\n
"
,
" commands = list(map(shlex.split,command.split(
\"
|
\"
)))
\n
"
,
" ps = Popen(commands[0], stdout=PIPE, stderr=PIPE)
\n
"
,
" for command in commands[1:]:
\n
"
,
" ps = Popen(command, stdin=ps.stdout, stdout=PIPE, stderr=PIPE)
\n
"
,
" return ps.stdout.readlines()
\n
"
,
"
\n
"
,
"
\n
"
,
"def get_tunnel_adresses():
\n
"
,
" info = run_with_pipe(
\"
curl http://localhost:4040/api/tunnels
\"
)
\n
"
,
" assert info
\n
"
,
"
\n
"
,
" info = json.loads(info[0])
\n
"
,
" for tunnel in info['tunnels']:
\n
"
,
" url = tunnel['public_url']
\n
"
,
" port = url.split(':')[-1]
\n
"
,
" local_port = tunnel['config']['addr'].split(':')[-1]
\n
"
,
" print(f'{url} -> {local_port} [{tunnel[
\"
name
\"
]}]')
\n
"
,
" if tunnel['name'] == 'input':
\n
"
,
" in_addr = url
\n
"
,
" elif tunnel['name'] == 'output':
\n
"
,
" out_addr = url
\n
"
,
" else:
\n
"
,
" print(f'unknown tunnel: {tunnel[
\"
name
\"
]}')
\n
"
,
"
\n
"
,
" return in_addr, out_addr"
]
},
{
"cell_type"
:
"code"
,
...
...
Please
register
or
login
to post a comment