Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
Shape Transformer
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Deploy
Releases
Package registry
Container registry
Model registry
Operate
Terraform modules
Monitor
Incidents
Analyze
Contributor 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
Gregor Kobsik
Shape Transformer
Commits
888c3d61
Commit
888c3d61
authored
4 years ago
by
Gregor Kobsik
Browse files
Options
Downloads
Patches
Plain Diff
fixed logging of loss while training
parent
ba2a7bde
No related branches found
No related tags found
No related merge requests found
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
models/shape_transformer.py
+3
-4
3 additions, 4 deletions
models/shape_transformer.py
with
3 additions
and
4 deletions
models/shape_transformer.py
+
3
−
4
View file @
888c3d61
...
...
@@ -72,7 +72,7 @@ class ShapeTransformer(pl.LightningModule):
logits
=
self
.
model
(
x
)
loss
=
self
.
criterion
(
logits
.
view
(
-
1
,
logits
.
size
(
-
1
)),
x
.
view
(
-
1
))
self
.
log
(
'
train_loss
'
,
loss
,
on_step
=
Tru
e
,
on_epoch
=
Tru
e
,
prog_bar
=
True
)
self
.
log
(
'
train_loss
'
,
loss
,
on_step
=
Fals
e
,
on_epoch
=
Fals
e
,
prog_bar
=
True
)
return
{
'
loss
'
:
loss
}
def
validation_step
(
self
,
batch
,
batch_idx
):
...
...
@@ -82,13 +82,12 @@ class ShapeTransformer(pl.LightningModule):
logits
=
self
.
model
(
x
)
loss
=
self
.
criterion
(
logits
.
view
(
-
1
,
logits
.
size
(
-
1
)),
x
.
view
(
-
1
))
self
.
log
(
'
val_loss
'
,
loss
,
on_step
=
Tru
e
,
on_epoch
=
Tru
e
,
prog_bar
=
True
)
self
.
log
(
'
val_loss
'
,
loss
,
on_step
=
Fals
e
,
on_epoch
=
Fals
e
,
prog_bar
=
True
)
return
{
'
val_loss
'
:
loss
}
def
validation_epoch_end
(
self
,
outs
):
avg_loss
=
torch
.
stack
([
x
[
"
val_loss
"
]
for
x
in
outs
]).
mean
()
self
.
log
(
'
avg_loss
'
,
avg_loss
,
on_epoch
=
True
,
prog_bar
=
True
)
return
{
'
val_loss
'
:
avg_loss
}
self
.
log
(
'
val_loss
'
,
avg_loss
,
on_step
=
False
,
on_epoch
=
True
,
prog_bar
=
True
)
def
test_step
(
self
,
batch
,
batch_idx
):
return
self
.
validation_step
(
batch
,
batch_idx
)
...
...
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