Cascade Bot commited on
Commit
276480b
·
1 Parent(s): 4e9058a

fix: update model manager initialization

Browse files

- Added optional model_dir parameter to ModelManager
- Updated LocalLLMStrategy to pass model_dir correctly
- Fixed TypeError in ModelManager.__init__()

reasoning/local_llm.py CHANGED
@@ -17,8 +17,9 @@ class LocalLLMStrategy(ReasoningStrategy):
17
  super().__init__()
18
  self.config = config or {}
19
 
20
- # Initialize model manager
21
- self.model_manager = ModelManager(self.config.get('model_dir', "models"))
 
22
 
23
  # Standard reasoning parameters
24
  self.min_confidence = self.config.get('min_confidence', 0.7)
 
17
  super().__init__()
18
  self.config = config or {}
19
 
20
+ # Initialize model manager with model_dir from config
21
+ model_dir = self.config.get('model_dir')
22
+ self.model_manager = ModelManager(model_dir)
23
 
24
  # Standard reasoning parameters
25
  self.min_confidence = self.config.get('min_confidence', 0.7)
reasoning/model_manager.py CHANGED
@@ -30,9 +30,9 @@ class ModelConfig:
30
  class ModelManager:
31
  """Manages multiple LLM models for different tasks in Spaces."""
32
 
33
- def __init__(self):
34
  # In Spaces, models are stored in the cache directory
35
- self.model_dir = os.getenv('SPACE_CACHE_DIR', '/tmp/models')
36
  self.models: Dict[str, Llama] = {}
37
  self.logger = logging.getLogger(__name__)
38
 
 
30
  class ModelManager:
31
  """Manages multiple LLM models for different tasks in Spaces."""
32
 
33
+ def __init__(self, model_dir: Optional[str] = None):
34
  # In Spaces, models are stored in the cache directory
35
+ self.model_dir = model_dir or os.getenv('SPACE_CACHE_DIR', '/tmp/models')
36
  self.models: Dict[str, Llama] = {}
37
  self.logger = logging.getLogger(__name__)
38