-
Notifications
You must be signed in to change notification settings - Fork 72
Expand file tree
/
Copy pathengine_config.py
More file actions
47 lines (43 loc) · 1.77 KB
/
Copy pathengine_config.py
File metadata and controls
47 lines (43 loc) · 1.77 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
from dataclasses import dataclass
from typing import Optional
from infinilm.config.kv_transfer import KVTransferConfig
@dataclass
class EngineConfig:
"""Configuration for LLM Engine.
Attributes:
model_path: Path to the model directory.
device: Device type string ('cpu', 'cuda', 'mlu', etc.).
dtype: Data type string ('float16', 'bfloat16', 'float32').
tensor_parallel_size: Number of devices for tensor parallelism.
cache_type: Cache type ('paged' or 'static').
max_batch_size: Maximum batch size for inference (only for paged cache).
max_tokens: Default maximum tokens to generate.
num_blocks: Number of KV cache blocks (only for paged cache).
block_size: Size of each KV cache block (only for paged cache).
max_cache_len: Maximum sequence length (only for static cache).
temperature: Default sampling temperature.
top_p: Default top-p sampling parameter.
top_k: Default top-k sampling parameter.
enable_graph: Whether to enable graph compiling.
attn_backend: Attention backend to use ('default', 'flash-attn').
skip_load: Whether to skip loading model weights (for testing).
"""
model_path: str
device: str = "cuda"
dtype: str = "float16"
tensor_parallel_size: int = 1
cache_type: str = "paged" # "paged" or "static"
max_batch_size: int = 16
max_tokens: int = 4096
num_blocks: int = 512
block_size: int = 256
max_cache_len: int = 4096
temperature: float = 1.0
top_p: float = 0.8
top_k: int = 1
enable_graph: bool = False
enable_chunk_prefill_graph: bool = False
chunk_size: int = 0
attn_backend: str = "default"
skip_load: bool = False
kv_transfer_config: Optional[KVTransferConfig] = None