Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
D
danceformer
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package registry
Container 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
GitLab community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
grzonkow
danceformer
Commits
20b2bb4b
Commit
20b2bb4b
authored
1 year ago
by
Cassandra Grzonkowski
Browse files
Options
Downloads
Patches
Plain Diff
device
parent
6ba8b072
Loading
Loading
1 merge request
!1
Instant spectograms
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
main.py
+2
-4
2 additions, 4 deletions
main.py
with
2 additions
and
4 deletions
main.py
+
2
−
4
View file @
20b2bb4b
...
@@ -117,14 +117,12 @@ def train_one_epoch(danceformer, train_loader, epoch, model_params_path, device,
...
@@ -117,14 +117,12 @@ def train_one_epoch(danceformer, train_loader, epoch, model_params_path, device,
output_v_2_flat
=
torch
.
cat
((
output_flat
[:,
:
empty_token
],
output_flat
[:,
empty_token
+
1
:]),
dim
=
1
).
to
(
device
)
output_v_2_flat
=
torch
.
cat
((
output_flat
[:,
:
empty_token
],
output_flat
[:,
empty_token
+
1
:]),
dim
=
1
).
to
(
device
)
output_var_2_softmax
=
m
(
output_v_2_flat
).
to
(
device
)
output_var_2_softmax
=
m
(
output_v_2_flat
).
to
(
device
)
# insert empty token with 0 prob as placeholer to have right index
# insert empty token with 0 prob as placeholer to have right index
print
(
output_var_2_softmax
[:,
:
empty_token
])
tmp
=
torch
.
cat
((
output_var_2_softmax
[:,
:
empty_token
],
torch
.
zeros
((
output_var_2_softmax
.
shape
[
0
]),
1
,
device
=
device
)),
dim
=
1
).
to
(
device
)
print
(
torch
.
zeros
((
output_var_2_softmax
.
shape
[
0
])))
tmp
=
torch
.
cat
((
output_var_2_softmax
[:,
:
empty_token
],
torch
.
zeros
((
output_var_2_softmax
.
shape
[
0
]),
1
)),
dim
=
1
).
to
(
device
)
output_var_2_softmax
=
torch
.
cat
((
tmp
[:,
:
empty_token
+
1
],
output_var_2_softmax
[:,
empty_token
:]),
dim
=
1
).
to
(
device
)
output_var_2_softmax
=
torch
.
cat
((
tmp
[:,
:
empty_token
+
1
],
output_var_2_softmax
[:,
empty_token
:]),
dim
=
1
).
to
(
device
)
# richtiges token siehte target/chart an entsprechender stelle
# richtiges token siehte target/chart an entsprechender stelle
right_token_probs
=
output_var_2_softmax
[
torch
.
arange
(
output_var_2_softmax
.
size
(
0
)),
charts_flat
].
unsqueeze
(
1
).
to
(
device
)
right_token_probs
=
output_var_2_softmax
[
torch
.
arange
(
output_var_2_softmax
.
size
(
0
)),
charts_flat
].
unsqueeze
(
1
).
to
(
device
)
# take entries where non empty chart values
# take entries where non empty chart values
non_empty_ind
=
torch
.
where
(
charts_flat
!=
empty_token
)
.
to
(
device
)
non_empty_ind
=
torch
.
where
(
charts_flat
!=
empty_token
)
# only right tokens prob ohne empty token
# only right tokens prob ohne empty token
right_token_probs
=
right_token_probs
[
non_empty_ind
]
right_token_probs
=
right_token_probs
[
non_empty_ind
]
if
len
(
right_token_probs
)
!=
0
:
if
len
(
right_token_probs
)
!=
0
:
...
...
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