Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
E
emoUS-public
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Iterations
Wiki
Requirements
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Locked files
Build
Pipelines
Jobs
Pipeline schedules
Test cases
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
Code review analytics
Issue analytics
Insights
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
general
dsml
emoUS-public
Commits
ce2d802d
Commit
ce2d802d
authored
3 years ago
by
zqwerty
Browse files
Options
Downloads
Patches
Plain Diff
clean up run_seq2seq.py
parent
7f82cc0c
Branches
Branches containing commit
No related tags found
No related merge requests found
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
convlab2/base_models/t5/run_seq2seq.py
+6
-10
6 additions, 10 deletions
convlab2/base_models/t5/run_seq2seq.py
with
6 additions
and
10 deletions
convlab2/base_models/t5/run_seq2seq.py
+
6
−
10
View file @
ce2d802d
#!python
#!
/usr/bin/env
python
# coding=utf-8
# Copyright 2021 The HuggingFace Team. All rights reserved.
#
...
...
@@ -27,12 +27,10 @@ from dataclasses import dataclass, field
from
typing
import
Optional
import
datasets
import
nltk
# Here to have a nice missing dependency error message early on
import
numpy
as
np
from
datasets
import
load_dataset
,
load_metric
from
datasets
import
load_dataset
import
transformers
from
filelock
import
FileLock
from
transformers
import
(
AutoConfig
,
AutoModelForSeq2SeqLM
,
...
...
@@ -43,7 +41,6 @@ from transformers import (
Seq2SeqTrainingArguments
,
set_seed
,
)
from
transformers.file_utils
import
is_offline_mode
from
transformers.trainer_utils
import
EvalPrediction
,
get_last_checkpoint
from
transformers.utils
import
check_min_version
from
transformers.utils.versions
import
require_version
...
...
@@ -109,7 +106,7 @@ class DataTrainingArguments:
task_name
:
Optional
[
str
]
=
field
(
default
=
None
,
metadata
=
{
"
help
"
:
"
The name of the task, e.g., response generation.
"
}
default
=
None
,
metadata
=
{
"
help
"
:
"
The name of the task, e.g.,
rg (for rg
response generation
)
.
"
}
)
dataset_name
:
Optional
[
str
]
=
field
(
default
=
None
,
metadata
=
{
"
help
"
:
"
The name of the dataset to use (via the datasets library).
"
}
...
...
@@ -223,7 +220,7 @@ class DataTrainingArguments:
and
self
.
validation_file
is
None
and
self
.
test_file
is
None
):
raise
ValueError
(
"
Need either a dataset name or a training/validation
file
/test
_
file.
"
)
raise
ValueError
(
"
Need either a dataset name or a training/validation/test
ing
file.
"
)
else
:
if
self
.
train_file
is
not
None
:
extension
=
self
.
train_file
.
split
(
"
.
"
)[
-
1
]
...
...
@@ -238,8 +235,6 @@ class DataTrainingArguments:
self
.
val_max_target_length
=
self
.
max_target_length
def
main
():
# See all possible arguments in src/transformers/training_args.py
# or by passing the --help flag to this script.
...
...
@@ -586,6 +581,7 @@ def main():
trainer
.
log_metrics
(
"
eval
"
,
metrics
)
trainer
.
save_metrics
(
"
eval
"
,
metrics
)
# Predict
if
training_args
.
do_predict
:
logger
.
info
(
"
*** Predict ***
"
)
...
...
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