pytext.config package

Submodules

pytext.config.component module

class pytext.config.component.Component(config=None)[source]

Bases: object

Config[source]

alias of Component.Config

classmethod from_config(config, *args, **kwargs)[source]
class pytext.config.component.ComponentMeta[source]

Bases: type

class pytext.config.component.ComponentType[source]

Bases: enum.Enum

An enumeration.

DATA_HANDLER = 'data_handler'
EXPORTER = 'exporter'
FEATURIZER = 'featurizer'
LOSS = 'loss'
METRIC_REPORTER = 'metric_reporter'
MODEL = 'model'
MODULE = 'module'
OPTIMIZER = 'optimizer'
PREDICTOR = 'predictor'
SCHEDULER = 'scheduler'
TASK = 'task'
TRAINER = 'trainer'
class pytext.config.component.Registry[source]

Bases: object

classmethod add(component_type: pytext.config.component.ComponentType, cls_to_add: Type, config_cls: Type)[source]
classmethod configs(component_type: pytext.config.component.ComponentType) → Tuple[Type, ...][source]
classmethod get(component_type: pytext.config.component.ComponentType, config_cls: Type) → Type[source]
classmethod subconfigs(config_cls: Type) → Tuple[Type, ...][source]
classmethod values(component_type: pytext.config.component.ComponentType) → Tuple[Type, ...][source]
exception pytext.config.component.RegistryError[source]

Bases: Exception

pytext.config.component.create_component(component_type: pytext.config.component.ComponentType, config: Any, *args, **kwargs)[source]
pytext.config.component.create_data_handler(data_handler_config, *args, **kwargs)[source]
pytext.config.component.create_exporter(exporter_config, *args, **kwargs)[source]
pytext.config.component.create_featurizer(featurizer_config, *args, **kwargs)[source]
pytext.config.component.create_loss(loss_config, *args, **kwargs)[source]
pytext.config.component.create_metric_reporter(module_config, *args, **kwargs)[source]
pytext.config.component.create_model(model_config, *args, **kwargs)[source]
pytext.config.component.create_predictor(predictor_config, *args, **kwargs)[source]
pytext.config.component.create_trainer(trainer_config, *args, **kwargs)[source]
pytext.config.component.get_component_name(obj)[source]

Return the human-readable name of the class of obj. Document the type of a config field and can be used as a Union value in a json config.

pytext.config.component.register_tasks(task_cls: Union[Type, List[Type]])[source]

Task classes are already added to registry during declaration, pass them as parameters here just to make sure they’re imported

pytext.config.contextual_intent_slot module

class pytext.config.contextual_intent_slot.ExtraField[source]

Bases: object

DOC_WEIGHT = 'doc_weight'
RAW_WORD_LABEL = 'raw_word_label'
TOKEN_RANGE = 'token_range'
UTTERANCE = 'utterance'
WORD_WEIGHT = 'word_weight'
class pytext.config.contextual_intent_slot.ModelInput[source]

Bases: object

CHAR = 'char_feat'
DICT = 'dict_feat'
PRETRAINED = 'pretrained_model_embedding'
SEQ = 'seq_word_feat'
TEXT = 'word_feat'
class pytext.config.contextual_intent_slot.ModelInputConfig(**kwargs)[source]

Bases: pytext.config.module_config.Module.Config

char_feat = None
dict_feat = None
pretrained_model_embedding = None
seq_word_feat = <pytext.config.field_config.WordFeatConfig object>
word_feat = <pytext.config.field_config.WordFeatConfig object>

pytext.config.doc_classification module

class pytext.config.doc_classification.ExtraField[source]

Bases: object

RAW_TEXT = 'utterance'
class pytext.config.doc_classification.ModelInput[source]

Bases: object

CHAR_FEAT = 'char_feat'
DENSE_FEAT = 'dense_feat'
DICT_FEAT = 'dict_feat'
PRETRAINED_MODEL_EMBEDDING = 'pretrained_model_embedding'
SEQ_LENS = 'seq_lens'
WORD_FEAT = 'word_feat'
class pytext.config.doc_classification.ModelInputConfig(**kwargs)[source]

Bases: pytext.config.module_config.Module.Config

char_feat = None
dense_feat = None
dict_feat = None
pretrained_model_embedding = None
word_feat = <pytext.config.field_config.WordFeatConfig object>

pytext.config.field_config module

pytext.config.field_config.CharFeatConfig[source]

alias of pytext.config.field_config.CharFeatConfig

pytext.config.field_config.DictFeatConfig[source]

alias of pytext.config.field_config.DictFeatConfig

class pytext.config.field_config.DocLabelConfig(**kwargs)[source]

Bases: pytext.config.pytext_config.ConfigBase

export_output_names = ['doc_scores']
label_weights = {}
target_prob = False
class pytext.config.field_config.EmbedInitStrategy[source]

Bases: enum.Enum

An enumeration.

RANDOM = 'random'
ZERO = 'zero'
class pytext.config.field_config.FeatureConfig(**kwargs)[source]

Bases: pytext.config.module_config.Module.Config

char_feat = None
dict_feat = None
pretrained_model_embedding = None
seq_word_feat = None
word_feat = <pytext.config.field_config.WordFeatConfig object>
class pytext.config.field_config.FloatVectorConfig(**kwargs)[source]

