Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
L
LC-MS-RT-prediction
Manage
Activity
Members
Labels
Plan
Issues
0
Issue boards
Milestones
Wiki
Code
Merge requests
0
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package Registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Léo Schneider
LC-MS-RT-prediction
Commits
4c99210f
Commit
4c99210f
authored
1 year ago
by
Schneider Leo
Browse files
Options
Downloads
Patches
Plain Diff
code cleaning
parent
61d770f6
No related branches found
Branches containing commit
No related tags found
No related merge requests found
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
.idea/misc.xml
+1
-1
1 addition, 1 deletion
.idea/misc.xml
main.py
+2
-0
2 additions, 0 deletions
main.py
scheduler.py
+20
-0
20 additions, 0 deletions
scheduler.py
with
23 additions
and
1 deletion
.idea/misc.xml
+
1
−
1
View file @
4c99210f
...
...
@@ -3,5 +3,5 @@
<component
name=
"Black"
>
<option
name=
"sdkName"
value=
"Python 3.9 (LC-MS-RT-prediction)"
/>
</component>
<component
name=
"ProjectRootManager"
version=
"2"
project-jdk-name=
"Python 3.
9
(LC-MS-RT-prediction)"
project-jdk-type=
"Python SDK"
/>
<component
name=
"ProjectRootManager"
version=
"2"
project-jdk-name=
"Python 3.
10
(LC-MS-RT-prediction)"
project-jdk-type=
"Python SDK"
/>
</project>
\ No newline at end of file
This diff is collapsed.
Click to expand it.
main.py
+
2
−
0
View file @
4c99210f
...
...
@@ -38,6 +38,8 @@ from model import (RT_pred_model_self_attention, Intensity_pred_model_multi_head
# return score, delta_95
def
train_rt
(
model
,
data_train
,
epoch
,
optimizer
,
criterion
,
metric
,
wandb
=
None
):
losses
=
0.
dist_acc
=
0.
...
...
This diff is collapsed.
Click to expand it.
scheduler.py
0 → 100644
+
20
−
0
View file @
4c99210f
import
numpy
as
np
from
torch
import
optim
class
CosineWarmupScheduler
(
optim
.
lr_scheduler
.
LRScheduler
):
def
__init__
(
self
,
optimizer
,
warmup
,
max_iters
):
self
.
warmup
=
warmup
self
.
max_num_iters
=
max_iters
super
().
__init__
(
optimizer
)
def
get_lr
(
self
):
lr_factor
=
self
.
get_lr_factor
(
epoch
=
self
.
last_epoch
)
return
[
base_lr
*
lr_factor
for
base_lr
in
self
.
base_lrs
]
def
get_lr_factor
(
self
,
epoch
):
lr_factor
=
0.5
*
(
1
+
np
.
cos
(
np
.
pi
*
epoch
/
self
.
max_num_iters
))
if
epoch
<=
self
.
warmup
:
lr_factor
*=
epoch
*
1.0
/
self
.
warmup
return
lr_factor
\ No newline at end of file
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment