How to use the tuna.runners.Runner function in tuna

To help you get started, we’ve selected a few tuna examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github ChristophAlt / tuna / tuna / runners / allennlp_runner.py View on Github external
import logging
import _jsonnet
import json

from datetime import datetime
from allennlp.common.params import Params, parse_overrides, with_fallback
from allennlp.commands.train import train_model
from allennlp.common.util import import_submodules
from tuna.runners import Runner

from typing import Optional

logger = logging.getLogger(__name__)  # pylint: disable=invalid-name


class AllenNlpRunner(Runner):
    name = "AllenNLP"

    def get_argument_parser(self) -> Optional[argparse.ArgumentParser]:
        parser = argparse.ArgumentParser()

        parser.add_argument(
            "--parameter-file",
            required=True,
            type=os.path.abspath,
            help="path to parameter file describing the model to be trained",
        )
        parser.add_argument(
            "--include-package",
            type=str,
            action="append",
            default=[],