Dispatcher for named model architectures.
Adding a new architecture
- Create a new module e.g.
BinClass.Model.NewArchinlib/bin_class/model/new_arch.ex. - Implement
build/2in that module, using the shared internal model configuration helpers for option validation and seeded dropout. - Add a new clause to
BinClass.Model.build/3:def build(:new_arch, vocab_size, opts), do: BinClass.Model.NewArch.build(vocab_size, opts) - Update the training configuration's default architecture if it should become the default.
Summary
Functions
Returns the supported architecture names.
Builds a named binary-classification model.
architecture must be one of the values returned by architectures/0, and
vocab_size must be a positive integer greater than :pad_token_id. The
returned Axon graph accepts batches of token IDs and produces two-class
probability distributions.
Common options
:embedding_size- Positive embedding width. Defaults to64.:dropout_rate- Number from0.0up to, but excluding,1.0. Defaults to0.2.:pad_token_id- Non-negative padding ID belowvocab_size. Defaults to0.:seed- Optional integer used to seed dropout layers. Defaults tonil.
Architecture-specific options
:conv_filters- Positive filter count for:cnnand:cnn_mixed_pooling. Defaults to128and96, respectively.:branch_filters- Positive per-branch filter count for:multi_scale_cnnand:sep_se_cnn. Defaults to32and48, respectively.:ff_dim- Positive feed-forward width for:transformer. Defaults to128.