lyrics-transcriber 0.13.1__tar.gz → 0.15.0__tar.gz

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.
Files changed (16) hide show
  1. {lyrics_transcriber-0.13.1 → lyrics_transcriber-0.15.0}/PKG-INFO +2 -1
  2. {lyrics_transcriber-0.13.1 → lyrics_transcriber-0.15.0}/lyrics_transcriber/transcriber.py +15 -4
  3. {lyrics_transcriber-0.13.1 → lyrics_transcriber-0.15.0}/lyrics_transcriber/utils/cli.py +2 -2
  4. {lyrics_transcriber-0.13.1 → lyrics_transcriber-0.15.0}/pyproject.toml +2 -1
  5. {lyrics_transcriber-0.13.1 → lyrics_transcriber-0.15.0}/LICENSE +0 -0
  6. {lyrics_transcriber-0.13.1 → lyrics_transcriber-0.15.0}/README.md +0 -0
  7. {lyrics_transcriber-0.13.1 → lyrics_transcriber-0.15.0}/lyrics_transcriber/__init__.py +0 -0
  8. {lyrics_transcriber-0.13.1 → lyrics_transcriber-0.15.0}/lyrics_transcriber/llm_prompts/README.md +0 -0
  9. {lyrics_transcriber-0.13.1 → lyrics_transcriber-0.15.0}/lyrics_transcriber/llm_prompts/llm_prompt_lyrics_correction_andrew_handwritten_20231118.txt +0 -0
  10. {lyrics_transcriber-0.13.1 → lyrics_transcriber-0.15.0}/lyrics_transcriber/llm_prompts/llm_prompt_lyrics_correction_gpt_optimised_20231119.txt +0 -0
  11. {lyrics_transcriber-0.13.1 → lyrics_transcriber-0.15.0}/lyrics_transcriber/llm_prompts/llm_prompt_lyrics_matching_andrew_handwritten_20231118.txt +0 -0
  12. {lyrics_transcriber-0.13.1 → lyrics_transcriber-0.15.0}/lyrics_transcriber/llm_prompts/promptfooconfig.yaml +0 -0
  13. {lyrics_transcriber-0.13.1 → lyrics_transcriber-0.15.0}/lyrics_transcriber/llm_prompts/test_data/ABBA-UnderAttack-Genius.txt +0 -0
  14. {lyrics_transcriber-0.13.1 → lyrics_transcriber-0.15.0}/lyrics_transcriber/utils/__init__.py +0 -0
  15. {lyrics_transcriber-0.13.1 → lyrics_transcriber-0.15.0}/lyrics_transcriber/utils/ass.py +0 -0
  16. {lyrics_transcriber-0.13.1 → lyrics_transcriber-0.15.0}/lyrics_transcriber/utils/subtitles.py +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: lyrics-transcriber
3
- Version: 0.13.1
3
+ Version: 0.15.0
4
4
  Summary: Automatically create synchronised lyrics files in ASS and MidiCo LRC formats with word-level timestamps, using Whisper and lyrics from Genius and Spotify
5
5
  Home-page: https://github.com/karaokenerds/python-lyrics-transcriber
6
6
  License: MIT
@@ -14,6 +14,7 @@ Classifier: Programming Language :: Python :: 3.10
14
14
  Classifier: Programming Language :: Python :: 3.11
15
15
  Classifier: Programming Language :: Python :: 3.12
16
16
  Requires-Dist: Cython (>=0)
17
+ Requires-Dist: auditok (>=0.2)
17
18
  Requires-Dist: dtw-python (>=1)
18
19
  Requires-Dist: llvmlite (>=0)
19
20
  Requires-Dist: lyricsgenius (>=3)
@@ -29,7 +29,7 @@ class LyricsTranscriber:
29
29
  log_level=logging.DEBUG,
30
30
  log_formatter=None,
31
31
  transcription_model="medium",
32
- llm_model="gpt-4-1106-preview",
32
+ llm_model="gpt-4o",
33
33
  llm_prompt_matching="lyrics_transcriber/llm_prompts/llm_prompt_lyrics_matching_andrew_handwritten_20231118.txt",
