Skip to content

Commit

Permalink
Fix imports and references of old repo name
Browse files Browse the repository at this point in the history
  • Loading branch information
Kostis-S-Z committed Dec 4, 2024
1 parent 3b84710 commit 35ab5c7
Show file tree
Hide file tree
Showing 10 changed files with 24 additions and 20 deletions.
4 changes: 2 additions & 2 deletions demo/app.py
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ def load_text_to_speech_model_and_tokenizer():
st.divider()
st.header("Loading and Cleaning Data")
st.markdown(
"[API Reference for data_cleaners](https://mozilla-ai.github.io/document-to-podcast/api/#opennotebookllm.preprocessing.data_cleaners)"
"[API Reference for data_cleaners](https://mozilla-ai.github.io/document-to-podcast/api/#document_to_podcast.preprocessing.data_cleaners)"
)

extension = Path(uploaded_file.name).suffix
Expand All @@ -81,7 +81,7 @@ def load_text_to_speech_model_and_tokenizer():
st.divider()
st.header("Downloading and Loading models")
st.markdown(
"[API Reference for model_loaders](https://mozilla-ai.github.io/document-to-podcast/api/#opennotebookllm.inference.model_loaders)"
"[API Reference for model_loaders](https://mozilla-ai.github.io/document-to-podcast/api/#document_to_podcast.inference.model_loaders)"
)

text_model = load_text_to_text_model()
Expand Down
6 changes: 3 additions & 3 deletions docs/step-by-step-guide.md
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ Cleaner input data ensures that the model works with reliable and consistent inf

**2 - Text Cleaning**

- Uses functions defined in [`data_cleaners.py`](../api/#opennotebookllm.inference.data_cleaners)
- Uses functions defined in [`data_cleaners.py`](../api/#document_to_podcast.inference.data_cleaners)

- Removes unwanted elements like URLs, email addresses, and special characters using Python's `re` library, which leverages **Regular Expressions** (regex) to identify and manipulate specific patterns in text.

Expand All @@ -55,15 +55,15 @@ In this step, the pre-processed text is transformed into a conversational podcas

**1 - Model Loading**

- The [`model_loader.py`](../api/#opennotebookllm.inference.model_loaders) script is responsible for loading GGUF-type models using the `llama_cpp` library.
- The [`model_loader.py`](../api/#document_to_podcast.inference.model_loaders) script is responsible for loading GGUF-type models using the `llama_cpp` library.

- The function `load_llama_cpp_model` takes a model ID in the format `{org}/{repo}/{filename}` and loads the specified model.

- This approach of using the `llama_cpp` library supports efficient CPU-based inference, making language models accessible even on machines without GPUs.

**2 - Text-to-Text Generation**

- The [`text_to_text.py`](../api/#opennotebookllm.inference.text_to_text) script manages the interaction with the language model, converting input text into a structured conversational podcast script.
- The [`text_to_text.py`](../api/#document_to_podcast.inference.text_to_text) script manages the interaction with the language model, converting input text into a structured conversational podcast script.

- It uses the `chat_completion` function to process the input text and a customizable system prompt, guiding the language to generate a text output (e.g. a coherent podcast script between speakers).

Expand Down
File renamed without changes.
Empty file.
File renamed without changes.
Original file line number Diff line number Diff line change
@@ -1,9 +1,11 @@
import numpy as np
import soundfile as sf

from opennotebookllm.inference.model_loaders import load_parler_tts_model_and_tokenizer
from opennotebookllm.inference.text_to_speech import text_to_speech
from opennotebookllm.podcast_maker.config import PodcastConfig, SpeakerConfig
from document_to_podcast.inference.model_loaders import (
load_parler_tts_model_and_tokenizer,
)
from document_to_podcast.inference.text_to_speech import text_to_speech
from document_to_podcast.podcast_maker.config import PodcastConfig, SpeakerConfig


def parse_script_to_waveform(script: str, podcast_config: PodcastConfig):
Expand Down
6 changes: 4 additions & 2 deletions tests/conftest.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,10 @@

import pytest

from opennotebookllm.inference.model_loaders import load_parler_tts_model_and_tokenizer
from opennotebookllm.podcast_maker.config import (
from document_to_podcast.inference.model_loaders import (
load_parler_tts_model_and_tokenizer,
)
from document_to_podcast.podcast_maker.config import (
PodcastConfig,
SpeakerConfig,
)
Expand Down
10 changes: 5 additions & 5 deletions tests/integration/test_text_to_text_to_speech.py
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
import os
from pathlib import Path

from opennotebookllm.inference.model_loaders import load_llama_cpp_model
from opennotebookllm.inference.text_to_speech import text_to_speech
from opennotebookllm.inference.text_to_text import text_to_text
from opennotebookllm.podcast_maker.config import PodcastConfig
from opennotebookllm.podcast_maker.script_to_audio import save_waveform_as_file
from document_to_podcast.inference.model_loaders import load_llama_cpp_model
from document_to_podcast.inference.text_to_speech import text_to_speech
from document_to_podcast.inference.text_to_text import text_to_text
from document_to_podcast.podcast_maker.config import PodcastConfig
from document_to_podcast.podcast_maker.script_to_audio import save_waveform_as_file


def test_text_to_text_to_speech(tmp_path: Path, podcast_config: PodcastConfig):
Expand Down
6 changes: 3 additions & 3 deletions tests/unit/inference/test_text_to_speech.py
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
from pathlib import Path

from opennotebookllm.inference.text_to_speech import text_to_speech
from document_to_podcast.inference.text_to_speech import text_to_speech

from opennotebookllm.podcast_maker.config import PodcastConfig
from opennotebookllm.podcast_maker.script_to_audio import save_waveform_as_file
from document_to_podcast.podcast_maker.config import PodcastConfig
from document_to_podcast.podcast_maker.script_to_audio import save_waveform_as_file


def test_text_to_speech_parler(
Expand Down
4 changes: 2 additions & 2 deletions tests/unit/podcast_maker/test_script_to_audio.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,8 @@

import numpy as np

from opennotebookllm.podcast_maker.config import PodcastConfig
from opennotebookllm.podcast_maker.script_to_audio import (
from document_to_podcast.podcast_maker.config import PodcastConfig
from document_to_podcast.podcast_maker.script_to_audio import (
parse_script_to_waveform,
save_waveform_as_file,
)
Expand Down

0 comments on commit 35ab5c7

Please sign in to comment.