Datasets:
Download code/schemas/config.py from govtech/municipalbench-full: direct link, hf CLI and curl.
- Browser
- Download file 1.24 kB
-
https://huggingface.co/datasets/govtech/municipalbench-full/resolve/main/code/schemas/config.py
- Command line
-
hf download hf://datasets/govtech/municipalbench-full/code/schemas/config.py
-
curl -L -o config.py https://huggingface.co/datasets/govtech/municipalbench-full/resolve/main/code/schemas/config.py
1.24 kB
| """Runtime configuration schemas for model adapters.""" | |
| from typing import Any | |
| from pydantic import BaseModel, Field | |
| class GenerationConfig(BaseModel): | |
| """Parameters controlling text/token generation for models.""" | |
| max_new_tokens: int = Field(default=512, ge=1) | |
| temperature: float = Field(default=0.0, ge=0.0) | |
| top_p: float = Field(default=1.0, ge=0.0, le=1.0) | |
| top_k: int | None = Field(default=None, ge=0) | |
| do_sample: bool = Field(default=False) | |
| extra: dict[str, Any] = Field(default_factory=dict) | |
| class PromptConfig(BaseModel): | |
| """Parameters for prompt preparation and template formatting.""" | |
| image_token: str = Field(default="<|image|>") | |
| add_generation_prompt: bool = Field(default=True) | |
| system_prompt: str | None = Field(default=None) | |
| extra: dict[str, Any] = Field(default_factory=dict) | |
| class ModelRuntimeConfig(BaseModel): | |
| """Runtime configuration contract for model adapters.""" | |
| model_name: str | |
| model_id: str | |
| device: str | None = None | |
| dtype: str | None = None | |
| generation: GenerationConfig = Field(default_factory=GenerationConfig) | |
| prompt: PromptConfig = Field(default_factory=PromptConfig) | |
| extra_kwargs: dict[str, Any] = Field(default_factory=dict) | |