Skip to content

Conversation

@wangxiyuan
Copy link
Collaborator

@wangxiyuan wangxiyuan commented Jul 28, 2025

Refactor Sampler implementation from patch way to inherit from vLLM Sampler interface.

Next step: Make the op TopKTopPSampler in vLLM support custom ops register mechanism

@wangxiyuan
Copy link
Collaborator Author

@Pr0Wh1teGivee please help review. Thanks.

@codecov
Copy link

codecov bot commented Jul 28, 2025

Codecov Report

❌ Patch coverage is 64.40678% with 21 lines in your changes missing coverage. Please review.
✅ Project coverage is 73.80%. Comparing base (0190b68) to head (81d6a67).
⚠️ Report is 620 commits behind head on main.

Files with missing lines Patch % Lines
vllm_ascend/sample/sampler.py 43.24% 21 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main    #2050      +/-   ##
==========================================
- Coverage   73.83%   73.80%   -0.03%     
==========================================
  Files          96       96              
  Lines       10865    10899      +34     
==========================================
+ Hits         8022     8044      +22     
- Misses       2843     2855      +12     
Flag Coverage Δ
unittests 73.80% <64.40%> (-0.03%) ⬇️

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@Pr0Wh1teGivee
Copy link
Contributor

LGTM

Comment on lines +27 to +31
probs = logits.softmax(dim=-1)
probs_sort, _ = probs.sort(dim=-1, descending=False)
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Unrelated: it seems probs and probs_sort compution are ununsed if p is None and k is None, the logits can return directly.

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done

@github-actions
Copy link

This pull request has conflicts, please resolve those before we can evaluate the pull request.

1 similar comment
@github-actions
Copy link

This pull request has conflicts, please resolve those before we can evaluate the pull request.

else:
from vllm.v1.sample.sampler import Sampler

self.sampler = Sampler()
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can it take effect directly by removing the flag?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

yes, I hope so. Let's have a fully test to ensure ascend sampler is stable enough. Then we can remove the flag

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I set the value to True to enable ascend sampler by default now.

Signed-off-by: wangxiyuan <wangxiyuan1007@gmail.com>
@wangxiyuan wangxiyuan merged commit 9b67c87 into vllm-project:main Jul 30, 2025
25 checks passed
weijinqian0 pushed a commit to weijinqian0/vllm-ascend that referenced this pull request Jul 30, 2025
Refactor Sampler implementation from patch way to inherit from vLLM
Sampler interface.

Next step: Make the op `TopKTopPSampler` in vLLM support custom ops
register mechanism

- vLLM version: v0.10.0
- vLLM main:
vllm-project/vllm@61a6905

Signed-off-by: wangxiyuan <wangxiyuan1007@gmail.com>
weijinqian0 pushed a commit to weijinqian0/vllm-ascend that referenced this pull request Jul 30, 2025
Refactor Sampler implementation from patch way to inherit from vLLM
Sampler interface.

Next step: Make the op `TopKTopPSampler` in vLLM support custom ops
register mechanism

- vLLM version: v0.10.0
- vLLM main:
vllm-project/vllm@61a6905

Signed-off-by: wangxiyuan <wangxiyuan1007@gmail.com>
Signed-off-by: weijinqian_v1 <weijinqian@huawei.com>
@wangxiyuan wangxiyuan deleted the refactor_sampler branch September 4, 2025 06:52
chopper0126 pushed a commit to chopper0126/vllm-ascend that referenced this pull request Sep 26, 2025
Refactor Sampler implementation from patch way to inherit from vLLM
Sampler interface.

Next step: Make the op `TopKTopPSampler` in vLLM support custom ops
register mechanism

- vLLM version: v0.10.0
- vLLM main:
vllm-project/vllm@61a6905

Signed-off-by: wangxiyuan <wangxiyuan1007@gmail.com>
Angazenn pushed a commit to Angazenn/vllm-ascend that referenced this pull request Oct 21, 2025
Refactor Sampler implementation from patch way to inherit from vLLM
Sampler interface.

Next step: Make the op `TopKTopPSampler` in vLLM support custom ops
register mechanism

- vLLM version: v0.10.0
- vLLM main:
vllm-project/vllm@61a6905

Signed-off-by: wangxiyuan <wangxiyuan1007@gmail.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants