Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Local wisper #1091

Closed
wants to merge 20 commits into from
Closed
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
working model wisper
  • Loading branch information
aadityamundhalia committed Sep 4, 2023
commit 76498fc3d973380ad383e5b21f5ea49d6ad29628
1 change: 1 addition & 0 deletions .backend_env.example
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ MAX_BRAIN_PER_USER=5
#Private LLM Variables
PRIVATE=False
MODEL_PATH=./local_models/ggml-gpt4all-j-v1.3-groovy.bin
WISPER_LOCAL=True
gozineb marked this conversation as resolved.
Show resolved Hide resolved

#RESEND
RESEND_API_KEY=<change-me>
Expand Down
1 change: 1 addition & 0 deletions backend/models/settings.py
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ class BrainSettings(BaseSettings):
class LLMSettings(BaseSettings):
private: bool = False
model_path: str = "./local_models/ggml-gpt4all-j-v1.3-groovy.bin"
wisper_local: bool = True


def get_supabase_client() -> Client:
Expand Down
5 changes: 1 addition & 4 deletions backend/parsers/wisper.py
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Rename to whisper with an h

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

done

gozineb marked this conversation as resolved.
Show resolved Hide resolved
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@
from langchain.schema import Document
from langchain.text_splitter import RecursiveCharacterTextSplitter
from models import Brain, File
from models.settings import get_documents_vector_store
from utils.file import compute_sha1_from_content
from utils.vectors import Neurons

Expand All @@ -19,8 +18,7 @@ async def process_wisper(
temp_filename = None
file_sha = ""
dateshort = time.strftime("%Y%m%d-%H%M%S")
file_meta_name = f"txt/audiotranscript_{dateshort}.txt"
documents_vector_store = get_documents_vector_store()
file_meta_name = f"txt/audiotranscript_{file.file.filename}_{dateshort}.txt"
model = whisper.load_model("base")

try:
Expand Down Expand Up @@ -74,7 +72,6 @@ async def process_wisper(
for text in texts
]

# documents_vector_store.add_documents(docs_with_metadata)
for doc in docs_with_metadata: # pyright: ignore reportPrivateUsage=none
neurons = Neurons()
created_vector = neurons.create_vector(doc, user_openai_api_key)
Expand Down
4 changes: 2 additions & 2 deletions backend/utils/processors.py
gozineb marked this conversation as resolved.
Show resolved Hide resolved
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@
".md": process_markdown,
".markdown": process_markdown,
".m4a": process_audio,
".mp3": process_audio,
".mp3": process_wisper,
".webm": process_audio,
".mp4": process_wisper,
".mpga": process_audio,
Expand Down Expand Up @@ -52,7 +52,7 @@ async def filter_file(
):
await file.compute_file_sha1()

# print("file sha1", file.file_sha1)
print("file sha1", file.file_sha1)
file_exists = file.file_already_exists()
file_exists_in_brain = file.file_already_exists_in_brain(brain_id)

Expand Down