From 95db0fe42de4f7e4e80eded48c6aeab8ed4c4d1f Mon Sep 17 00:00:00 2001 From: Sanyam Bhutani <sanyambhutani@meta.com> Date: Fri, 25 Oct 2024 15:30:36 -0700 Subject: [PATCH] Address PR Comments --- .../Step-1 PDF-Pre-Processing-Logic.ipynb | 4 ++-- .../NotebookLlama/Step-2-Transcript-Writer.ipynb | 4 ++-- .../NotebookLlama/Step-3-Re-Writer.ipynb | 6 +++--- .../NotebookLlama/Step-4-TTS-Workflow.ipynb | 8 +++++--- recipes/quickstart/NotebookLlama/requirements.txt | 15 +++++++++++++++ 5 files changed, 27 insertions(+), 10 deletions(-) create mode 100644 recipes/quickstart/NotebookLlama/requirements.txt diff --git a/recipes/quickstart/NotebookLlama/Step-1 PDF-Pre-Processing-Logic.ipynb b/recipes/quickstart/NotebookLlama/Step-1 PDF-Pre-Processing-Logic.ipynb index 6f128be3..107ce482 100644 --- a/recipes/quickstart/NotebookLlama/Step-1 PDF-Pre-Processing-Logic.ipynb +++ b/recipes/quickstart/NotebookLlama/Step-1 PDF-Pre-Processing-Logic.ipynb @@ -59,7 +59,7 @@ "metadata": {}, "outputs": [], "source": [ - "pdf_path = './2402.13116v3.pdf'\n", + "pdf_path = './resources/2402.13116v3.pdf'\n", "DEFAULT_MODEL = \"meta-llama/Llama-3.2-1B-Instruct\"" ] }, @@ -469,7 +469,7 @@ "metadata": {}, "outputs": [], "source": [ - "INPUT_FILE = \"./extracted_text.txt\" # Replace with your file path\n", + "INPUT_FILE = \"./resources/extracted_text.txt\" # Replace with your file path\n", "CHUNK_SIZE = 1000 # Adjust chunk size if needed\n", "\n", "chunks = create_word_bounded_chunks(text, CHUNK_SIZE)\n", diff --git a/recipes/quickstart/NotebookLlama/Step-2-Transcript-Writer.ipynb b/recipes/quickstart/NotebookLlama/Step-2-Transcript-Writer.ipynb index 5c9388d0..ea25940b 100644 --- a/recipes/quickstart/NotebookLlama/Step-2-Transcript-Writer.ipynb +++ b/recipes/quickstart/NotebookLlama/Step-2-Transcript-Writer.ipynb @@ -162,7 +162,7 @@ "metadata": {}, "outputs": [], "source": [ - "INPUT_PROMPT = read_file_to_string('./clean_extracted_text.txt')" + "INPUT_PROMPT = read_file_to_string('./resources/clean_extracted_text.txt')" ] }, { @@ -298,7 +298,7 @@ "metadata": {}, "outputs": [], "source": [ - "with open('data.pkl', 'wb') as file:\n", + "with open('./resources/data.pkl', 'wb') as file:\n", " pickle.dump(save_string_pkl, file)" ] }, diff --git a/recipes/quickstart/NotebookLlama/Step-3-Re-Writer.ipynb b/recipes/quickstart/NotebookLlama/Step-3-Re-Writer.ipynb index 111e6505..035d2b1a 100644 --- a/recipes/quickstart/NotebookLlama/Step-3-Re-Writer.ipynb +++ b/recipes/quickstart/NotebookLlama/Step-3-Re-Writer.ipynb @@ -146,7 +146,7 @@ "source": [ "import pickle\n", "\n", - "with open('data.pkl', 'rb') as file:\n", + "with open('./resources/data.pkl', 'rb') as file:\n", " INPUT_PROMPT = pickle.load(file)" ] }, @@ -191,7 +191,7 @@ " \"text-generation\",\n", " model=MODEL,\n", " model_kwargs={\"torch_dtype\": torch.bfloat16},\n", - " device_map=\"cuda:7\",\n", + " device_map=\"auto\",\n", ")\n", "\n", "messages = [\n", @@ -249,7 +249,7 @@ "metadata": {}, "outputs": [], "source": [ - "with open('podcast_ready_data.pkl', 'wb') as file:\n", + "with open('./resources/podcast_ready_data.pkl', 'wb') as file:\n", " pickle.dump(save_string_pkl, file)" ] }, diff --git a/recipes/quickstart/NotebookLlama/Step-4-TTS-Workflow.ipynb b/recipes/quickstart/NotebookLlama/Step-4-TTS-Workflow.ipynb index 711996ee..a55ec8e2 100644 --- a/recipes/quickstart/NotebookLlama/Step-4-TTS-Workflow.ipynb +++ b/recipes/quickstart/NotebookLlama/Step-4-TTS-Workflow.ipynb @@ -119,7 +119,9 @@ "source": [ "Generally in life, you set your device to \"cuda\" and are happy. \n", "\n", - "However, sometimes you want to compensate for things and set it to `cuda:7` to tell the system but even more-so the world that you have 8 GPUS:" + "However, sometimes you want to compensate for things and set it to `cuda:7` to tell the system but even more-so the world that you have 8 GPUS.\n", + "\n", + "Jokes aside please set `device = \"cuda\"` below if you're using a single GPU node." ] }, { @@ -289,7 +291,7 @@ "source": [ "import pickle\n", "\n", - "with open('./podcast_ready_data.pkl', 'rb') as file:\n", + "with open('./resources/podcast_ready_data.pkl', 'rb') as file:\n", " PODCAST_TEXT = pickle.load(file)" ] }, @@ -631,7 +633,7 @@ } ], "source": [ - "final_audio.export(\"_podcast.mp3\", \n", + "final_audio.export(\"./resources/_podcast.mp3\", \n", " format=\"mp3\", \n", " bitrate=\"192k\",\n", " parameters=[\"-q:a\", \"0\"])" diff --git a/recipes/quickstart/NotebookLlama/requirements.txt b/recipes/quickstart/NotebookLlama/requirements.txt new file mode 100644 index 00000000..34a27dc8 --- /dev/null +++ b/recipes/quickstart/NotebookLlama/requirements.txt @@ -0,0 +1,15 @@ +# Core dependencies +PyPDF2>=3.0.0 +torch>=2.0.0 +transformers>=4.46.0 +accelerate>=0.27.0 +rich>=13.0.0 +ipywidgets>=8.0.0 +tqdm>=4.66.0 + +# Optional but recommended +jupyter>=1.0.0 +ipykernel>=6.0.0 + +# Warning handling +warnings>=0.1.0 \ No newline at end of file -- GitLab