Bases: pytext.config.pytext_config.ConfigBase

dim = 0
pytext.config.field_config.PretrainedModelEmbeddingConfig[source]

alias of pytext.config.field_config.PretrainedModelEmbeddingConfig

pytext.config.field_config.WordFeatConfig[source]

alias of pytext.config.field_config.WordFeatConfig

class pytext.config.field_config.WordLabelConfig(**kwargs)[source]

Bases: pytext.config.pytext_config.ConfigBase

export_output_names = ['word_scores']
use_bio_labels = False

pytext.config.kd_doc_classification module

class pytext.config.kd_doc_classification.ExtraField[source]

Bases: object

RAW_TEXT = 'utterance'
class pytext.config.kd_doc_classification.ModelInput[source]

Bases: object

CHAR_FEAT = 'char_feat'
DICT_FEAT = 'dict_feat'
PRETRAINED_MODEL_EMBEDDING = 'pretrained_model_embedding'
SEQ_LENS = 'seq_lens'
WORD_FEAT = 'word_feat'
class pytext.config.kd_doc_classification.ModelInputConfig(**kwargs)[source]

Bases: pytext.config.module_config.Module.Config

char_feat = None
dict_feat = None
pretrained_model_embedding = None
word_feat = <pytext.config.field_config.WordFeatConfig object>
class pytext.config.kd_doc_classification.Target[source]

Bases: object

DOC_LABEL = 'doc_label'
TARGET_LABEL_FIELD = 'target_label'
TARGET_PROB_FIELD = 'target_prob'

pytext.config.module_config module

class pytext.config.module_config.CNNParams(**kwargs)[source]

Bases: pytext.config.pytext_config.ConfigBase

kernel_num = 100
kernel_sizes = [3, 4]
pytext.config.module_config.ModuleConfig[source]

alias of pytext.config.module_config.ModuleConfig

class pytext.config.module_config.PoolingType[source]

Bases: enum.Enum

An enumeration.

MAX = 'max'
MEAN = 'mean'
class pytext.config.module_config.SlotAttentionType[source]

Bases: enum.Enum

An enumeration.

CONCAT = 'concat'
DOT = 'dot'
MULTIPLY = 'multiply'
NO_ATTENTION = 'no_attention'

pytext.config.pair_classification module

class pytext.config.pair_classification.ExtraField[source]

Bases: object

UTTERANCE_PAIR = 'utterance'
class pytext.config.pair_classification.ModelInput[source]

Bases: object

TEXT1 = 'text1'
TEXT2 = 'text2'
class pytext.config.pair_classification.ModelInputConfig(**kwargs)[source]

Bases: pytext.config.module_config.Module.Config

text1 = <pytext.config.field_config.WordFeatConfig object>
text2 = <pytext.config.field_config.WordFeatConfig object>

pytext.config.pytext_config module

class pytext.config.pytext_config.ConfigBase(**kwargs)[source]

Bases: object

items()[source]
class pytext.config.pytext_config.ConfigBaseMeta[source]

Bases: type

annotations_and_defaults()[source]
class pytext.config.pytext_config.OptimizerParams(**kwargs)[source]

Bases: pytext.config.pytext_config.ConfigBase

lr = 0.001
momentum = 0.0
type = 'adam'
weight_decay = 1e-05
class pytext.config.pytext_config.OptimizerType[source]

Bases: enum.Enum

An enumeration.

ADAM = 'adam'
SGD = 'sgd'
class pytext.config.pytext_config.PlaceHolder[source]

Bases: object

class pytext.config.pytext_config.PyTextConfig(**kwargs)[source]

Bases: pytext.config.pytext_config.ConfigBase

debug_path = '/tmp/model.debug'
distributed_world_size = 1
export_caffe2_path = '/tmp/model.caffe2.predictor'
export_onnx_path = '/tmp/model.onnx'
load_snapshot_path = ''
modules_save_dir = ''
save_module_checkpoints = False
save_snapshot_path = '/tmp/model.pt'
test_out_path = '/tmp/test_out.txt'
use_cuda_if_available = True
use_tensorboard = True
class pytext.config.pytext_config.TestConfig(**kwargs)[source]

Bases: pytext.config.pytext_config.ConfigBase

test_path = 'test.tsv'
use_cuda_if_available = True
use_tensorboard = True

pytext.config.serialize module

exception pytext.config.serialize.ConfigParseError[source]

Bases: Exception

exception pytext.config.serialize.EnumTypeError[source]

Bases: pytext.config.serialize.ConfigParseError

exception pytext.config.serialize.IncorrectTypeError[source]

Bases: Exception

exception pytext.config.serialize.MissingValueError[source]

Bases: pytext.config.serialize.ConfigParseError

exception pytext.config.serialize.UnionTypeError[source]

Bases: pytext.config.serialize.ConfigParseError

pytext.config.serialize.config_from_json(cls, json_obj, ignore_fields=())[source]
pytext.config.serialize.config_to_json(cls, config_obj)[source]
pytext.config.serialize.parse_config(config_json)[source]

Parse PyTextConfig object from parameter string or parameter file

Module contents