Spaces:
Build error
Build error
| # config/config.py | |
| from dataclasses import dataclass, field | |
| from enum import Enum | |
| from typing import Dict, Any, Optional | |
| class GenerationStrategy(str, Enum): | |
| DEFAULT = "default" | |
| MAJORITY_VOTING = "majority_voting" | |
| BEST_OF_N = "best_of_n" | |
| BEAM_SEARCH = "beam_search" | |
| DVTS = "dvts" | |
| COT = "chain_of_thought" | |
| REACT = "react" | |
| class ModelConfig: | |
| model_kwargs: Dict[str, Any] = field(default_factory=dict) | |
| tokenizer_kwargs: Dict[str, Any] = field(default_factory=dict) | |
| quantization_kwargs: Dict[str, Any] = field(default_factory=dict) | |
| class GenerationConfig: | |
| num_samples: int = 5 | |
| depth: int = 3 | |
| breadth: int = 2 | |
| max_history_turns: int = 1 | |
| max_new_tokens: int = 50 | |
| temperature: float = 0.7 | |
| top_p: float = 0.9 | |
| top_k: int = 50 | |
| repetition_penalty: float = 1.1 | |
| length_penalty: float = 1.0 | |
| do_sample: bool = True | |
| strategy: GenerationStrategy = GenerationStrategy.DEFAULT | |
| ##### | |
| from pydantic_settings import BaseSettings | |
| from pathlib import Path | |
| import torch | |
| class Settings(BaseSettings): | |
| secret_key: str | |
| api_key: str | |
| MODEL_NAME: str = "meta-llama/Llama-3.2-3B-Instruct" | |
| EMBEDDER_MODEL: str = "distiluse-base-multilingual-cased" | |
| CHUNK_SIZE: int = 1000 | |
| CHUNK_OVERLAP: int = 100 | |
| CSV_URL: str = 'https://www.bofrost.de/datafeed/DE/products.csv' | |
| PDF_FOLDER: Path = Path("./pdfs") | |
| DEVICE: str = "cuda" if torch.cuda.is_available() else "cpu" | |
| QUANTIZATION_BITS: int = 8 | |
| FAQ_ROOT_URL: str = "https://www.bofrost.de/faq/" | |
| CACHE_DURATION: int = 3600 | |
| MAX_RETRIES: int = 3 | |
| TIMEOUT: int = 30 | |
| class Config: | |
| extra = "allow" # This allows additional fields beyond those defined in the class | |
| env_file = ".env" | |
| settings = Settings() | |