Skip to content
This repository was archived by the owner on Jul 18, 2024. It is now read-only.
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
117 changes: 117 additions & 0 deletions configs/default/workers/offline_trainer.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,117 @@
####################################################################
# Section defining all the default values of parameters used during training when using ptp-offline-trainer.

# If you want to use different section for training pass its name as command line argument '--training_section_name' to trainer (DEFAULT: training)
# Note: in such a case remember to define all the required parameters in the new section.
training:
# Set the random seeds: -1 means that they will be picked randomly.
# Note: their final values will be stored in the final training_configuration.yml saved to log dir.
seed_numpy: -1
seed_torch: -1

# Default batch size.
batch_size: 64

# Definition of the problem (Mandatory!)
#problem:
# One must define its type (Mandatory!)
# type: ?
# The rest of the content of that section is problem-specific...

# Section describing curriculum learning (Optional)
#curriculum_learning:
# # Flag indicating whether curriculum learning has to finish before (eventual) termination of the training.
# must_finish: True
# The rest of the content of that section is problem-specific...

# Definition of optimizer (Mandatory!)
#optimizer:
# # Type - generally all optimizers from PyTorch.optim are allowed (Mandatory!)
# type: Adam
# # Options:
# lr: 0.0001
# The rest of the content of that section is optimizer-specific...

# Set a default configuration section for data loader.
dataloader:
# Shuffle set by default.
shuffle: True
batch_sampler: None
# Do not use multiprocessing by default.
num_workers: 0
pin_memory: False
# Do not drop last frame by default.
drop_last: False
timeout: 0

# Definition of sampler (Optional)
# When this section will not be present, worker will use "standard" sampling (please refer to shuffle in dataloader)
#sampler:
# # Type - generally all samplers from PyTorch (plus some new onses) are allowed (Mandatory!)
# # Options:
# type: RandomSmpler
# The rest of the content of that section is optimizer-specific...

# Terminal conditions that will be used during training.
# They can (and ofter should) be overwritten.
terminal_conditions:
# Terminal condition I: loss threshold, going below will terminate the training.
loss_stop_threshold: 0.00001 # 1e-5
# Terminal condition II: Early stopping monitor validation loss, if it didn't down during last n validations, training will be terminated (Optional, negative means that this condition is disabled)
early_stop_validations: 10
# Terminal condition III: maximal number of epochs (Mandatory for this trainer! Must be > 0)
epoch_limit: 10
# Terminal condition IV: maximal number of episodes (Optional, -1 (negative) means that this condition is disabled)
episode_limit: -1



####################################################################
# Section defining all the default values of parameters used during validation.
# If you want to use different section for validation pass its name as command line argument '--validation_section_name' to trainer (DEFAULT: validation)
# Note: in such a case remember to define all the required parameters in the new section.
validation:
# Defines how often the partial validation will be performed.
# In this trainer Partial Validation is optional (negative value means it is disabled)
partial_validation_interval: -1

# Definition of the problem (mandatory!)
#problem:
# One must define its type (Mandatory!)
# type: ?
# The rest of the content of that section is problem-specific...

# Set a default configuration section for data loader.
dataloader:
# Shuffle set by default.
shuffle: True
# Do not use multiprocessing by default.
num_workers: 0
pin_memory: False
# Do not drop last frame by default.
drop_last: False
timeout: 0

# Definition of sampler (Optional)
# When this section will not be present, worker will use "standard" sampling (please refer to shuffle in dataloader)
#sampler:
# # Type - generally all samplers from PyTorch (plus some new onses) are allowed (Mandatory!)
# # Options:
# type: RandomSmpler
# The rest of the content of that section is optimizer-specific...



####################################################################
# Section defining all the default values of parameters used during training.
# If you want to use different section for validation pass its name as command line argument '--pipeline_section_name' to trainer (DEFAULT: pipeline)
pipeline:
# Pipeline must contain at least one component.
#name_1:
# Each component must have defined its priority... (Mandatory!)
# priority: 0.1 # Can be float. Smaller means higher priority, up to zero.
# # ... and type (Mandatory!)
# type: ?
# The rest of the content of that section is component-specific...


11 changes: 7 additions & 4 deletions configs/default/workers/online_trainer.yml
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
####################################################################
# Section defining all the default values of parameters used during training.
# Section defining all the default values of parameters used during training when using ptp-online-trainer.

# If you want to use different section for training pass its name as command line argument '--training_section_name' to trainer (DEFAULT: training)
# Note: in such a case remember to define all the required parameters in the new section.
training:
Expand Down Expand Up @@ -55,10 +56,12 @@ training:
# They can (and ofter should) be overwritten.
terminal_conditions:
# Terminal condition I: loss threshold, going below will terminate the training.
loss_stop: 0.00001 # 1e-5
# Terminal condition II: maximal number of epochs (optional, -1 means that this condition is disabled)
loss_stop_threshold: 0.00001 # 1e-5
# Terminal condition II: Early stopping monitor validation loss, if it didn't down during last n validations, training will be terminated (Optional, negative means that this condition is disabled)
early_stop_validations: 10
# Terminal condition III: maximal number of epochs (Optional, -1 (negative) means that this condition is disabled)
epoch_limit: -1
# Terminal condition III: maximal number of episodes (Mandatory for this trainer! Must be > 0)
# Terminal condition IV: maximal number of episodes (Mandatory for this trainer! Must be > 0)
episode_limit: 100000


Expand Down
2 changes: 1 addition & 1 deletion configs/default/workers/processor.yml
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ test:
#sampler:
# # Type - generally all samplers from PyTorch (plus some new onses) are allowed (Mandatory!)
# # Options:
# type: RandomSmpler
# type: RandomSampler
# The rest of the content of that section is optimizer-specific...


