Coverage for / home / jenkins / .local / lib / python3.10 / site-packages / hyper_parallel / infer / __init__.py: 0%
6 statements
« prev ^ index » next coverage.py v7.13.1, created at 2026-07-06 05:41 +0800
« prev ^ index » next coverage.py v7.13.1, created at 2026-07-06 05:41 +0800
1# Copyright 2026 Huawei Technologies Co., Ltd
2#
3# Licensed under the Apache License, Version 2.0 (the "License");
4# you may not use this file except in compliance with the License.
5# You may obtain a copy of the License at
6#
7# http://www.apache.org/licenses/LICENSE-2.0
8#
9# Unless required by applicable law or agreed to in writing, software
10# distributed under the License is distributed on an "AS IS" BASIS,
11# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12# See the License for the specific language governing permissions and
13# limitations under the License.
14# ============================================================================
15"""Autoregressive generation utilities."""
17from hyper_parallel.infer.generation import generate
18from hyper_parallel.infer.kv_cache import (
19 ContextParallelKVCache,
20 KVCache,
21 SequenceShardInfo,
22 get_sequence_shard_info,
23 shard_past_key_values,
24)
25from hyper_parallel.infer.mixin import GenerateMixin
26from hyper_parallel.infer.sampler import (
27 apply_repetition_penalty,
28 greedy_sample,
29 sample_next_token,
30 top_k_sample,
31 top_p_sample,
32)
33from hyper_parallel.infer.utils import (
34 GenerationConfig,
35 apply_logits_processors,
36 build_causal_mask,
37 build_position_ids,
38 gather_context_parallel_logits,
39 gather_tensor_parallel_logits,
40 prepare_logits_for_sampling,
41 should_stop_generation,
42)
44__all__ = [
45 "GenerationConfig",
46 "GenerateMixin",
47 "KVCache",
48 "ContextParallelKVCache",
49 "SequenceShardInfo",
50 "apply_logits_processors",
51 "apply_repetition_penalty",
52 "build_causal_mask",
53 "build_position_ids",
54 "gather_context_parallel_logits",
55 "gather_tensor_parallel_logits",
56 "get_sequence_shard_info",
57 "generate",
58 "greedy_sample",
59 "prepare_logits_for_sampling",
60 "sample_next_token",
61 "shard_past_key_values",
62 "should_stop_generation",
63 "top_k_sample",
64 "top_p_sample",
65]