34
34
  llm_prompt_correction="lyrics_transcriber/llm_prompts/llm_prompt_lyrics_correction_andrew_handwritten_20231118.txt",
35
35
  render_video=False,
@@ -66,7 +66,15 @@ class LyricsTranscriber:
66
66
  self.llm_model = llm_model
67
67
  self.llm_prompt_matching = llm_prompt_matching
68
68
  self.llm_prompt_correction = llm_prompt_correction
69
+
69
70
  self.openai_client = OpenAI()
71
+
72
+ # Uncomment for local models e.g. with ollama
73
+ # self.openai_client = OpenAI(
74
+ # base_url="http://localhost:11434/v1",
75
+ # api_key="ollama",
76
+ # )
77
+
70
78
  self.openai_client.log = self.log_level
71
79
 
72
80
  self.render_video = render_video
@@ -391,8 +399,11 @@ class LyricsTranscriber:
391
399
  },
392
400
  }
393
401
 
394
- input_cost = price_dollars_per_1000_tokens[self.llm_model]["input"] * (self.outputs["llm_token_usage"]["input"] / 1000)
395
- output_cost = price_dollars_per_1000_tokens[self.llm_model]["output"] * (self.outputs["llm_token_usage"]["output"] / 1000)
402
+ input_price = price_dollars_per_1000_tokens.get(self.llm_model, {"input": 0, "output": 0})["input"]
403
+ output_price = price_dollars_per_1000_tokens.get(self.llm_model, {"input": 0, "output": 0})["output"]
404
+
405
+ input_cost = input_price * (self.outputs["llm_token_usage"]["input"] / 1000)
406
+ output_cost = output_price * (self.outputs["llm_token_usage"]["output"] / 1000)
396
407
 
397
408
  self.outputs["llm_costs_usd"]["input"] = round(input_cost, 3)
398
409
  self.outputs["llm_costs_usd"]["output"] = round(output_cost, 3)
@@ -775,7 +786,7 @@ class LyricsTranscriber:
775
786
  self.logger.debug(f"no cached transcription file found, running whisper transcribe with model: {self.transcription_model}")
776
787
  audio = whisper.load_audio(self.audio_filepath)
777
788
  model = whisper.load_model(self.transcription_model, device="cpu")
778
- result = whisper.transcribe(model, audio, language="en")
789
+ result = whisper.transcribe(model, audio, language="en", vad="auditok", beam_size=5, temperature=0.2, best_of=5)
779
790
 
780
791
  self.logger.debug(f"transcription complete, performing post-processing cleanup")
781
792
 
@@ -65,8 +65,8 @@ def main():
65
65
 
66
66
  parser.add_argument(
67
67
  "--llm_model",
68
- default="gpt-4-1106-preview",
69
- help="Optional: LLM model to use (currently only supports OpenAI chat completion models, e.g. gpt-4-1106-preview). Default: gpt-3.5-turbo-1106",
68
+ default="gpt-4o",
69
+ help="Optional: LLM model to use (currently only supports OpenAI chat completion compatible models",
70
70
  )
71
71
 
72
72
  parser.add_argument(
@@ -1,6 +1,6 @@
1
1
  [tool.poetry]
2
2
  name = "lyrics-transcriber"
3
- version = "0.13.1"
3
+ version = "0.15.0"
4
4
  description = "Automatically create synchronised lyrics files in ASS and MidiCo LRC formats with word-level timestamps, using Whisper and lyrics from Genius and Spotify"
5
5
  authors = ["Andrew Beveridge <andrew@beveridge.uk>"]
6
6
  license = "MIT"
@@ -28,6 +28,7 @@ syrics = ">=0"
28
28
  openai = "^1"
29
29
  openai-whisper = ">=20231117"
30
30
  transformers = ">=4"
31
+ auditok = ">=0.2"
31
32
  whisper-timestamped = ">=1"
32
33
  # Note: after adding openai-whisper and whisper-timestamped with poetry lock, I then removed all traces of triton
33
34
  # from poetry.lock before running poetry install, as triton doesn't support macOS but isn't actually needed for whisper.