Expand Down
19 changes: 10 additions & 9 deletions configs/mnist/default_mnist.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,35 +2,36 @@
training:
problem:
type: MNIST
batch_size: &b 6400
batch_size: &b 64
use_train_data: True
#resize: [32, 32]
# Use sampler that operates on a subset.
#sampler:
# type: SubsetRandomSampler
# indices: [0, 55000]
sampler:
type: SubsetRandomSampler
indices: [0, 55000]
# optimizer parameters:
optimizer:
type: Adam
lr: 0.0001
# settings parameters
terminal_conditions:
loss_stop: 0.05
loss_stop_threshold: 0.05
early_stop_validations: 10
episode_limit: 10000
epoch_limit: 10

# Validation parameters:
validation:
partial_validation_interval: 500
#partial_validation_interval: 100
problem:
type: MNIST
batch_size: *b
use_train_data: True # True because we are splitting the training set to: validation and training
#resize: [32, 32]
# Use sampler that operates on a subset.
#sampler:
# type: SubsetRandomSampler
# indices: [55000, 60000]
sampler:
type: SubsetRandomSampler
indices: [55000, 60000]

# Testing parameters:
test:
Expand Down
8 changes: 3 additions & 5 deletions configs/mnist/mnist_classification_kfold_softmax.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,18 +7,17 @@ training:
type: MNIST
batch_size: &b 64
use_train_data: True
#resize: [32, 32]
# Use k-fold cross-validation random sampler.
sampler:
type: kFoldRandomSampler
folds: 7 # Each with size of 6000
folds: 10 # Each with size of 6000
# optimizer parameters:
optimizer:
type: Adam
lr: 0.0001
# settings parameters
terminal_conditions:
loss_stop: 0.5
loss_stop_threshold: 0.5
episode_limit: 10000
epoch_limit: 5

Expand All @@ -29,11 +28,10 @@ validation:
type: MNIST
batch_size: *b
use_train_data: True # True because we are splitting the training set to: validation and training
#resize: [32, 32]
# Use k-fold cross-validation random sampler.
sampler:
type: kFoldRandomSampler
folds: 7 # Each with size of 6000
folds: 10 # Each with size of 6000

pipeline:

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ test:
pipeline:

# Disable components for "default" flow.
disable: nllloss, precision_recall
disable: nllloss, accuracy, precision_recall

# Add global variables.
global_publisher:
Expand All @@ -30,30 +30,39 @@ pipeline:
values: [3, 7, {"Zero": 0, "One": 1, "Two": 2}, {"Three": 0, "Four": 1, "Five": 2, "Six": 3, "Seven": 4, "Eight": 5, "Nine": 6}]

################# Flow 1 #################
flow1_string_to_mask:
type: StringToMask
priority: 1.1
globals:
word_mappings: word_to_ix1
streams:
strings: labels
string_indices: flow1_targets
masks: flow1_masks

# Image classifier.
flow1_image_classifier:
type: LeNet5
priority: 1.2
priority: 1.1
globals:
prediction_size: num_classes1
streams:
inputs: inputs
predictions: flow1_predictions

flow1_label_to_mask1:
type: StringToMask
priority: 1.2
globals:
word_mappings: word_to_ix1
streams:
strings: labels
masks: flow1_masks

flow1_label_to_target1:
type: LabelIndexer
priority: 1.3
import_word_mappings_from_globals: True
globals:
word_mappings: word_to_ix1
streams:
inputs: labels
outputs: flow1_targets

# Masked loss.
flow1_nllloss:
type: NLLLoss
priority: 1.31
priority: 1.4
use_masking: True
streams:
targets: flow1_targets
Expand All @@ -64,7 +73,7 @@ pipeline:
# Statistics.
flow1_accuracy:
type: AccuracyStatistics
priority: 1.32
priority: 1.51
use_masking: True
streams:
predictions: flow1_predictions
Expand All @@ -75,7 +84,7 @@ pipeline:

flow1_precision_recall:
type: PrecisionRecallStatistics
priority: 1.33
priority: 1.52
use_word_mappings: True
show_class_scores: True
show_confusion_matrix: True
Expand All @@ -93,30 +102,39 @@ pipeline:
f1score: flow1_f1score

################# Flow 2 #################
flow2_string_to_mask:
type: StringToMask
priority: 2.1
globals:
word_mappings: word_to_ix2
streams:
strings: labels
string_indices: flow2_targets
masks: flow2_masks

# Image classifier.
flow2_image_classifier:
type: LeNet5
priority: 2.2
priority: 2.1
globals:
prediction_size: num_classes2
streams:
inputs: inputs
predictions: flow2_predictions

flow2_label_to_mask2:
type: StringToMask
priority: 2.2
globals:
word_mappings: word_to_ix2
streams:
strings: labels
masks: flow2_masks

flow2_label_to_target2:
type: LabelIndexer
priority: 2.3
import_word_mappings_from_globals: True
globals:
word_mappings: word_to_ix2
streams:
inputs: labels
outputs: flow2_targets

# Masked loss.
flow2_nllloss:
type: NLLLoss
priority: 2.31
priority: 2.4
use_masking: True
streams:
targets: flow2_targets
Expand All @@ -127,7 +145,7 @@ pipeline:
# Statistics.
flow2_accuracy:
type: AccuracyStatistics
priority: 2.32
priority: 2.41
use_masking: True
streams:
targets: flow2_targets
Expand All @@ -138,7 +156,7 @@ pipeline:

flow2_precision_recall:
type: PrecisionRecallStatistics
priority: 2.33
priority: 2.42
use_word_mappings: True
show_class_scores: True
show_confusion_matrix: True
Expand Down
Loading