Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
M
mi_counseling
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
Model registry
Operate
Environments
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
shensq
mi_counseling
Commits
ee3247e9
Commit
ee3247e9
authored
5 years ago
by
shensq
Browse files
Options
Downloads
Patches
Plain Diff
sample now support attention mask
parent
8d89aedc
No related branches found
Branches containing commit
No related tags found
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
code/gpt_sample.py
+6
-5
6 additions, 5 deletions
code/gpt_sample.py
with
6 additions
and
5 deletions
code/gpt_sample.py
+
6
−
5
View file @
ee3247e9
...
...
@@ -134,11 +134,12 @@ def run_model(args, model, tokenizer, test_loader):
f_ref
=
open
(
'
../result/reference_
'
+
args
.
output_dir
+
'
.txt
'
,
'
w
'
)
for
i
,
sample
in
enumerate
(
test_loader
):
if
args
.
cross_attention
:
x
,
type_x
,
pos_x
,
lm_x
,
x_len
,
meta
,
keyword_x
=
sample
else
:
x
,
type_x
,
pos_x
,
lm_x
,
x_len
,
meta
=
sample
keyword_x
=
None
# if args.cross_attention:
# x, type_x, pos_x, lm_x, x_len, meta, keyword_x = sample
# else:
# x, type_x, pos_x, lm_x, x_len, meta = sample
# keyword_x = None
x
,
type_x
,
pos_x
,
lm_x
,
x_len
,
attention_mask
=
sample
input_len
=
x_len
[
0
]
# The number of tokens of the context utterances
context_tokens
=
x
[
0
][:
input_len
+
1
]
# at evaluation stage, the input is without the ground truth
...
...
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