Ejemplo n.º 1
0
def test_calculate_cls_vector(pooling, features, only_non_zero_vectors,
                              expected):
    actual = DenseFeaturizer.aggregate_sequence_features(
        features,
        pooling_operation=pooling,
        only_non_zero_vectors=only_non_zero_vectors)
    assert np.all(actual == expected)
Ejemplo n.º 2
0
 def get_default_config() -> Dict[Text, Any]:
     """The component's default config (see parent class for full docstring)."""
     return {
         **DenseFeaturizer.get_default_config(),
         # Remote URL/Local path to model files
         "model_url": None,
     }
Ejemplo n.º 3
0
 def get_default_config() -> Dict[Text, Any]:
     """Returns the component's default config."""
     return {
         **DenseFeaturizer.get_default_config(),
         # Specify what pooling operation should be used to calculate the vector of
         # the complete utterance. Available options: 'mean' and 'max'
         POOLING:
         MEAN_POOLING,
     }
Ejemplo n.º 4
0
 def get_default_config() -> Dict[Text, Any]:
     """Returns LanguageModelFeaturizer's default config."""
     return {
         **DenseFeaturizer.get_default_config(),
         # name of the language model to load.
         "model_name": "bert",
         # Pre-Trained weights to be loaded(string)
         "model_weights": None,
         # an optional path to a specific directory to download
         # and cache the pre-trained model weights.
         "cache_dir": None,
     }
Ejemplo n.º 5
0
 def get_default_config() -> Dict[Text, Any]:
     """Returns the component's default config."""
     return {
         **DenseFeaturizer.get_default_config(),
         # specifies the language of the subword segmentation model
         "lang": None,
         # specifies the dimension of the subword embeddings
         "dim": None,
         # specifies the vocabulary size of the segmentation model
         "vs": None,
         # if set to True and the given vocabulary size can't be loaded for the given
         # model, the closest size is chosen
         "vs_fallback": True,
     }