Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 2 additions & 8 deletions autobot-backend/ai_hardware_accelerator.py
Original file line number Diff line number Diff line change
Expand Up @@ -622,13 +622,10 @@ def _initialize_clip_model(self, device: Any) -> None:
torch = _get_torch()

# HuggingFace model loaded by name; revision pinning managed operationally.
self.clip_processor = CLIPProcessor.from_pretrained( # nosec B615
"openai/clip-vit-base-patch32", resume_download=True
)
self.clip_processor = CLIPProcessor.from_pretrained("openai/clip-vit-base-patch32") # nosec B615
self.clip_model = CLIPModel.from_pretrained( # nosec B615
"openai/clip-vit-base-patch32",
torch_dtype=(torch.float16 if torch.cuda.is_available() else torch.float32),
resume_download=True,
).to(device)
self.clip_model.eval()

Expand All @@ -641,13 +638,10 @@ def _initialize_wav2vec_model(self, device: Any) -> None:
torch = _get_torch()

# HuggingFace model loaded by name; revision pinning managed operationally.
self.wav2vec_processor = Wav2Vec2Processor.from_pretrained( # nosec B615
"facebook/wav2vec2-base-960h", resume_download=True
)
self.wav2vec_processor = Wav2Vec2Processor.from_pretrained("facebook/wav2vec2-base-960h") # nosec B615
self.wav2vec_model = Wav2Vec2Model.from_pretrained( # nosec B615
"facebook/wav2vec2-base-960h",
torch_dtype=(torch.float16 if torch.cuda.is_available() else torch.float32),
resume_download=True,
).to(device)
self.wav2vec_model.eval()

Expand Down
4 changes: 2 additions & 2 deletions autobot-backend/code_embedding_generator.py
Original file line number Diff line number Diff line change
Expand Up @@ -121,9 +121,9 @@ def _load_sync():
from transformers import AutoModel, AutoTokenizer

# HuggingFace model loaded by name; revision pinning managed operationally.
self.tokenizer = AutoTokenizer.from_pretrained(self.model_name, resume_download=True) # nosec B615
self.tokenizer = AutoTokenizer.from_pretrained(self.model_name) # nosec B615
# HuggingFace model loaded by name; revision pinning managed operationally.
self.model = AutoModel.from_pretrained(self.model_name, resume_download=True) # nosec B615
self.model = AutoModel.from_pretrained(self.model_name) # nosec B615

if self.npu_available:
self._convert_to_openvino()
Expand Down
4 changes: 2 additions & 2 deletions autobot-backend/llm_shared/optimization/layer_inference.py
Original file line number Diff line number Diff line change
Expand Up @@ -195,7 +195,7 @@ def load_model_config(self, model_name: str) -> Dict[str, Any]:

