Skip to content

Ask About Symptoms is an LLM that has an in-depth understanding of health. The creator of the original version known as DoctorGPT, Siraj Raval, says it works offline, it's cross-platform, & the health data is said to be kept private. We are learning how to build this in our community.

Notifications You must be signed in to change notification settings

GenerativeAIAffiliates/AskAboutSymptomsGPT

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

45 Commits
 
 
 
 

Repository files navigation

Ask About Symptoms GPT

Digital AI art created by Prisi.la 8/12/23 https://www.generativeaiaffiliates.com/

Overview

Ask About Symptoms GPT is a Large Language Model. This is an open-source project with a mission to provide everyone with their own symptom health checker. Ask About Symptoms GPT is a version of Meta's Llama2 7 billion parameters Large Language Model that was fine-tuned on a Medical Dialogue Dataset, then further improved using Reinforcement Learning & Constitutional AI. Since the model is only 3 Gigabytes in size, it fits on any local device, so there is no need to pay an API to use it. It's free, made for offline usage which preserves patient confidentiality, and it's available on iOS, Android, and Web. Pull requests for feature additions and improvements are encouraged.

  • Credit: Siraj Raval • Ask About Symptoms is an LLM that has an in-depth understanding of health gathered by dialogue that has been set to completion and are the large corpus of data. The creator of the original version known as DoctorGPT, Siraj Raval, says it works offline, it's cross-platform, & the health data is said to be kept private. We are actively learning how to build this in our community.

Please note some urls will be replaced with new ones for our project/tool.

Dependencies

  • Numpy (Use matrix math operations)
  • PyTorch (Build Deep Learning models)
  • Datasets (Access datasets from huggingface hub)
  • Huggingface_hub (access huggingface data & models)
  • Transformers (Access models from HuggingFace hub)
  • Trl (Transformer Reinforcement Learning. And fine-tuning.)
  • Bitsandbytes (makes models smaller, aka 'quantization')
  • Sentencepiece (Byte Pair Encoding scheme aka 'tokenization')
  • OpenAI (Create synthetic fine-tuning and reward model data)
  • TVM (Tensor Virtual Machine, converts onnx model to effiicent cross-platform use)
  • Peft (Parameter Efficient Fine Tuning, use low rank adaption (LoRa) to fine-tune)
  • Onnx (Convert trained model to universal format)

Installation

Install all dependencies in one line using pip

pip install numpy torch datasets huggingface_hub transformers trl bitsandbytes sentencepiece openai tvm peft onnx

Training

In order to train the model, you can run the training.ipynb notebook locally or remotely via a cloud service like Google Colab Pro. The training process requires a GPU, and if you don't have one then the most accessible option i found was using Google Colab Pro which costs $10/month. The total training time for Ask About Symptoms GPT including supervised fine-tuning of the initial LLama model on custom medical data, as well as further improving it via Reinforcement Learning from Constitional AI Feedback took 24 hours on a paid instance of Google Colab. If you're interested in learning more about how this process works, details are in the training.ipynb notebook.

Cloud Training

Open In Colab click here: https://colab.research.google.com/drive/1LxRgY1chk0cmJx6iFE3hWefy3WiTKF_W?usp=sharing

Local Training

git clone https://github.com/llSourcell/DoctorGPT.git  ##replace with AskAboutSymptomsGPT.git
jupyter training.ipynb

Get jupyter here

Usage

iOS

  • Step 1: Download the iOS Machine Learning Compilation Chat Repository
  • Step 2: Follow the installation steps
  • Step 3: Once the app is running on your iOS device or simulator, tap "add model variant"
  • Step 4: Enter the URL for the latest DoctorGPT model to download it: https://huggingface.com/llsourcell/doctorgpt
  • Step 5: Tap 'Add Model' and start chatting locally, inference runs on device. No internet connection needed!

Android

  • Step 1: Download the Android Machine Learning Compilation Chat Repository
  • Step 2: Follow the installation steps
  • Step 3: Tap "add model variant"
  • Step 4: Enter the URL for the latest DoctorGPT model to download it: https://huggingface.com/llsourcell/doctorgpt
  • Step 5: Tap 'Add Model' and start chatting locally! No internet needed.

Web (TODO)

As an experiment in Online Learning using actual human feedback, i want to deploy the model as a Flask API with a React front-end. In this case, anyone can chat with the model at this URL. After each query, a human can rate the model's response. This rating is then used to further improve the model's performance through reinforcement learning. to run the app, download flask and then you can run:

flask run

Then visit localhost:3000 to interact with it! You can also deploy to vercel

Credits

Meta, MedAlpaca, Apache, MLC Chat & OctoML

About

Ask About Symptoms is an LLM that has an in-depth understanding of health. The creator of the original version known as DoctorGPT, Siraj Raval, says it works offline, it's cross-platform, & the health data is said to be kept private. We are learning how to build this in our community.

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • Jupyter Notebook 100.0%