Translation model class. Instance of the Model_Wrapper class (see staged_keras_wrapper).
Parameters:
params (dict) – all hyperparameters of the model.
model_type (str) – network name type (corresponds to any method defined in the section ‘MODELS’ of this class).
Only valid if ‘structure_path’ == None.
verbose (int) – split to 0 if you don’t want the model to output informative messages
structure_path (str) – path to a Keras’ model json file.
If we speficy this parameter then ‘type’ will be only an informative parameter.
weights_path (str) – path to the pre-trained weights file (if None, then it will be initialized according to params)
model_name (str) – optional name given to the network (if None, then it will be assigned to current time as its name)
vocabularies (dict) – vocabularies used for word embedding
store_path (str) – path to the folder where the temporal model packups will be stored
set_optimizer (bool) – Compile optimizer or not.
clear_dirs (bool) – Clean model directories or not.
Training function. Sets the training parameters from params. Build or loads the model and launches the training.
:param params: Dictionary of network hyperparameters.
:return: None
Use several translation models for obtaining predictions from a source text file.
Parameters:
args (argparse.Namespace) –
Arguments given to the method:
dataset: Dataset instance with data.
text: Text file with source sentences.
splits: Splits to sample. Should be already included in the dataset object.
dest: Output file to save scores.
weights: Weight given to each model in the ensemble. You should provide the same number of weights than models. By default, it applies the same weight to each model (1/N).
n_best: Write n-best list (n = beam size).
config: Config .pkl for loading the model configuration. If not specified, hyperparameters are read from config.py.