lyrics-transcriber 0.17.1__tar.gz → 0.18.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 (17) hide show
  1. {lyrics_transcriber-0.17.1 → lyrics_transcriber-0.18.0}/PKG-INFO +2 -2
  2. {lyrics_transcriber-0.17.1 → lyrics_transcriber-0.18.0}/lyrics_transcriber/transcriber.py +14 -3
  3. {lyrics_transcriber-0.17.1 → lyrics_transcriber-0.18.0}/pyproject.toml +3 -4
  4. {lyrics_transcriber-0.17.1 → lyrics_transcriber-0.18.0}/LICENSE +0 -0
  5. {lyrics_transcriber-0.17.1 → lyrics_transcriber-0.18.0}/README.md +0 -0
  6. {lyrics_transcriber-0.17.1 → lyrics_transcriber-0.18.0}/lyrics_transcriber/__init__.py +0 -0
  7. {lyrics_transcriber-0.17.1 → lyrics_transcriber-0.18.0}/lyrics_transcriber/audioshake_transcriber.py +0 -0
  8. {lyrics_transcriber-0.17.1 → lyrics_transcriber-0.18.0}/lyrics_transcriber/llm_prompts/README.md +0 -0
  9. {lyrics_transcriber-0.17.1 → lyrics_transcriber-0.18.0}/lyrics_transcriber/llm_prompts/llm_prompt_lyrics_correction_andrew_handwritten_20231118.txt +0 -0
  10. {lyrics_transcriber-0.17.1 → lyrics_transcriber-0.18.0}/lyrics_transcriber/llm_prompts/llm_prompt_lyrics_correction_gpt_optimised_20231119.txt +0 -0
  11. {lyrics_transcriber-0.17.1 → lyrics_transcriber-0.18.0}/lyrics_transcriber/llm_prompts/llm_prompt_lyrics_matching_andrew_handwritten_20231118.txt +0 -0
  12. {lyrics_transcriber-0.17.1 → lyrics_transcriber-0.18.0}/lyrics_transcriber/llm_prompts/promptfooconfig.yaml +0 -0
  13. {lyrics_transcriber-0.17.1 → lyrics_transcriber-0.18.0}/lyrics_transcriber/llm_prompts/test_data/ABBA-UnderAttack-Genius.txt +0 -0
  14. {lyrics_transcriber-0.17.1 → lyrics_transcriber-0.18.0}/lyrics_transcriber/utils/__init__.py +0 -0
  15. {lyrics_transcriber-0.17.1 → lyrics_transcriber-0.18.0}/lyrics_transcriber/utils/ass.py +0 -0
  16. {lyrics_transcriber-0.17.1 → lyrics_transcriber-0.18.0}/lyrics_transcriber/utils/cli.py +0 -0
  17. {lyrics_transcriber-0.17.1 → lyrics_transcriber-0.18.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.17.1
3
+ Version: 0.18.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
@@ -13,8 +13,8 @@ Classifier: Programming Language :: Python :: 3.9
13
13
  Classifier: Programming Language :: Python :: 3.10
14
14
  Classifier: Programming Language :: Python :: 3.11
15
15
  Classifier: Programming Language :: Python :: 3.12
16
+ Classifier: Programming Language :: Python :: 3.13
16
17
  Requires-Dist: Cython (>=0)
17
- Requires-Dist: auditok (>=0.2)
18
18
  Requires-Dist: dtw-python (>=1)
19
19
  Requires-Dist: llvmlite (>=0)
20
20
  Requires-Dist: lyricsgenius (>=3)
@@ -308,6 +308,13 @@ class LyricsTranscriber:
308
308
  self.outputs["corrected_lyrics_data_dict"] = corrected_lyrics_data_dict
309
309
  return
310
310
 
311
+ reference_lyrics = self.outputs.get("genius_lyrics_text") or self.outputs.get("spotify_lyrics_text")
312
+
313
+ if not reference_lyrics:
314
+ self.logger.warning("No reference lyrics found from Genius or Spotify. Skipping LLM correction.")
315
+ self.outputs["corrected_lyrics_data_dict"] = self.outputs["transcription_data_dict"]
316
+ return
317
+
311
318
  self.logger.debug(
312
319
  f"no cached lyrics found at corrected_lyrics_data_json_cache_filepath: {corrected_lyrics_data_json_cache_filepath}, attempting to run correction using LLM"
313
320
  )
@@ -317,7 +324,6 @@ class LyricsTranscriber:
317
324
  with open(self.llm_prompt_correction, "r") as file:
318
325
  system_prompt_template = file.read()
319
326
 
320
- reference_lyrics = self.outputs["genius_lyrics_text"] or self.outputs["spotify_lyrics_text"]
321
327
  system_prompt = system_prompt_template.replace("{{reference_lyrics}}", reference_lyrics)
322
328
 
323
329
  # TODO: Test if results are cleaner when using the vocal file from a background vocal audio separation model
@@ -639,7 +645,9 @@ class LyricsTranscriber:
639
645
  for i, word in enumerate(segment["words"]):
640
646
  start_time = self.format_time_lrc(word["start"])
641
647
  if i != len(segment["words"]) - 1:
642
- word["text"] += " "
648
+ if not word["text"].endswith(" "):
649
+ self.logger.debug(f"word '{word['text']}' does not end with a space, adding one")
650
+ word["text"] += " "
643
651
  line = "[{}]1:{}{}\n".format(start_time, "/" if i == 0 else "", word["text"])
644
652
  f.write(line)
645
653
 
@@ -961,7 +969,10 @@ class LyricsTranscriber:
961
969
  self.logger.debug(f"Using Whisper for transcription with model: {self.transcription_model}")
962
970
  audio = whisper.load_audio(self.audio_filepath)
963
971
  model = whisper.load_model(self.transcription_model, device="cpu")
964
- transcription_data = whisper.transcribe(model, audio, language="en", vad="auditok", beam_size=5, temperature=0.2, best_of=5)
972
+ transcription_data = whisper.transcribe(model, audio, language="en", beam_size=5, temperature=0.2, best_of=5)
973
+
974
+ # auditok is needed for voice activity detection, but it has OS package dependencies that are hard to install on some platforms
975
+ # transcription_data = whisper.transcribe(model, audio, language="en", vad="auditok", beam_size=5, temperature=0.2, best_of=5)
965
976
 
966
977
  # Remove segments with no words, only music
967
978
  transcription_data["segments"] = [segment for segment in transcription_data["segments"] if segment["text"].strip() != "Music"]
@@ -1,6 +1,6 @@
1
1
  [tool.poetry]
2
2
  name = "lyrics-transcriber"
3
- version = "0.17.1"
3
+ version = "0.18.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"
@@ -26,13 +26,12 @@ lyricsgenius = ">=3"
26
26
  python-slugify = ">=8"
27
27
  syrics = ">=0"
28
28
  openai = "^1"
29
- openai-whisper = ">=20231117"
30
29
  transformers = ">=4"
31
- auditok = ">=0.2"
32
30
  whisper-timestamped = ">=1"
33
31
  tenacity = ">=8"
32
+ openai-whisper = ">=20231117"
34
33
  # Note: after adding openai-whisper and whisper-timestamped with poetry lock, I then removed all traces of triton
35
- # from poetry.lock before running poetry install, as triton doesn't support macOS but isn't actually needed for whisper.
34
+ # from poetry.lock before running poetry install, as triton doesn't support macOS but isn't actually needed for whisper
36
35
  # This was the only way I was able to get a working cross-platform build published to PyPI.
37
36
  # To update the lockfile and install/upgrade dependencies, modify the dependency list above then run:
38
37
  # poetry lock; patch -p0 poetry.lock <.github/removetriton.patch; poetry install