Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
ModelZoo
UMT5_pytorch
Commits
109633be
Commit
109633be
authored
Aug 26, 2024
by
wanglch
Browse files
Update umt5_summary.py
parent
7c115c82
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
0 additions
and
6 deletions
+0
-6
umt5_summary.py
umt5_summary.py
+0
-6
No files found.
umt5_summary.py
View file @
109633be
...
...
@@ -16,12 +16,6 @@ trained_model_weights = '/umt5/saves/train_dtk_weights/epoch_1_valid_rouge_23.43
tokenizer
=
AutoTokenizer
.
from_pretrained
(
model_checkpoint
)
model
=
AutoModelForSeq2SeqLM
.
from_pretrained
(
model_checkpoint
)
# 检查是否有多个 GPU 可用
if
torch
.
cuda
.
device_count
()
>
1
:
print
(
"Let's use"
,
torch
.
cuda
.
device_count
(),
"GPUs!"
)
# 如果有多个 GPUs,使用 nn.DataParallel 包装模型
model
=
nn
.
DataParallel
(
model
).
to
(
device
)
model
.
load_state_dict
(
torch
.
load
(
trained_model_weights
))
model
=
model
.
to
(
device
)
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment