(task_name, model_cls, checkpoint=-1)
Run inference interactively
    Parameters:
        task_name: Name of the task as provided during training
        model_cls: Model class name. Must be same as used during training
        checkpoint: Checkpoint number (train iteration) to load from. -1 for
                    best/latest checkpoint
Run inference interactively
    Parameters:
        task_name: Name of the task as provided during training
        model_cls: Model class name. Must be same as used during training
        checkpoint: Checkpoint number (train iteration) to load from. -1 for
                    best/latest checkpoint
Run inference interactively Parameters : task_name : Name of the task as provided during training model_cls : Model class name . Must be same as used during training checkpoint : Checkpoint number ( train iteration ) to load from . - 1 for best / latest checkpoint
def interactive(task_name, model_cls, checkpoint=-1):
    """
    Run inference interactively
    Parameters:
        task_name: Name of the task as provided during training
        model_cls: Model class name. Must be same as used during training
        checkpoint: Checkpoint number (train iteration) to load from. -1 for
                    best/latest checkpoint
    """
    model, hparams = model_cls.load(task_name, checkpoint)

    vocab_word, vocab_char, _ = model.vocabs
    input_fn = get_input_processor_words(vocab_word, vocab_char)

    print('Ctrl+C to quit')
    try:
        while True:
            inputs = input('> ')
            batch = input_fn(inputs)
            output = _run_model_loaded(model, batch)
            print(' '.join(output[0]))
    except:
        pass
def interactive ( task_name , model_cls , checkpoint = - 1 ) : model , hparams = model_cls . load ( task_name , checkpoint ) vocab_word , vocab_char , _ = model . vocabs input_fn = get_input_processor_words ( vocab_word , vocab_char ) print ( 'Ctrl+C to quit' ) try : while True : inputs = input ( '> ' ) batch = input_fn ( inputs ) output = _run_model_loaded ( model , batch ) print ( ' ' . join ( output [ 0 ] ) ) except : pass