models overhaul
This commit is contained in:
@ -24,16 +24,31 @@ class Config:
|
||||
self._setup_directories()
|
||||
|
||||
def _load_config(self) -> Dict[str, Any]:
|
||||
"""Load configuration from YAML file"""
|
||||
"""Load configuration from YAML files (config.yaml + models.yml)"""
|
||||
try:
|
||||
# Load main config
|
||||
if not self.config_path.exists():
|
||||
logger.warning(f"Config file {self.config_path} not found, using defaults")
|
||||
return self._get_default_config()
|
||||
|
||||
with open(self.config_path, 'r') as f:
|
||||
config = yaml.safe_load(f)
|
||||
|
||||
logger.info(f"Loaded configuration from {self.config_path}")
|
||||
config = self._get_default_config()
|
||||
else:
|
||||
with open(self.config_path, 'r') as f:
|
||||
config = yaml.safe_load(f)
|
||||
logger.info(f"Loaded main configuration from {self.config_path}")
|
||||
|
||||
# Load models config
|
||||
models_config_path = Path("models.yml")
|
||||
if models_config_path.exists():
|
||||
try:
|
||||
with open(models_config_path, 'r') as f:
|
||||
models_config = yaml.safe_load(f)
|
||||
# Merge models config into main config
|
||||
config.update(models_config)
|
||||
logger.info(f"Loaded models configuration from {models_config_path}")
|
||||
except Exception as e:
|
||||
logger.warning(f"Error loading models.yml: {e}, using main config only")
|
||||
else:
|
||||
logger.info("models.yml not found, using main config only")
|
||||
|
||||
return config
|
||||
|
||||
except Exception as e:
|
||||
|
@ -605,7 +605,9 @@ class TradingOrchestrator:
|
||||
|
||||
action_size = self.config.rl.get("action_space", 3)
|
||||
self.rl_agent = DQNAgent(
|
||||
state_shape=actual_state_size, n_actions=action_size
|
||||
state_shape=actual_state_size,
|
||||
n_actions=action_size,
|
||||
config=self.config.rl
|
||||
)
|
||||
self.rl_agent.to(self.device) # Move DQN agent to the determined device
|
||||
|
||||
|
Reference in New Issue
Block a user