Skip to content

Commit

Permalink
Add 4bit and 8bit models for Lightning-Mlx library
Browse files Browse the repository at this point in the history
  • Loading branch information
kadirnar committed May 12, 2024
1 parent 29cbf84 commit 22f1f67
Show file tree
Hide file tree
Showing 4 changed files with 6 additions and 13 deletions.
5 changes: 4 additions & 1 deletion whisperplus/pipelines/lightning_whisper_mlx/lightning.py
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,8 @@
},
"distil-large-v3": {
"base": "mustafaaljadery/distil-whisper-mlx",
"4bit": "mustafaaljadery/distil-whisper-mlx-4bit",
"8bit": "mustafaaljadery/distil-whisper-mlx-8bit",
},
}

Expand Down Expand Up @@ -91,9 +93,10 @@ def __init__(self, model, batch_size=12, quant=None):
hf_hub_download(repo_id=repo_id, filename=filename2, local_dir=local_dir)

def transcribe(self, audio_path, language=None):
breakpoint()
result = transcribe_audio(
audio_path,
path_or_hf_repo=f'./mlx_models/{self.name}',
path_or_hf_repo=f'mlx_models/{self.name}',
language=language,
batch_size=self.batch_size)
return result
2 changes: 1 addition & 1 deletion whisperplus/pipelines/mlx_whisper/__init__.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
# Copyright © 2023-2024 Apple Inc.

from . import audio, decoding, load_models
from .transcribxe import transcribe
from .transcribe import transcribe
from .version import __version__
9 changes: 0 additions & 9 deletions whisperplus/pipelines/mlx_whisper/requirements.txt

This file was deleted.

3 changes: 1 addition & 2 deletions whisperplus/test.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
import torch
from hqq.utils.patching import prepare_for_inference
from pipelines.whisper import SpeechToTextPipeline
from transformers import BitsAndBytesConfig, HqqConfig
from utils.download_utils import download_youtube_to_mp3
Expand All @@ -8,7 +7,7 @@
audio_path = download_youtube_to_mp3(url)

hqq_config = HqqConfig(
nbits=1,
nbits=4,
group_size=64,
quant_zero=False,
quant_scale=False,
Expand Down

0 comments on commit 22f1f67

Please sign in to comment.