Model
get_recent_weights_path
Get a model recent weights path.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
exp_dir |
Path
|
Experiment directory path. |
required |
exp_mark |
str
|
Experiment folder mark. |
required |
weights_name |
str, default
|
Weights filename. |
None
|
Returns:
Type | Description |
---|---|
Optional[Path]
|
Recent weights path if it exists otherwise None object. |
Source code in src/trecover/utils/model.py
get_model
get_model(
token_size,
pe_max_len,
num_layers,
d_model,
n_heads,
d_ff,
dropout,
device=torch.device("cpu"),
weights=None,
silently=False,
)
Get a model with specified configuration.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
token_size |
int
|
Token (column) size. |
required |
pe_max_len |
int
|
Positional encoding max length. |
required |
num_layers |
int
|
Number of encoder and decoder blocks |
required |
d_model |
int
|
Model dimension - number of expected features in the encoder (decoder) input. |
required |
n_heads |
int
|
Number of encoder and decoder attention heads. |
required |
d_ff |
int
|
Dimension of the feedforward layer. |
required |
dropout |
float
|
Dropout range. |
required |
device |
torch.device, default
|
Device on which to allocate the model. |
torch.device('cpu')
|
weights |
Path, default
|
Model weights path for initialization. |
None
|
silently |
bool, default
|
Initialize the model silently without any verbose information. |
False
|
Returns:
Name | Type | Description |
---|---|---|
model |
TRecover
|
Initialized model. |
Raises:
Type | Description |
---|---|
SystemExit:
|
If the weight's path is not provided and the cli 'stop' option is selected. |