Skip to content

Commit

Permalink
Fix for safetensor model detection
Browse files Browse the repository at this point in the history
  • Loading branch information
raivisdejus committed Oct 12, 2024
1 parent 1baccef commit 02d1129
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions buzz/transformers_whisper.py
Original file line number Diff line number Diff line change
Expand Up @@ -164,8 +164,8 @@ def transcribe(
device = "cuda" if torch.cuda.is_available() else "cpu"
torch_dtype = torch.float16 if torch.cuda.is_available() else torch.float32

safetensors_path = os.path.join(self.model_id, "model.safetensors")
use_safetensors = os.path.exists(safetensors_path)
safetensors_files = [f for f in os.listdir(self.model_id) if f.endswith('.safetensors')]
use_safetensors = len(safetensors_files) > 0

model = AutoModelForSpeechSeq2Seq.from_pretrained(
self.model_id, torch_dtype=torch_dtype, use_safetensors=use_safetensors
Expand Down

0 comments on commit 02d1129

Please sign in to comment.