Goal: Semantic Search Setup pgvector You have a model with a field you want to make semantically searchable. Installation comes from: https://github.com/pgvector/pgvector-python Step: install pgvector on your machine Step: create a migration to activate Step: add a VectorField to your model Step: make migrations and migrate Setup sentence transformers for embeddings We will use the…
All posts in python
How to use OpenAI whisper with python
OpenAI open sourced their speech recognition model: https://github.com/openai/whisper There are 5 sizes: tiny, base, small, medium, large Note: you need to pip install openai-whisper (pypi link) Here is code to transcribe an audio file
UserWarning: FP16 is not supported on CPU; using FP32 instead
warnings.warn(“FP16 is not supported on CPU; using FP32 instead”)
Q: Are you trying to use whisper on your Mac instead of a Google Colab? Short answer: Example: Source: https://github.com/openai/whisper/discussions/301
Create Django Project with scaffolding from Django Cookiecutter
I use Django Cookiecutter (link) 🍪 because its awesome! Find your python version Hit the github page to see what python version it supports, you should match whichever provider support you have. Create project: use pyenv to set python version Note: if your pyenv install –list is not listing the newest versions, you’ll need to…
Python: Print all items in a directory
pytest (error): Requested setting ROOT_URLCONF, but settings are not configured
Trying to run pytest or coverage run -m pytest to test your Django code? The error is telling us that the code no longer knows how to find our settings module. Note that we are no longer using the manage.py command to deal with Django code and if you look at this file, one of…
How to install Python 3 on Mac using homebrew
tldr; install brew; brew install python Homebrew is a great installer for Mac and its main job is to make it easier to install packages. Step 1: Download Homebrew here “brew” hosts its package information here as “formulae“. Step 2: Use brew to install the latest version of Python $ brew install python –verbose Now you…
Installing Python and managing Python versions with pyenv (bonus venv)
Step 1: Meet your default python You are on Mac OS. When you run python in your terminal you see this. You have Python 2.7.10. This is your default python. You can do things like add > 8+8 Step 2: Meet your modules From your interpreter you can see your available modules by asking for “help”…
Levels of installing python
This is an opinionated route towards python management. Every computer may have its own set up. Level 0: “I just want to play with python” Method 1: Use and online REPL like this: https://repl.it/languages/python Level 1: “I want python on my computer” Download brew, use brew to download the latest version of python and go crazy.…