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
change
sglang
Commits
4f118a39
Unverified
Commit
4f118a39
authored
Jan 25, 2025
by
Lianmin Zheng
Committed by
GitHub
Jan 25, 2025
Browse files
Fix repetition penalty (#3139)
parent
66283dbc
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
9 additions
and
8 deletions
+9
-8
.github/workflows/pr-test.yml
.github/workflows/pr-test.yml
+8
-8
python/sglang/srt/sampling/penaltylib/penalizers/repetition_penalty.py
.../srt/sampling/penaltylib/penalizers/repetition_penalty.py
+1
-0
No files found.
.github/workflows/pr-test.yml
View file @
4f118a39
...
@@ -29,7 +29,7 @@ concurrency:
...
@@ -29,7 +29,7 @@ concurrency:
jobs
:
jobs
:
unit-test-frontend
:
unit-test-frontend
:
if
:
github.repository == 'sgl-project/sglang' || github.event_name == 'pull_request'
if
:
(
github.repository == 'sgl-project/sglang' || github.event_name == 'pull_request'
) && github.event.pull_request.draft ==
false
runs-on
:
1-gpu-runner
runs-on
:
1-gpu-runner
steps
:
steps
:
-
name
:
Checkout code
-
name
:
Checkout code
...
@@ -50,7 +50,7 @@ jobs:
...
@@ -50,7 +50,7 @@ jobs:
python3 run_suite.py --suite per-commit
python3 run_suite.py --suite per-commit
unit-test-backend-1-gpu
:
unit-test-backend-1-gpu
:
if
:
github.repository == 'sgl-project/sglang' || github.event_name == 'pull_request'
if
:
(
github.repository == 'sgl-project/sglang' || github.event_name == 'pull_request'
) && github.event.pull_request.draft ==
false
runs-on
:
1-gpu-runner
runs-on
:
1-gpu-runner
strategy
:
strategy
:
matrix
:
matrix
:
...
@@ -77,7 +77,7 @@ jobs:
...
@@ -77,7 +77,7 @@ jobs:
unit-test-backend-2-gpu
:
unit-test-backend-2-gpu
:
if
:
github.repository == 'sgl-project/sglang' || github.event_name == 'pull_request'
if
:
(
github.repository == 'sgl-project/sglang' || github.event_name == 'pull_request'
) && github.event.pull_request.draft ==
false
runs-on
:
2-gpu-runner
runs-on
:
2-gpu-runner
steps
:
steps
:
-
name
:
Checkout code
-
name
:
Checkout code
...
@@ -114,7 +114,7 @@ jobs:
...
@@ -114,7 +114,7 @@ jobs:
python3 test_moe_ep.py
python3 test_moe_ep.py
performance-test-1-gpu-part-1
:
performance-test-1-gpu-part-1
:
if
:
github.repository == 'sgl-project/sglang' || github.event_name == 'pull_request'
if
:
(
github.repository == 'sgl-project/sglang' || github.event_name == 'pull_request'
) && github.event.pull_request.draft ==
false
runs-on
:
1-gpu-runner
runs-on
:
1-gpu-runner
steps
:
steps
:
-
name
:
Checkout code
-
name
:
Checkout code
...
@@ -158,7 +158,7 @@ jobs:
...
@@ -158,7 +158,7 @@ jobs:
performance-test-1-gpu-part-2
:
performance-test-1-gpu-part-2
:
if
:
github.repository == 'sgl-project/sglang' || github.event_name == 'pull_request'
if
:
(
github.repository == 'sgl-project/sglang' || github.event_name == 'pull_request'
) && github.event.pull_request.draft ==
false
runs-on
:
1-gpu-runner
runs-on
:
1-gpu-runner
steps
:
steps
:
-
name
:
Checkout code
-
name
:
Checkout code
...
@@ -189,7 +189,7 @@ jobs:
...
@@ -189,7 +189,7 @@ jobs:
python3 -m unittest test_bench_serving.TestBenchServing.test_offline_throughput_default_fp8
python3 -m unittest test_bench_serving.TestBenchServing.test_offline_throughput_default_fp8
performance-test-2-gpu
:
performance-test-2-gpu
:
if
:
github.repository == 'sgl-project/sglang' || github.event_name == 'pull_request'
if
:
(
github.repository == 'sgl-project/sglang' || github.event_name == 'pull_request'
) && github.event.pull_request.draft ==
false
runs-on
:
2-gpu-runner
runs-on
:
2-gpu-runner
steps
:
steps
:
-
name
:
Checkout code
-
name
:
Checkout code
...
@@ -227,7 +227,7 @@ jobs:
...
@@ -227,7 +227,7 @@ jobs:
accuracy-test-1-gpu
:
accuracy-test-1-gpu
:
if
:
github.repository == 'sgl-project/sglang' || github.event_name == 'pull_request'
if
:
(
github.repository == 'sgl-project/sglang' || github.event_name == 'pull_request'
) && github.event.pull_request.draft ==
false
runs-on
:
1-gpu-runner
runs-on
:
1-gpu-runner
steps
:
steps
:
-
name
:
Checkout code
-
name
:
Checkout code
...
@@ -251,7 +251,7 @@ jobs:
...
@@ -251,7 +251,7 @@ jobs:
accuracy-test-2-gpu
:
accuracy-test-2-gpu
:
if
:
github.repository == 'sgl-project/sglang' || github.event_name == 'pull_request'
if
:
(
github.repository == 'sgl-project/sglang' || github.event_name == 'pull_request'
) && github.event.pull_request.draft ==
false
runs-on
:
2-gpu-runner
runs-on
:
2-gpu-runner
steps
:
steps
:
-
name
:
Checkout code
-
name
:
Checkout code
...
...
python/sglang/srt/sampling/penaltylib/penalizers/repetition_penalty.py
View file @
4f118a39
...
@@ -67,6 +67,7 @@ class BatchedRepetitionPenalizer(_BatchedPenalizer):
...
@@ -67,6 +67,7 @@ class BatchedRepetitionPenalizer(_BatchedPenalizer):
def
_apply
(
self
,
logits
:
torch
.
Tensor
)
->
torch
.
Tensor
:
def
_apply
(
self
,
logits
:
torch
.
Tensor
)
->
torch
.
Tensor
:
apply_scaling_penalties
(
logits
,
self
.
cumulated_repetition_penalties
)
apply_scaling_penalties
(
logits
,
self
.
cumulated_repetition_penalties
)
return
logits
def
_filter
(
self
,
indices_to_keep
:
List
[
int
],
indices_tensor_to_keep
:
torch
.
Tensor
):
def
_filter
(
self
,
indices_to_keep
:
List
[
int
],
indices_tensor_to_keep
:
torch
.
Tensor
):
self
.
repetition_penalties
=
self
.
repetition_penalties
[
indices_tensor_to_keep
]
self
.
repetition_penalties
=
self
.
repetition_penalties
[
indices_tensor_to_keep
]
...
...
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