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
709e121c
Commit
709e121c
authored
Jul 18, 2023
by
RichardoLuo
Committed by
binmakeswell
Jul 26, 2023
Browse files
[NFC] polish applications/Chat/coati/models/generation.py code style (#4275)
parent
dc1b6127
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
6 additions
and
7 deletions
+6
-7
applications/Chat/coati/models/generation.py
applications/Chat/coati/models/generation.py
+6
-7
No files found.
applications/Chat/coati/models/generation.py
View file @
709e121c
...
@@ -5,7 +5,6 @@ import torch.distributed as dist
...
@@ -5,7 +5,6 @@ import torch.distributed as dist
import
torch.nn
as
nn
import
torch.nn
as
nn
import
torch.nn.functional
as
F
import
torch.nn.functional
as
F
try
:
try
:
from
transformers.generation_logits_process
import
(
from
transformers.generation_logits_process
import
(
LogitsProcessorList
,
LogitsProcessorList
,
...
@@ -148,12 +147,12 @@ def generate(model: nn.Module,
...
@@ -148,12 +147,12 @@ def generate(model: nn.Module,
@
torch
.
no_grad
()
@
torch
.
no_grad
()
def
generate_with_actor
(
actor_model
:
nn
.
Module
,
def
generate_with_actor
(
input_ids
:
torch
.
Tensor
,
actor_model
:
nn
.
Module
,
return_action_mask
:
bool
=
True
,
input_ids
:
torch
.
Tensor
,
**
kwargs
return_action_mask
:
bool
=
True
,
)
->
Union
[
Tuple
[
torch
.
LongTensor
,
torch
.
LongTensor
],
**
kwargs
Tuple
[
torch
.
LongTensor
,
torch
.
LongTensor
,
torch
.
BoolTensor
]]:
)
->
Union
[
Tuple
[
torch
.
LongTensor
,
torch
.
LongTensor
],
Tuple
[
torch
.
LongTensor
,
torch
.
LongTensor
,
torch
.
BoolTensor
]]:
"""Generate token sequence with actor model. Refer to `generate` for more details.
"""Generate token sequence with actor model. Refer to `generate` for more details.
"""
"""
# generate sequences
# generate sequences
...
...
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