обновлен формат генерации датасета
This commit is contained in:
+1
-30
@@ -1,7 +1,6 @@
|
||||
from pathlib import Path
|
||||
from typing import Annotated, Literal
|
||||
|
||||
import yaml
|
||||
from pydantic import BaseModel, ConfigDict, Field
|
||||
|
||||
|
||||
@@ -31,36 +30,8 @@ LLMConfig = Annotated[
|
||||
|
||||
# Generation
|
||||
class GenerationConfig(ConfigModel):
|
||||
temperature: float = Field(default=.7,
|
||||
temperature: float | None = Field(default=None,
|
||||
ge=.0,
|
||||
le=2.0)
|
||||
max_tokens: int = Field(default=4096,
|
||||
gt=0)
|
||||
|
||||
|
||||
# Runtime
|
||||
class RuntimeConfig(ConfigModel):
|
||||
concurrency: int = Field(ge=1, default=1)
|
||||
|
||||
# Prompts
|
||||
class PromptsConfig(ConfigModel):
|
||||
instructions: str
|
||||
system: str
|
||||
user: str
|
||||
|
||||
# Application
|
||||
class AppConfig(ConfigModel):
|
||||
llm: LLMConfig
|
||||
generation: GenerationConfig = GenerationConfig()
|
||||
runtime: RuntimeConfig = RuntimeConfig()
|
||||
prompts: PromptsConfig
|
||||
|
||||
|
||||
# Loader
|
||||
def load_config(path: str | Path = "config.yaml") -> AppConfig:
|
||||
path = Path(path)
|
||||
|
||||
with path.open("r", encoding="utf-8") as file:
|
||||
data = yaml.safe_load(file)
|
||||
|
||||
return AppConfig.model_validate(data)
|
||||
Reference in New Issue
Block a user