Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
OpenDAS
vllm_cscc
Commits
a7be4d00
"vscode:/vscode.git/clone" did not exist on "695e7adcd22c25b859a6d4b3af99617aaf425708"
Unverified
Commit
a7be4d00
authored
May 12, 2024
by
Swapnil Parekh
Committed by
GitHub
May 12, 2024
Browse files
[CORE] Improvement in ranks code (#4718)
parent
a709e87a
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
3 additions
and
1 deletion
+3
-1
vllm/model_executor/layers/sampler.py
vllm/model_executor/layers/sampler.py
+3
-1
No files found.
vllm/model_executor/layers/sampler.py
View file @
a7be4d00
...
@@ -681,7 +681,9 @@ def _get_ranks(x: torch.Tensor, indices: torch.Tensor) -> torch.Tensor:
...
@@ -681,7 +681,9 @@ def _get_ranks(x: torch.Tensor, indices: torch.Tensor) -> torch.Tensor:
"""
"""
vals
=
x
[
torch
.
arange
(
0
,
len
(
x
),
device
=
x
.
device
,
dtype
=
indices
.
dtype
),
vals
=
x
[
torch
.
arange
(
0
,
len
(
x
),
device
=
x
.
device
,
dtype
=
indices
.
dtype
),
indices
]
indices
]
return
(
x
>
vals
[:,
None
]).
long
().
sum
(
1
).
add_
(
1
)
result
=
(
x
>
vals
[:,
None
])
del
vals
return
result
.
sum
(
1
).
add_
(
1
)
def
_get_logprobs
(
def
_get_logprobs
(
...
...
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