Skip to content

Commit

Permalink
fix failure in mlstm introduced by #17
Browse files Browse the repository at this point in the history
And add a smoke test for graph-based to avoid this in the future
  • Loading branch information
LoicGrobol committed Mar 26, 2020
1 parent 9c6a7e9 commit bd24cb7
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 7 deletions.
5 changes: 3 additions & 2 deletions tox.ini
Original file line number Diff line number Diff line change
@@ -1,8 +1,9 @@
[tox]
minversion = 3.4.0
envlist = py38
envlist = py38, py37

[testenv]
deps = cython
commands =
uuparser --dynet-seed 123456789 --outdir {envtmpdir}/smoketestoutput --trainfile test/fixtures/truncated-sv_talbanken-ud-dev.conllu --devfile test/fixtures/truncated-sv_talbanken-ud-dev.conllu --testfile test/fixtures/truncated-sv_talbanken-ud-dev.conllu
uuparser --dynet-seed 123456789 --epochs 3 --outdir {envtmpdir}/transition-smoketest-output --trainfile test/fixtures/truncated-sv_talbanken-ud-dev.conllu --devfile test/fixtures/truncated-sv_talbanken-ud-dev.conllu --testfile test/fixtures/truncated-sv_talbanken-ud-dev.conllu
uuparser --dynet-seed 123456789 --epochs 3 --graph-based --outdir {envtmpdir}/graph-smoketest-output --trainfile test/fixtures/truncated-sv_talbanken-ud-dev.conllu --devfile test/fixtures/truncated-sv_talbanken-ud-dev.conllu --testfile test/fixtures/truncated-sv_talbanken-ud-dev.conllu
12 changes: 7 additions & 5 deletions uuparser/mstlstm.py
Original file line number Diff line number Diff line change
@@ -1,17 +1,19 @@
from operator import itemgetter
import time, random, decoder
from chuliu_edmonds import chuliu_edmonds_one_root
import time, random
import numpy as np
from multilayer_perceptron import biMLP
from collections import defaultdict
from copy import deepcopy

from uuparser import utils
from loguru import logger

from uuparser import utils, decoder
from uuparser.chuliu_edmonds import chuliu_edmonds_one_root
from uuparser.multilayer_perceptron import biMLP

class MSTParserLSTM:
def __init__(self, vocab, options):
import dynet as dy
from feature_extractor import FeatureExtractor
from uuparser.feature_extractor import FeatureExtractor
global dy
self.model = dy.ParameterCollection()
self.trainer = dy.AdamTrainer(self.model, alpha=options.learning_rate)
Expand Down

0 comments on commit bd24cb7

Please sign in to comment.