ref(upstream): FULL TREE — Deep-Spark xllm (1470) + ds_vllm csrc/models (703)
Replaces cherry-picked upstream_ref with complete source trees. xllm/ — Iluvatar official C++ inference engine (15MB, 1470 files) Complete: kernels → layers → models → runtime → scheduler → api Excluded: .git, binary images, third_party submodule checkouts ds_vllm/ — Iluvatar official vllm fork (8MB, 703 files) Included: csrc/ (ALL CUDA kernels), fused_moe/, qwen3_5 model, _custom_ops Excluded: tests, benchmarks, docs, examples (not needed for reference) Critical call chains now fully traceable: MoE: moe_topk_softmax_kernels.cuh → ixformer.h → fused_moe.cpp → layer GDN: qwen3_gated_delta_net_base.cpp → qwen3_5_gated_delta_net.cpp Attention: ixformer.h → xllm_paged_attention → attention.cpp
This commit is contained in:
29
upstream_ref/xllm/examples/generate_beam_search.py
Normal file
29
upstream_ref/xllm/examples/generate_beam_search.py
Normal file
@@ -0,0 +1,29 @@
|
||||
# python examples/beam_search.py --model='/path/models/Qwen2-7B-Instruct' --devices='npu:0'
|
||||
# python beam_search.py --model='/path/models/Qwen2-7B-Instruct' --devices='npu:0,npu:1'
|
||||
|
||||
from xllm import ArgumentParser, BeamSearchParams, LLM
|
||||
|
||||
# Create an LLM.
|
||||
parser = ArgumentParser()
|
||||
llm = LLM(**vars(parser.parse_args()))
|
||||
|
||||
beam_search_params = BeamSearchParams(
|
||||
beam_width=2,
|
||||
max_tokens=20,
|
||||
)
|
||||
|
||||
outputs = llm.beam_search(
|
||||
[
|
||||
{"prompt": "Hello, my name is "},
|
||||
{"prompt": "The president of the United States is "},
|
||||
{"prompt": "The capital of France is "},
|
||||
{"prompt": "The future of AI is "}
|
||||
],
|
||||
params=beam_search_params,
|
||||
)
|
||||
|
||||
for output in outputs:
|
||||
generated_text = output.sequences[0].text
|
||||
print(f"Generated text: {generated_text!r}")
|
||||
|
||||
llm.finish()
|
||||
Reference in New Issue
Block a user