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
OpenDAS
ColossalAI
Commits
b9231390
Unverified
Commit
b9231390
authored
Apr 05, 2023
by
Yuanchen
Committed by
GitHub
Apr 05, 2023
Browse files
fix save_model indent error in ppo trainer (#3450)
Co-authored-by:
Yuanchen Xu
<
yuanchen.xu00@gmail.com
>
parent
ffcdbf0f
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
3 additions
and
4 deletions
+3
-4
applications/Chat/coati/trainer/ppo.py
applications/Chat/coati/trainer/ppo.py
+3
-4
No files found.
applications/Chat/coati/trainer/ppo.py
View file @
b9231390
...
...
@@ -117,6 +117,9 @@ class PPOTrainer(Trainer):
return
{
'reward'
:
experience
.
reward
.
mean
().
item
()}
def
save_model
(
self
,
path
:
str
,
only_rank0
:
bool
=
False
,
tokenizer
:
Optional
[
PreTrainedTokenizerBase
]
=
None
)
->
None
:
self
.
strategy
.
save_model
(
model
=
self
.
actor
,
path
=
path
,
only_rank0
=
only_rank0
,
tokenizer
=
tokenizer
)
def
_set_default_generate_kwargs
(
strategy
:
Strategy
,
generate_kwargs
:
dict
,
actor
:
Actor
)
->
None
:
origin_model
=
strategy
.
_unwrap_actor
(
actor
)
...
...
@@ -129,7 +132,3 @@ def _set_default_generate_kwargs(strategy: Strategy, generate_kwargs: dict, acto
new_kwargs
[
'update_model_kwargs_fn'
]
=
update_model_kwargs_fn
return
new_kwargs
def
save_model
(
self
,
path
:
str
,
only_rank0
:
bool
=
False
,
tokenizer
:
Optional
[
PreTrainedTokenizerBase
]
=
None
)
->
None
:
self
.
strategy
.
save_model
(
model
=
self
.
actor
,
path
=
path
,
only_rank0
=
only_rank0
,
tokenizer
=
tokenizer
)
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