transformertc.configtc

Configuration base class and utilities.

Module Contents

transformertc.configtc.logger
class transformertc.configtc.ConfigTC(**kwargs)

Token Classification Config class.

labels

labels used in task.

Type

list of str

max_seq_length

maximum sequence length.

Type

int

task_format

task format (e.g. BIO, simple)

Type

str

Note

These attributes are required. Additional attributes passed to constructor will also be stored.

FNAME = tc.json
save_pretrained(self, save_directory)

Save a configuration object to the directory

classmethod from_pretrained(cls, model_path, **kwargs)

Load configuration from file in directory.

Parameters
  • model_path (str) – directory where the model is saved.

  • kwargs (dict, optional) – key/value pairs with which to update the configuration object after loading.

classmethod from_dict(cls, d)

Constructs a ConfigTC from a Python dictionary of parameters.

classmethod from_json_file(cls, json_file)

Constructs a ConfigTC from a json file of parameters.

__eq__(self, other)

Comparison with other objects.

__repr__(self)

String representation of the object.

to_dict(self)

Serializes this instance to a Python dictionary.

to_json_string(self)

Serializes this instance to a JSON string.

to_json_file(self, json_file_path)

Save this instance to a json file.