claf.config.factory package

Submodules

class claf.config.factory.base.Factory[source]

Bases: object

Factory Base Class

Factory method pattern

In class-based programming, the factory method pattern is a creational pattern that uses factory methods to deal with the problem of creating objects without having to specify the exact class of the object that will be created. This is done by creating objects by calling a factory method—either specified in an interface and implemented by child classes, or implemented in a base class and optionally overridden by derived classes—rather than by calling a constructor.

create()[source]

interface

class claf.config.factory.data_loader.DataLoaderFactory(config)[source]

Bases: claf.config.factory.base.Factory

DataLoader Factory Class

  • Args:

    config: data_loader config from argument (config.data_loader)

create(datasets)[source]

create train, valid and test iterator

claf.config.factory.data_loader.make_data_loader(dataset, batch_size=32, shuffle=True, cuda_device_id=None)[source]
class claf.config.factory.data_reader.DataReaderFactory(config)[source]

Bases: claf.config.factory.base.Factory

DataReader Factory Class

Create Concrete reader according to config.dataset Get reader from reader registries (eg. @register(“reader:{reader_name}”))

  • Args:

    config: data_reader config from argument (config.data_reader)

create()[source]

interface

class claf.config.factory.model.ModelFactory(config)[source]

Bases: claf.config.factory.base.Factory

Model Factory Class

Create Concrete model according to config.model_name Get model from model registries (eg. @register(“model:{model_name}”))

  • Args:

    config: model config from argument (config.model)

create(token_makers, **params)[source]

interface

create_token_embedder(model, token_makers)[source]
class claf.config.factory.optimizer.OptimizerFactory(config)[source]

Bases: claf.config.factory.base.Factory

Optimizer Factory Class

include optimizer, learning_rate_scheduler and exponential_moving_average

  • Args:

    config: optimizer config from argument (config.optimizer)

create(model)[source]

interface

set_warmup_steps(config)[source]
class claf.config.factory.tokens.TokenMakersFactory(config)[source]

Bases: claf.config.factory.base.Factory

TokenMakers Factory Class

  • Args:

    config: token config from argument (config.token)

LANGS = ['eng', 'kor']
create()[source]

interface

claf.config.factory.tokens.make_all_tokenizers(all_tokenizer_config)[source]

Tokenizer is resource used all token together

claf.config.factory.tokens.make_tokenizer(tokenizer_cls, tokenizer_config, parent_tokenizers={})[source]

Module contents

class claf.config.factory.DataReaderFactory(config)[source]

Bases: claf.config.factory.base.Factory

DataReader Factory Class

Create Concrete reader according to config.dataset Get reader from reader registries (eg. @register(“reader:{reader_name}”))

  • Args:

    config: data_reader config from argument (config.data_reader)

create()[source]

interface

class claf.config.factory.DataLoaderFactory(config)[source]

Bases: claf.config.factory.base.Factory

DataLoader Factory Class

  • Args:

    config: data_loader config from argument (config.data_loader)

create(datasets)[source]

create train, valid and test iterator

class claf.config.factory.ModelFactory(config)[source]

Bases: claf.config.factory.base.Factory

Model Factory Class

Create Concrete model according to config.model_name Get model from model registries (eg. @register(“model:{model_name}”))

  • Args:

    config: model config from argument (config.model)

create(token_makers, **params)[source]

interface

create_token_embedder(model, token_makers)[source]
class claf.config.factory.OptimizerFactory(config)[source]

Bases: claf.config.factory.base.Factory

Optimizer Factory Class

include optimizer, learning_rate_scheduler and exponential_moving_average

  • Args:

    config: optimizer config from argument (config.optimizer)

create(model)[source]

interface

set_warmup_steps(config)[source]
class claf.config.factory.TokenMakersFactory(config)[source]

Bases: claf.config.factory.base.Factory

TokenMakers Factory Class

  • Args:

    config: token config from argument (config.token)

LANGS = ['eng', 'kor']
create()[source]

interface