diff --git a/joeynmt-server-on-cluster.sh b/joeynmt-server-on-cluster.sh index a00aa67202608b5398bba1eaa78317f730d012c0..fc6ad8320a0b59fb26fed48e0511ca11c0acdff2 100755 --- a/joeynmt-server-on-cluster.sh +++ b/joeynmt-server-on-cluster.sh @@ -1,7 +1,7 @@ #!/usr/bin/env bash #SBATCH --job-name=joeynmt-server -#SBATCH --partition=compute -#SBATCH --nodelist=node40 +#SBATCH --partition=students +#SBATCH --gres=gpu:1 #SBATCH --nodes=1 #SBATCH --mem=5GB #SBATCH --time=3-00:00:00 @@ -14,6 +14,7 @@ CLUSTER_MAIN_NODE=node00 export FLASK_APP=joeynmt_server.fullapp:app export FLASK_ENV=development export FLASK_DEBUG=true +export JOEYNMT_SERVER_REPO="$HOME/ma/joeynmt-server" export ASSETS="$JOEYNMT_SERVER_REPO/dev-assets" if [ -z "$CONDA_DEFAULT_ENV" ]; then diff --git a/joeynmt_server/config/development.py b/joeynmt_server/config/development.py index f28e6621933dac7dbfc487fab2c63080d992879a..1bff0b0bd0e765ae6e2e5cbfdf5d6ba8bda87f72 100644 --- a/joeynmt_server/config/development.py +++ b/joeynmt_server/config/development.py @@ -18,7 +18,7 @@ SQLALCHEMY_DATABASE_URI = 'sqlite:///{}'.format( with open(ASSETS_DIR / 'secret_key.txt') as f: SECRET_KEY = f.read().strip() -TRAIN_AFTER_FEEDBACK = False +TRAIN_AFTER_FEEDBACK = True logging.config.dictConfig({ 'version': 1, @@ -39,7 +39,7 @@ logging.config.dictConfig({ }, }, 'root': { - 'level': 'DEBUG', + 'level': 'INFO', 'handlers': ['stdout', 'logfile'] } }) diff --git a/joeynmt_server/trainer.py b/joeynmt_server/trainer.py index da613b1ac2ee5aeedc6cf91d1485679bd583e8f1..e6da1e9c806db8f3e44938522340cc54808d7296 100644 --- a/joeynmt_server/trainer.py +++ b/joeynmt_server/trainer.py @@ -235,14 +235,14 @@ def validate(config_basename, dataset_name='dev'): logging.error(msg) raise ValueError(msg) - logging.info('Validating on dev set.') + logging.info('Validating on dataset {}.'.format(dataset_name) results = model.validate(dev_set) accuracy = results['score'] / 100 total = len(dev_set) correct = round(accuracy * total) logging.info('Got validation result: {}/{} = {}.' .format(correct, total, accuracy)) - evr = EvaluationResult(label='file_dev', correct=correct, + evr = EvaluationResult(label=dataset_name, correct=correct, total=total) db.session.add(evr) db.session.commit() diff --git a/simulate_training.py b/simulate_training.py index e95785a01c88a680a6f9f32a85f1831845ee073b..e220aad3f035f7ba1aa2020b01b47b682aeb0679 100644 --- a/simulate_training.py +++ b/simulate_training.py @@ -13,10 +13,15 @@ Instance = namedtuple('Instance', ('nl', 'lin')) NLMAPS_MT_BASE_URL = 'http://localhost:5050' +logging.basicConfig( + format='[%(asctime)s] %(levelname)s in %(module)s: %(message)s', + level=logging.INFO +) + def find_and_read_file(dataset_dir, basenames, split, suffix): end = '{}.{}'.format(split, suffix) - suitable_basenames = [name.endswith(end) for name in basenames] + suitable_basenames = [name for name in basenames if name.endswith(end)] if len(suitable_basenames) == 0: logging.warning('Found no file matching *{}'.format(end)) return [] @@ -63,7 +68,9 @@ class NLMapsMT: def _make_url(self, path): parsed = urllib.parse.ParseResult( - scheme=self.scheme, netloc=self.netloc, path=path) + scheme=self.scheme, netloc=self.netloc, path=path, + params=None, query=None, fragment=None + ) return parsed.geturl() def save_feedback(self, instance: Instance, split):