refactor: 优化参数传递,清理导入样式

This commit is contained in:
2026-04-03 22:06:32 +08:00
parent 3a7d98a950
commit 0852b852f8
51 changed files with 299 additions and 434 deletions
+4 -5
View File
@@ -1,16 +1,15 @@
from astrai.inference.core import (
GeneratorCore,
EmbeddingEncoderCore,
GeneratorCore,
KVCacheManager,
)
from astrai.inference.generator import (
GenerationRequest,
LoopGenerator,
StreamGenerator,
BatchGenerator,
EmbeddingEncoder,
GenerationRequest,
GeneratorFactory,
LoopGenerator,
StreamGenerator,
)
__all__ = [
+4 -3
View File
@@ -1,8 +1,9 @@
import torch
from typing import Any, Callable, List, Optional, Self, Tuple, Union
import torch
from torch import Tensor
from typing import Any, Callable, List, Tuple, Union, Optional, Self
from astrai.config import ModelParameter, ModelConfig
from astrai.config import ModelConfig, ModelParameter
def apply_sampling_strategies(
+6 -5
View File
@@ -1,10 +1,11 @@
import torch
from dataclasses import dataclass
from torch import Tensor
from typing import List, Tuple, Union, Optional, Generator
from astrai.inference.core import GeneratorCore, EmbeddingEncoderCore, KVCacheManager
from astrai.config.param_config import ModelParameter
from typing import Generator, List, Optional, Tuple, Union
import torch
from torch import Tensor
from astrai.config.param_config import ModelParameter
from astrai.inference.core import EmbeddingEncoderCore, GeneratorCore, KVCacheManager
HistoryType = List[Tuple[str, str]]
+6 -4
View File
@@ -1,13 +1,15 @@
import torch
import uvicorn
import logging
from pathlib import Path
from typing import List, Optional, Dict, Any, Tuple
from typing import Any, Dict, List, Optional, Tuple
import torch
import uvicorn
from fastapi import FastAPI, HTTPException
from fastapi.responses import StreamingResponse
from pydantic import BaseModel, Field
from astrai.config.param_config import ModelParameter
from astrai.inference.generator import GeneratorFactory, GenerationRequest
from astrai.inference.generator import GenerationRequest, GeneratorFactory
logger = logging.getLogger(__name__)