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
7851b451
Unverified
Commit
7851b451
authored
Nov 18, 2024
by
youkaichao
Committed by
GitHub
Nov 18, 2024
Browse files
[5/N][torch.compile] torch.jit.script --> torch.compile (#10406)
Signed-off-by:
youkaichao
<
youkaichao@gmail.com
>
parent
4186be81
Changes
4
Show whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
6 additions
and
6 deletions
+6
-6
vllm/model_executor/layers/rejection_sampler.py
vllm/model_executor/layers/rejection_sampler.py
+1
-1
vllm/model_executor/layers/vocab_parallel_embedding.py
vllm/model_executor/layers/vocab_parallel_embedding.py
+2
-2
vllm/model_executor/models/phi3_small.py
vllm/model_executor/models/phi3_small.py
+2
-2
vllm/worker/model_runner.py
vllm/worker/model_runner.py
+1
-1
No files found.
vllm/model_executor/layers/rejection_sampler.py
View file @
7851b451
...
...
@@ -368,7 +368,7 @@ class RejectionSampler(SpecDecodeStochasticBaseSampler):
# Note that we always sample with replacement.
# probs will be modified in place, but this is fine, as we pass
# in a copy already.
@
torch
.
jit
.
script
@
torch
.
compile
(
dynamic
=
True
)
def
_multinomial
(
probs
:
torch
.
Tensor
,
num_samples
:
int
,
...
...
vllm/model_executor/layers/vocab_parallel_embedding.py
View file @
7851b451
...
...
@@ -133,13 +133,13 @@ class VocabParallelEmbeddingShardIndices:
assert
self
.
num_added_elements
<=
self
.
num_added_elements_padded
@
torch
.
jit
.
script
@
torch
.
compile
(
dynamic
=
True
)
def
get_masked_input_and_mask
(
input_
:
torch
.
Tensor
,
org_vocab_start_index
:
int
,
org_vocab_end_index
:
int
,
num_org_vocab_padding
:
int
,
added_vocab_start_index
:
int
,
added_vocab_end_index
:
int
)
->
Tuple
[
torch
.
Tensor
,
torch
.
Tensor
]:
# torch.
jit.script
will fuse all of the pointwise ops below
# torch.
compile
will fuse all of the pointwise ops below
# into a single kernel, making it very fast
org_vocab_mask
=
(
input_
>=
org_vocab_start_index
)
&
(
input_
<
org_vocab_end_index
)
...
...
vllm/model_executor/models/phi3_small.py
View file @
7851b451
...
...
@@ -54,12 +54,12 @@ class HeadMajorColumnParallelLinear(MergedColumnParallelLinear):
return
load_column_parallel_weight
(
param
,
loaded_weight
)
@
torch
.
jit
.
script
@
torch
.
compile
(
dynamic
=
True
)
def
quick_gelu
(
x
):
return
x
*
torch
.
sigmoid
(
1.702
*
x
)
@
torch
.
jit
.
script
@
torch
.
compile
(
dynamic
=
True
)
def
gegelu
(
input
,
limit
:
Optional
[
float
]
=
None
):
a_gelu
,
a_linear
=
input
[...,
::
2
],
input
[...,
1
::
2
]
if
limit
is
not
None
:
...
...
vllm/worker/model_runner.py
View file @
7851b451
...
...
@@ -1769,7 +1769,7 @@ class CUDAGraphRunner(nn.Module):
# Run the model a few times without capturing the graph.
# This is to make sure that the captured graph does not include the
# kernel launches for initial benchmarking (e.g., Triton autotune).
# Note one iteration is not enough for torch.
jit.script
# Note one iteration is not enough for torch.
compile
for
_
in
range
(
_NUM_WARMUP_ITERS
):
self
.
model
(
input_ids
=
input_ids
,
...
...
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