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
graykode
2020-09-08 15:18:19 +0900
Browse Files
Options
Browse Files
Download
Email Patches
Plain Diff
Commit
60fef8a7cfd6096d1767530fa71d42481813bbee
60fef8a7
1 parent
ab8c5e08
(refactor) argument renaming, add region, do_train and do_predict arguments
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
16 additions
and
5 deletions
gitcommit.py
gitcommit.py
View file @
60fef8a
...
...
@@ -139,9 +139,10 @@ def start(chunked_sha_msgs, train=True):
max_target_length
=
args
.
max_target_length
if
train
else
args
.
val_max_target_length
data_config
=
DataConfig
(
endpoint
=
args
.
matorage_dir
,
endpoint
=
args
.
endpoint
,
access_key
=
os
.
environ
[
'access_key'
],
secret_key
=
os
.
environ
[
'secret_key'
],
region
=
args
.
region
,
dataset_name
=
'commit-autosuggestions'
,
additional
=
{
"mode"
:
(
"training"
if
train
else
"evaluation"
),
...
...
@@ -175,8 +176,10 @@ def main(args):
]
barrier
=
int
(
len
(
chunked_sha_msgs
)
*
(
1
-
args
.
p_val
))
start
(
chunked_sha_msgs
[:
barrier
],
train
=
True
)
start
(
chunked_sha_msgs
[
barrier
:],
train
=
False
)
if
args
.
do_train
:
start
(
chunked_sha_msgs
[:
barrier
],
train
=
True
)
if
args
.
do_predict
:
start
(
chunked_sha_msgs
[
barrier
:],
train
=
False
)
if
__name__
==
"__main__"
:
parser
=
argparse
.
ArgumentParser
(
description
=
"Code to collect commits on github"
)
...
...
@@ -187,10 +190,16 @@ if __name__ == "__main__":
help
=
"github url"
)
parser
.
add_argument
(
"--
matorage_dir
"
,
"--
endpoint
"
,
type
=
str
,
required
=
True
,
help
=
'matorage saved directory.'
help
=
'matorage endpoint, check document of matorage: https://matorage.readthedocs.io/en/stable/storage.html'
)
parser
.
add_argument
(
"--region"
,
type
=
str
,
default
=
None
,
help
=
'matorage s3 region, check document of matorage: https://matorage.readthedocs.io/en/stable/storage.html'
)
parser
.
add_argument
(
"--matorage_batch"
,
...
...
@@ -226,6 +235,8 @@ if __name__ == "__main__":
"than this will be truncated, sequences shorter will be padded."
,
)
parser
.
add_argument
(
"--p_val"
,
type
=
float
,
default
=
0.25
,
help
=
"percent of validation dataset"
)
parser
.
add_argument
(
"--do_train"
,
action
=
"store_true"
,
default
=
False
)
parser
.
add_argument
(
"--do_predict"
,
action
=
"store_true"
,
default
=
False
)
args
=
parser
.
parse_args
()
args
.
local_path
=
args
.
url
.
split
(
'/'
)[
-
1
]
...
...
Please
register
or
login
to post a comment