Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 4 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
@@ -1,2 +1,5 @@
__pycache__
*~
*~

# PyCharm folders
/.idea
1 change: 1 addition & 0 deletions diaparser/cmds/biaffine_dependency.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ def main():
subparser.add_argument('--punct', action='store_true', help='whether to include punctuation')
subparser.add_argument('--max-len', type=int, help='max length of the sentences')
subparser.add_argument('--buckets', default=32, type=int, help='max num of buckets to use')
subparser.add_argument("--epochs", default=5000, type=int, help="Number of epochs to be run during training.")
subparser.add_argument('--train', required=True, help='path to train file')
subparser.add_argument('--dev', required=True, help='path to dev file')
subparser.add_argument('--test', help='path to test file')
Expand Down
6 changes: 4 additions & 2 deletions diaparser/modules/lstm.py
Original file line number Diff line number Diff line change
Expand Up @@ -83,8 +83,10 @@ def reset_parameters(self):
def permute_hidden(self, hx, permutation):
if permutation is None:
return hx
h = apply_permutation(hx[0], permutation)
c = apply_permutation(hx[1], permutation)
"""h = apply_permutation(hx[0], permutation)
c = apply_permutation(hx[1], permutation)"""
h = hx[0].index_select(1, permutation)
c = hx[1].index_select(1, permutation)

return h, c

Expand Down
2 changes: 1 addition & 1 deletion diaparser/parsers/biaffine_dependency.py
Original file line number Diff line number Diff line change
Expand Up @@ -243,7 +243,7 @@ def build(cls, path, min_freq=2, fix_len=20, **kwargs):
elif args.feat == 'bert':
tokenizer = BertField.tokenizer(args.bert)

args.max_len = min(args.max_len or tokenizer.max_len, tokenizer.max_len)
args.max_len = min(args.max_len or tokenizer.model_max_length, tokenizer.model_max_length)
FEAT = BertField('bert', tokenizer, fix_len=args.fix_len)
WORD.bos = FEAT.bos # ensure representations have the same length
else:
Expand Down
2 changes: 1 addition & 1 deletion diaparser/parsers/parser.py
Original file line number Diff line number Diff line change
Expand Up @@ -248,7 +248,7 @@ def load(cls, name_or_path='', lang='en', cache_dir=os.path.expanduser('~/.cache
args.device = 'cuda' if torch.cuda.is_available() else 'cpu'

if os.path.exists(name_or_path):
state = torch.load(name_or_path)
state = torch.load(name_or_path, weights_only=False)
else:
url = select(name=name_or_path, lang=lang, **kwargs)
if url is None:
Expand Down