Skip to content
Open
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
13 changes: 11 additions & 2 deletions src/gurrt/core/models.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import torch
import sys
from transformers import (
CLIPProcessor,
CLIPModel,
Expand Down Expand Up @@ -79,7 +80,15 @@ def get_smol(self, flag:bool):

self._smol = SmolVLMForConditionalGeneration.from_pretrained(path,
local_files_only= True)
self._smol = torch.compile(self._smol, mode="reduce-overhead")
## torch.compile works with Triton, which is not on Windows, so this one
# line crashes the very first index. Only run it when we're on a CUDA GPU
# and not on Windows — and if the compile still chokes, just skip it instead
# of taking whole run down with it.
if self.device == "cuda" and sys.platform != "win32":
try:
self._smol = torch.compile(self._smol, mode="reduce-overhead")
except Exception as e:
ui.warn(f"torch.compile unavailable -- continuing without it ({e})")
return self._to_device(self._smol), self._smol_processor

def release_smol(self):
Expand Down Expand Up @@ -149,4 +158,4 @@ def download_models(cache_dir):
snapshot_download(
repo_id="Systran/faster-distil-whisper-large-v2",
local_dir=str(cache_dir / "whisper_model"),
)
)