logger.debug("Loading model config for %s", model_name)
# HuggingFace model loaded by name; revision pinning managed operationally.
auto_cfg = AutoConfig.from_pretrained(model_name, resume_download=True, **kwargs) # nosec B615
auto_cfg = AutoConfig.from_pretrained(model_name, **kwargs) # nosec B615
cfg_dict: Dict[str, Any] = auto_cfg.to_dict()
logger.info(
"Loaded model config for %s: arch=%s",
Expand Down Expand Up @@ -562,7 +562,7 @@ def _load_tokeniser(self, AutoTokenizer: Any) -> Any:
if self._config.cache_dir:
kwargs["cache_dir"] = self._config.cache_dir
# HuggingFace model loaded by name; revision pinning managed operationally.
return AutoTokenizer.from_pretrained(self._config.model_name, resume_download=True, **kwargs) # nosec B615
return AutoTokenizer.from_pretrained(self._config.model_name, **kwargs) # nosec B615

def _resolve_checkpoint_path(self) -> str:
"""Return the checkpoint path for the configured model.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -264,7 +264,7 @@ def _inspect_via_config(model_name: str) -> ModelInfo | None:

try:
# HuggingFace model loaded by name; revision pinning managed operationally.
cfg = transformers.AutoConfig.from_pretrained(model_name, resume_download=True) # nosec B615
cfg = transformers.AutoConfig.from_pretrained(model_name) # nosec B615
param_count = _count_params_via_skeleton(cfg, transformers, accelerate)
if param_count is None:
logger.debug("model_inspector: using formula fallback for %s", model_name)
Expand Down
8 changes: 3 additions & 5 deletions autobot-backend/multimodal_processor/processors/vision.py
Original file line number Diff line number Diff line change
Expand Up @@ -100,19 +100,19 @@ def _load_models(self):
# Load CLIP model for image embeddings and classification
self.logger.info("Loading CLIP model...")
self.clip_model = CLIPModel.from_pretrained(
"openai/clip-vit-base-patch32", resume_download=True
"openai/clip-vit-base-patch32"
).to( # nosec B615 # HuggingFace model loaded by name; revision pinning managed operationally
self.device
)
self.clip_processor = CLIPProcessor.from_pretrained( # nosec B615
"openai/clip-vit-base-patch32", use_fast=True, resume_download=True
"openai/clip-vit-base-patch32", use_fast=True
)

# Load BLIP-2 model for image captioning and VQA
# Using smaller model for memory efficiency
self.logger.info("Loading BLIP-2 model...")
self.blip_processor = Blip2Processor.from_pretrained( # nosec B615
"Salesforce/blip2-opt-2.7b", use_fast=True, resume_download=True
"Salesforce/blip2-opt-2.7b", use_fast=True
)

# Check if accelerate is available for device_map
Expand All @@ -128,13 +128,11 @@ def _load_models(self):
"Salesforce/blip2-opt-2.7b",
torch_dtype=torch.float16,
device_map="auto",
resume_download=True,
)
else:
self.blip_model = Blip2ForConditionalGeneration.from_pretrained( # nosec B615
"Salesforce/blip2-opt-2.7b",
torch_dtype=(torch.float16 if torch.cuda.is_available() else torch.float32),
resume_download=True,
).to(self.device)

# Set models to evaluation mode
Expand Down
8 changes: 2 additions & 6 deletions autobot-backend/multimodal_processor/processors/voice.py
Original file line number Diff line number Diff line change
Expand Up @@ -116,24 +116,20 @@ def _load_models(self):
# Load Whisper model for speech recognition
self.logger.info("Loading Whisper model...")
# HuggingFace model loaded by name; revision pinning managed operationally.
self.whisper_processor = WhisperProcessor.from_pretrained( # nosec B615
"openai/whisper-base", resume_download=True
)
self.whisper_processor = WhisperProcessor.from_pretrained("openai/whisper-base") # nosec B615
self.whisper_model = WhisperForConditionalGeneration.from_pretrained( # nosec B615
"openai/whisper-base",
torch_dtype=(torch.float16 if torch.cuda.is_available() else torch.float32),
resume_download=True,
).to(self.device)

# Load Wav2Vec2 model for audio embeddings and feature extraction
self.logger.info("Loading Wav2Vec2 model...")
self.wav2vec_processor = Wav2Vec2Processor.from_pretrained( # nosec B615
"facebook/wav2vec2-base-960h", use_fast=True, resume_download=True
"facebook/wav2vec2-base-960h", use_fast=True
)
self.wav2vec_model = Wav2Vec2ForCTC.from_pretrained( # nosec B615
"facebook/wav2vec2-base-960h",
torch_dtype=(torch.float16 if torch.cuda.is_available() else torch.float32),
resume_download=True,
).to(self.device)

# Set models to evaluation mode
Expand Down
2 changes: 1 addition & 1 deletion repo_tests/python_file_size_ratchet_baseline.py
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@
"autobot-backend/agents/system_command_agent.py": 903,
"autobot-backend/agents/system_knowledge_manager.py": 843,
"autobot-backend/agents/web_researcher.py": 1435,
"autobot-backend/ai_hardware_accelerator.py": 1048,
"autobot-backend/ai_hardware_accelerator.py": 1042,
"autobot-backend/api/a2a.py": 650,
"autobot-backend/api/advanced_control.py": 626,
"autobot-backend/api/agent.py": 1380,
Expand Down
Loading
Loading