Exemple #1
0
    def __init__(self, name=None):
        NeuralModule.__init__(self, name)  # For NeuralModule API

        # Set module type.
        self._type = ModuleType.loss

        self._device = get_cuda_device(self.placement)
Exemple #2
0
    def __init__(self, pretrained_model_name=None, name=None):
        NeuralModule.__init__(self, name)  # For NeuralModule API
        nn.Module.__init__(self)  # For PyTorch API

        self._device = get_cuda_device(self.placement)

        # Store pretrained model name (to be removed/changed)
        self._pretrained_model_name = pretrained_model_name
Exemple #3
0
    def __init__(self, pretrained_model_name=None, name=None):
        # Initialize nn.Module first - important for the inspect during the init_params collection.
        nn.Module.__init__(self)  # For PyTorch API
        NeuralModule.__init__(self, name)  # For NeuralModule API

        # Set module type.
        self._type = ModuleType.trainable

        self._device = get_cuda_device(self.placement)

        # Store pretrained model name (to be removed/changed)
        self._pretrained_model_name = pretrained_model_name
    def __init__(self):
        NeuralModule.__init__(self)  # For NeuralModule API
        self._device = get_cuda_device(self.placement)

        # if 'batch_size' not in kwargs:
        #    logging.warning("No batch_size specified in the data layer. "
        #                    "Setting batch_size to 1.")
        #    kwargs['batch_size'] = 1

        # Set default values of variables used by trained/passed to DataLoader.
        # NOTE: That also means that those are parameters of DataLoader/trainer, not DataLayer.
        # Thus those fields will be removed from DataLayer and moved to trainer configuration
        # (when the time for that will come;))
        self._batch_size = 1
        self._num_workers = os.cpu_count()  # Use all CPUs by default.
        self._shuffle = False  # Don't shuffle by default.
Exemple #5
0
 def __init__(self):
     # Neural Module API specific
     NeuralModule.__init__(self)
     # End of Neural Module API specific
     self._criterion = nn.CrossEntropyLoss()
 def __init__(self):
     NeuralModule.__init__(self)
 def __init__(self):
     NeuralModule.__init__(self)  # For NeuralModule API
     self._device = get_cuda_device(self.placement)
Exemple #8
0
 def __init__(self, detokenizer=None):
     NeuralModule.__init__(self)
     self._detokenizer = detokenizer
Exemple #9
0
    def __init__(self, ids2classes=None):
        NeuralModule.__init__(self)

        if ids2classes is None:
            ids2classes = {}
        self._ids2classes = ids2classes
 def __init__(self, detokenizer=None, **kwargs):
     NeuralModule.__init__(self, **kwargs)
     # self._sp_decoder = self.local_parameters.get("sp_decoder", {})
     self._detokenizer = detokenizer
    def __init__(self, ids2classes=None, **kwargs):
        NeuralModule.__init__(self, **kwargs)

        if ids2classes is None:
            ids2classes = {}
        self._ids2classes = ids2classes
Exemple #12
0
 def __init__(self, **kwargs):
     # Neural Module API specific
     NeuralModule.__init__(self, **kwargs)
Exemple #13
0
 def __init__(self):
     # Neural Module API specific
     NeuralModule.__init__(self)