def __init__(self, metrics_history=None): example_inputter = inputters.ExampleInputter(TestInputter(), TestInputter()) super(TestModel, self).__init__(example_inputter) if metrics_history is None: metrics_history = {} self.metrics_history = metrics_history self.next_loss = tf.Variable(0)
def __init__(self, loss_history=None, metrics_history=None): example_inputter = inputters.ExampleInputter(TestInputter(), TestInputter()) super(TestModel, self).__init__(example_inputter) if loss_history is None: loss_history = [] if metrics_history is None: metrics_history = {} self.loss_history = loss_history self.metrics_history = metrics_history
def __init__(self, inputter, encoder): """Initializes a sequence classifier. Args: inputter: A :class:`opennmt.inputters.Inputter` to process the input data. encoder: A :class:`opennmt.encoders.Encoder` to encode the input. Raises: ValueError: if :obj:`encoding` is invalid. """ example_inputter = inputters.ExampleInputter(inputter, ClassInputter()) super().__init__(example_inputter) self.encoder = encoder
def __init__(self, name, features_inputter=None, labels_inputter=None, daisy_chain_variables=False, dtype=None, examples_inputter=None): if examples_inputter is None: examples_inputter = inputters.ExampleInputter(features_inputter, labels_inputter) self.examples_inputter = examples_inputter if dtype is None: dtype = self.features_inputter.dtype super(Model, self).__init__(name=name, dtype=dtype) self.daisy_chain_variables = daisy_chain_variables
def __init__(self, inputter, encoder, crf_decoding=False): """Initializes a sequence tagger. Args: inputter: A :class:`opennmt.inputters.Inputter` to process the input data. encoder: A :class:`opennmt.encoders.Encoder` to encode the input. crf_decoding: If ``True``, add a CRF layer after the encoder. """ example_inputter = inputters.ExampleInputter(inputter, TagsInputter()) super(SequenceTagger, self).__init__(example_inputter) self.encoder = encoder self.crf_decoding = crf_decoding self.tagging_scheme = None self.transition_params = None
def __init__(self, name, features_inputter=None, labels_inputter=None, daisy_chain_variables=False, dtype=None, examples_inputter=None): self.name = name self.examples_inputter = examples_inputter if self.examples_inputter is None: self.examples_inputter = inputters.ExampleInputter( features_inputter, labels_inputter) self.features_inputter = self.examples_inputter.features_inputter self.labels_inputter = self.examples_inputter.labels_inputter self.daisy_chain_variables = daisy_chain_variables if dtype is None and self.features_inputter is not None: self.dtype = self.features_inputter.dtype else: self.dtype = dtype or tf.float32