refactor: 设计模式优化 inference 模块导入结构
- 新建 cache.py:SlotAllocator 对象池 + PrefixCacheManager - 新建 sampling.py:Temperature/TopK/TopP 可组合策略 - TaskStatus 改用 Enum,GenerationParams 值对象模式 - _STOP 移至 cache.py,解除 engine→scheduler 轻量耦合 - 更新测试导入路径,ruff 格式检查通过
This commit is contained in:
@@ -15,7 +15,7 @@ def chat():
|
||||
tokenizer = AutoTokenizer.from_pretrained(PARAMETER_ROOT)
|
||||
model.to(device="cuda", dtype=torch.bfloat16)
|
||||
|
||||
messages = []
|
||||
messages = [{"role": "system", "content": "You are a helpful assistant."}]
|
||||
engine = InferenceEngine(model=model, tokenizer=tokenizer)
|
||||
|
||||
while True:
|
||||
|
||||
Reference in New Issue
Block a user