refactor: 优化参数传递,清理导入样式
This commit is contained in:
@@ -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__ = [
|
||||
|
||||
@@ -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(
|
||||
|
||||
@@ -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]]
|
||||
|
||||
|
||||
@@ -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__)
|
||||
|
||||
|
||||
Reference in New Issue
Block a user