Horus: added a pre-trained model - ResNet and checkpoint support.#9
Open
haichangsi wants to merge 9 commits intoLunicen:mainfrom
Open
Horus: added a pre-trained model - ResNet and checkpoint support.#9haichangsi wants to merge 9 commits intoLunicen:mainfrom
haichangsi wants to merge 9 commits intoLunicen:mainfrom
Conversation
jereml99
reviewed
May 31, 2023
Collaborator
jereml99
left a comment
There was a problem hiding this comment.
Traning idzie całkiem powolutku mogę obczaić co tam tyle zajmuję
Widzę że są jakieś konflikty z mergem,
| self.feature_extractor = resnet50(weights=ResNet50_Weights.DEFAULT) | ||
| # Replace the last fully connected layer | ||
| # Parameters of newly constructed modules have requires_grad=True by default | ||
| num_ftrs = self.feature_extractor.fc.in_features |
Collaborator
There was a problem hiding this comment.
A gdzie podajemy liczbę cech na wejście sieci?
Collaborator
There was a problem hiding this comment.
Powinniśmy mieć automatycznego lintera xd
| def __getitem__(self, idx): | ||
| mel_spec, label = self.data[idx] | ||
| mel_spec = torch.from_numpy(mel_spec).unsqueeze(0) # Add channel dimension | ||
| mel_spec = mel_spec.expand(3, -1, -1) # Expand single channel to three channels |
| filename=f"{split_name}_bird_classifier_batch_{batch_size}_lr_{learning_rate}", | ||
| monitor="val_loss", # The metric to monitor | ||
| save_top_k=1, # Save only the top 1 models based on the metric monitored | ||
| mode="min", # In 'min' mode, training will stop when the quantity monitored has stopped decreasing |
Collaborator
There was a problem hiding this comment.
Suggested change
| mode="min", # In 'min' mode, training will stop when the quantity monitored has stopped decreasing | |
| mode="min", # In 'min' mode, the model with lowest val_loss is picked |
Comment on lines
+66
to
+67
| # Save the trained model (The best model is saved by the checkpoint_callback) | ||
| # trainer.save_checkpoint(f"{split_name}_bird_classifier_batch_{batch_size}.ckpt") |
|
|
||
| class BirdSpectrogramDataModule(pl.LightningDataModule): | ||
| def __init__(self, root_dir, batch_size=16): | ||
| def __init__(self, root_dir, batch_size=16, num_workers=4): |
jereml99
reviewed
May 31, 2023
Collaborator
jereml99
left a comment
There was a problem hiding this comment.
Traning idzie całkiem powolutku mogę obczaić co tam tyle zajmuję
Widzę że są jakieś konflikty z mergem,
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
No description provided.