Update config/config.py
Browse files- config/config.py +37 -1
config/config.py
CHANGED
|
@@ -1,4 +1,40 @@
|
|
| 1 |
-
# config/config.py
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 2 |
from pydantic_settings import BaseSettings
|
| 3 |
from pathlib import Path
|
| 4 |
import torch
|
|
|
|
| 1 |
+
# config/config.py
|
| 2 |
+
|
| 3 |
+
from dataclasses import dataclass, field
|
| 4 |
+
from enum import Enum
|
| 5 |
+
from typing import Dict, Any, Optional
|
| 6 |
+
|
| 7 |
+
class GenerationStrategy(str, Enum):
|
| 8 |
+
DEFAULT = "default"
|
| 9 |
+
MAJORITY_VOTING = "majority_voting"
|
| 10 |
+
BEST_OF_N = "best_of_n"
|
| 11 |
+
BEAM_SEARCH = "beam_search"
|
| 12 |
+
DVTS = "dvts"
|
| 13 |
+
COT = "chain_of_thought"
|
| 14 |
+
REACT = "react"
|
| 15 |
+
|
| 16 |
+
@dataclass
|
| 17 |
+
class ModelConfig:
|
| 18 |
+
model_kwargs: Dict[str, Any] = field(default_factory=dict)
|
| 19 |
+
tokenizer_kwargs: Dict[str, Any] = field(default_factory=dict)
|
| 20 |
+
quantization_kwargs: Dict[str, Any] = field(default_factory=dict)
|
| 21 |
+
|
| 22 |
+
@dataclass
|
| 23 |
+
class GenerationConfig:
|
| 24 |
+
num_samples: int = 5
|
| 25 |
+
depth: int = 3
|
| 26 |
+
breadth: int = 2
|
| 27 |
+
max_history_turns: int = 1
|
| 28 |
+
max_new_tokens: int = 50
|
| 29 |
+
temperature: float = 0.7
|
| 30 |
+
top_p: float = 0.9
|
| 31 |
+
top_k: int = 50
|
| 32 |
+
repetition_penalty: float = 1.1
|
| 33 |
+
length_penalty: float = 1.0
|
| 34 |
+
do_sample: bool = True
|
| 35 |
+
strategy: GenerationStrategy = GenerationStrategy.DEFAULT
|
| 36 |
+
|
| 37 |
+
#####
|
| 38 |
from pydantic_settings import BaseSettings
|
| 39 |
from pathlib import Path
|
| 40 |
import torch
|