예제 #1
0
def main():
    ensure_pythonhashseed_set()
    if len(sys.argv) != 2:
        print('USAGE: server.py [config_file]')
        sys.exit(-1)
    config_file = sys.argv[1]
    serve(config_file)
예제 #2
0
파일: server.py 프로젝트: alvinhom/deep_qa
def main():
    ensure_pythonhashseed_set()
    if len(sys.argv) != 3:
        print('USAGE: server.py [port] [config_file]')
        print('RECEIVED: ' + ' '.join(sys.argv))
        sys.exit(-1)
    port = int(sys.argv[1])
    config_file = sys.argv[2]
    serve(port, config_file)
예제 #3
0
def main():
    ensure_pythonhashseed_set()
    if len(sys.argv) != 3:
        print('USAGE: neighbor_search_api.py [port] [config_file]')
        print('RECEIVED: ' + ' '.join(sys.argv))
        sys.exit(-1)
    port = int(sys.argv[1])
    config_file = sys.argv[2]
    logging.basicConfig(
        format='%(asctime)s - %(levelname)s - %(name)s - %(message)s',
        level=logging.INFO)
    serve(port, config_file)
예제 #4
0
    model_type = get_choice(params, 'model_class', concrete_models.keys())
    model_class = concrete_models[model_type]
    model = model_class(params)

    if model.can_train():
        logger.info("Training model")
        model.train()
    else:
        logger.info(
            "Not enough training inputs.  Assuming you wanted to load a model instead."
        )
        # TODO(matt): figure out a way to specify which epoch you want to load a model from.
        model.load_model()


def replace_none(dictionary):
    for key in dictionary.keys():
        if dictionary[key] == "None":
            dictionary[key] = None
        elif isinstance(dictionary[key], pyhocon.config_tree.ConfigTree):
            dictionary[key] = replace_none(dictionary[key])
    return dictionary


if __name__ == "__main__":
    ensure_pythonhashseed_set()
    logging.basicConfig(
        format='%(asctime)s - %(levelname)s - %(name)s - %(message)s',
        level=logging.INFO)
    main()
예제 #5
0
def test_pythonhashseed():
    ensure_pythonhashseed_set()