Giter Site home page Giter Site logo

voice-assistant's Introduction

A Simple Voice Assistant Script

English | 简体中文

This is a simple Python script project that allows dialogue with a local large language model through voice.

The voice recognition part of this project is from the Apple MLX example repo, and the textual responses are generated using the Yi model from 01.AI. For more details, see the [Acknowledgments](## Acknowledgments) section.

File Structure

├───main.py
├───models
├───prompts
├───recordings
├───tools
│   └───list_microphones.py
├───whisper

This project is a single-script project, with main.py containing all program logic. The models/ folder stores model files. prompts/ contains prompt words. recordings/ holds temporary recordings. tools/list_microphones.py is a simple script to view the microphone list, used in main.py to specify the microphone number. whisper/ is from the Apple MLX example repo, used for recognizing user's voice input.

Installation Guide

This project is based on the Python programming language, and the Python version used for program operation is 3.11.5. It is recommended to configure the Python environment using Anaconda. The following setup process has been tested and passed on macOS systems. Windows and Linux can use speech_recognition and pyttsx3 to replace the whisper and say commands mentioned below. The following are console/terminal/shell commands.

Environment Configuration

conda create -n VoiceAI python=3.11
conda activate VoiceAI
pip install -r requirements.txt
CMAKE_ARGS="-DLLAMA_METAL=on" pip install llama-cpp-python

# Install audio processing tools
brew install portaudio
pip install pyaudio

Model Files

The model files are stored in the models/ folder and specified in the script via the MODEL_PATH variable. It is recommended to download the gguf format models from TheBloke and XeIaso, where the 6B model has a smaller memory footprint:

Model Files

The voice recognition part of this project is based on OpenAI's whisper model, its implementation comes from the Apple MLX example repo. The version used in this project is from January 2024, #80d1867. In the future, users can fetch new versions as needed.

The responses in this project are generated by the large language model Yi from 01.AI, where Yi-34B-Chat is more powerful. The 8-bit quantized version made by TheBloke has a memory footprint of 39.04 GB and is recommended for use if hardware conditions permit. This model runs locally based on the LangChain framework and llama.cpp by Georgi Gerganov.

Thank you to all selfless programmers for their contributions to the open-source community!

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.