dora-distil-whisper 0.3.6__py2.py3-none-any.whl

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -0,0 +1,11 @@
1
+ import os
2
+
3
+ # Define the path to the README file relative to the package directory
4
+ readme_path = os.path.join(os.path.dirname(os.path.dirname(__file__)), "README.md")
5
+
6
+ # Read the content of the README file
7
+ try:
8
+ with open(readme_path, "r", encoding="utf-8") as f:
9
+ __doc__ = f.read()
10
+ except FileNotFoundError:
11
+ __doc__ = "README file not found."
@@ -0,0 +1,42 @@
1
+ import torch
2
+ from transformers import AutoModelForSpeechSeq2Seq, AutoProcessor, pipeline
3
+ from dora import Node
4
+ import pyarrow as pa
5
+ import os
6
+
7
+ os.environ["TRANSFORMERS_OFFLINE"] = "1"
8
+
9
+ device = "cuda:0" if torch.cuda.is_available() else "cpu"
10
+ torch_dtype = torch.float16 if torch.cuda.is_available() else torch.float32
11
+
12
+ model_id = "distil-whisper/distil-large-v3"
13
+
14
+ model = AutoModelForSpeechSeq2Seq.from_pretrained(
15
+ model_id,
16
+ torch_dtype=torch_dtype,
17
+ low_cpu_mem_usage=True,
18
+ use_safetensors=True,
19
+ local_files_only=True,
20
+ )
21
+ model.to(device)
22
+
23
+ processor = AutoProcessor.from_pretrained(model_id)
24
+ pipe = pipeline(
25
+ "automatic-speech-recognition",
26
+ model=model,
27
+ tokenizer=processor.tokenizer,
28
+ feature_extractor=processor.feature_extractor,
29
+ max_new_tokens=128,
30
+ torch_dtype=torch_dtype,
31
+ device=device,
32
+ generate_kwargs={"language": "chinese"},
33
+ )
34
+
35
+
36
+ def main():
37
+ node = Node()
38
+ for event in node:
39
+ if event["type"] == "INPUT":
40
+ audio = event["value"].to_numpy()
41
+ result = pipe(audio)
42
+ node.send_output("text", pa.array([result["text"]]))
@@ -0,0 +1,34 @@
1
+ Metadata-Version: 2.1
2
+ Name: dora-distil-whisper
3
+ Version: 0.3.6
4
+ Summary: Dora dora-distil-whisper
5
+ Home-page: https://github.com/dora-rs/dora.git
6
+ License: MIT
7
+ Author: Haixuan Xavier Tao
8
+ Author-email: tao.xavier@outlook.com
9
+ Classifier: License :: OSI Approved :: MIT License
10
+ Classifier: Programming Language :: Python :: 2
11
+ Classifier: Programming Language :: Python :: 2.7
12
+ Classifier: Programming Language :: Python :: 3
13
+ Classifier: Programming Language :: Python :: 3.4
14
+ Classifier: Programming Language :: Python :: 3.5
15
+ Classifier: Programming Language :: Python :: 3.6
16
+ Classifier: Programming Language :: Python :: 3.7
17
+ Classifier: Programming Language :: Python :: 3.8
18
+ Classifier: Programming Language :: Python :: 3.9
19
+ Classifier: Programming Language :: Python :: 3.10
20
+ Classifier: Programming Language :: Python :: 3.11
21
+ Classifier: Programming Language :: Python :: 3.12
22
+ Requires-Dist: accelerate (>=0.29.2,<0.30.0)
23
+ Requires-Dist: dora-rs (>=0.3.6,<0.4.0)
24
+ Requires-Dist: numpy (<2.0.0)
25
+ Requires-Dist: pyarrow (>=5.0.0)
26
+ Requires-Dist: torch (>=2.1.1,<3.0.0)
27
+ Requires-Dist: transformers (>=4.0.0)
28
+ Project-URL: Documentation, https://github.com/dora-rs/dora/blob/main/node-hub/dora-distil-whisper/README.md
29
+ Description-Content-Type: text/markdown
30
+
31
+ # Dora Node for transforming speech to text (English only)
32
+
33
+ Check example at [examples/speech-to-text](examples/speech-to-text)
34
+
@@ -0,0 +1,6 @@
1
+ dora_distil_whisper/__init__.py,sha256=Gy4qL4vCeTyA5HR1Yp3ioL4-ClJyW8oi_38CzMuMsBM,358
2
+ dora_distil_whisper/main.py,sha256=xFwK_DhqA-2fWQKPxj6w48NvFVOUvUewcnVd3lnJ0Vc,1123
3
+ dora_distil_whisper-0.3.6.dist-info/METADATA,sha256=gHvOSGNsTHz2djOivsrH59WB-1AE2voM1Nsag10ovlU,1374
4
+ dora_distil_whisper-0.3.6.dist-info/WHEEL,sha256=IrRNNNJ-uuL1ggO5qMvT1GGhQVdQU54d6ZpYqEZfEWo,92
5
+ dora_distil_whisper-0.3.6.dist-info/entry_points.txt,sha256=Q_8wNgkDYxgoKETJjM6ewXWcr_yzRUgsSeBd0uetuRs,69
6
+ dora_distil_whisper-0.3.6.dist-info/RECORD,,
@@ -0,0 +1,4 @@
1
+ Wheel-Version: 1.0
2
+ Generator: poetry-core 1.9.0
3
+ Root-Is-Purelib: true
4
+ Tag: py2.py3-none-any
@@ -0,0 +1,3 @@
1
+ [console_scripts]
2
+ dora-distil-whisper=dora_distil_whisper.main:main
3
+