Skip to content

Commit

Permalink
Add CURATED_REPOS
Browse files Browse the repository at this point in the history
  • Loading branch information
daavoo committed Nov 22, 2024
1 parent d2c75c9 commit 7a7e39c
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 9 deletions.
20 changes: 13 additions & 7 deletions demo/app.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
from huggingface_hub import list_repo_files

from opennotebookllm.preprocessing import DATA_LOADERS, DATA_CLEANERS
from opennotebookllm.inference import load_LLama_model
from opennotebookllm.inference import load_llama_cpp_model
from opennotebookllm.inference import text_to_text

PODCAST_PROMPT = """
Expand All @@ -15,7 +15,14 @@
Text:
"""

REPO = "allenai/OLMoE-1B-7B-0924-Instruct-GGUF"
CURATED_REPOS = [
"allenai/OLMoE-1B-7B-0924-Instruct-GGUF",
"MaziyarPanahi/SmolLM2-1.7B-Instruct-GGUF",
"microsoft/Phi-3-mini-4k-instruct-gguf",
"HuggingFaceTB/SmolLM2-360M-Instruct-GGUF",
"Qwen/Qwen2.5-1.5B-Instruct-GGUF",
"Qwen/Qwen2.5-3B-Instruct-GGUF",
]

uploaded_file = st.file_uploader(
"Choose a file", type=["pdf", "html", "txt", "docx", "md"]
Expand Down Expand Up @@ -43,20 +50,19 @@
)
clean_text = clean_text[: 4096 * 3]

repo_name = st.selectbox("Select Repo", CURATED_REPOS)
model_name = st.selectbox(
"Select Model",
[
x
for x in list_repo_files(REPO)
if ".gguf" in x
# The float16 is too big for the 16GB RAM codespace
and "f16" not in x
for x in list_repo_files(repo_name)
if ".gguf" in x.lower() and ("q8" in x.lower() or "fp16" in x.lower())
],
index=None,
)
if model_name:
with st.spinner("Downloading and Loading Model..."):
model = load_LLama_model(model_id=f"{REPO}/{model_name}")
model = load_llama_cpp_model(model_id=f"{repo_name}/{model_name}")

system_prompt = st.text_area("Podcast generation prompt", value=PODCAST_PROMPT)

Expand Down
2 changes: 1 addition & 1 deletion src/opennotebookllm/inference/__init__.py
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
from .text_to_text import load_LLama_model as load_LLama_model
from .model_loaders import load_llama_cpp_model as load_llama_cpp_model
from .text_to_text import text_to_text as text_to_text
2 changes: 1 addition & 1 deletion src/opennotebookllm/inference/model_loaders.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
from llama_cpp import Llama


def load_LLama_model(
def load_llama_cpp_model(
model_id: str,
) -> Llama:
"""
Expand Down

0 comments on commit 7a7e39c

Please sign in to comment.