data.text_tokenizer package
Submodules
data.text_tokenizer.base_tokenizer module
- class data.text_tokenizer.base_tokenizer.BaseTokenizer(opts, *args, **kwargs)[source]
Bases:
Module
- __init__(opts, *args, **kwargs)[source]
Initializes internal Module state, shared by both nn.Module and ScriptModule.
- forward(input_sentence: Any, *args, **kwargs) Any [source]
Defines the computation performed at every call.
Should be overridden by all subclasses.
Note
Although the recipe for forward pass needs to be defined within this function, one should call the
Module
instance afterwards instead of this since the former takes care of running the registered hooks while the latter silently ignores them.
data.text_tokenizer.clip_tokenizer module
- class data.text_tokenizer.clip_tokenizer.ClipTokenizer(opts, *args, **kwargs)[source]
Bases:
BaseTokenizer
- __init__(opts, *args, **kwargs)[source]
Initializes internal Module state, shared by both nn.Module and ScriptModule.
- forward(input_sentence: str, *args, **kwargs) Tensor [source]
Defines the computation performed at every call.
Should be overridden by all subclasses.
Note
Although the recipe for forward pass needs to be defined within this function, one should call the
Module
instance afterwards instead of this since the former takes care of running the registered hooks while the latter silently ignores them.
Module contents
- data.text_tokenizer.build_tokenizer(opts, *args, **kwargs) BaseTokenizer [source]
Helper function to build the text tokenizer from command-line arguments.
- Parameters:
opts – Command-line arguments
- Returns:
Image projection head module.