Skip to content

paipai-Studio/BioMANIA

Β 
Β 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 

Repository files navigation

BioMANIA Logo

BioMANIA

Paper GitHub stars Documentation Status Python unit tests License

Docker Version Railway

Welcome to the BioMANIA! This guide provides detailed instructions on how to set up, run, and interact with the BioMANIA chatbot interface, which connects seamlessly with various APIs to deliver information across numerous libraries and frameworks.

Project Overview:

🌟 We warmly invite you to share your trained models and datasets in our issues section, making it easier for others to utilize and extend your work, thus amplifying its impact. Feel free to explore and provide feedback on tools shared by other contributors as well! πŸš€πŸ”

We welcome πŸ€— you to refer to the Q&A section if you encounter any problems during your exploration and contribute some issues for discussion! 🧐 πŸ‘¨β€πŸ’»

Video demo

Our demonstration showcases how to utilize a chatbot to simultaneously use scanpy and squidpy in a single conversation, including loading data, invoking functions for analysis, and presenting outputs in the form of code, images, and tables

We also offer a command-line interface (CLI) demo through the terminal.

We also offer a GPTs demo (under developing).

Web access online demo

We provide an online demo hosted on our server!

Quick start

We provide several ways to run the service terminal CLI, Docker, railway, python script. Among those, Docker is the easiest way to start.

Run with terminal CLI

# setup the environment, data, PYTHONPATH
git clone https://github.com/batmen-lab/BioMANIA.git
# download the data and retriever model from drive, and put them to the BioMANIA/data/standard_process/{LIB} and BioMANIA/hugging_models/retriever_model_finetuned/{LIB}
cd BioMANIA
conda create -n biomania python=3.10
conda activate biomania
pip install -r requirements.txt --index-url https://pypi.org/simple
export PYTHONPATH=$PYTHONPATH:$(pwd)
# CLI service quick start!
python -m src.deploy.inference_dialog_server # CLI need to be run together with backend service
python -m src.deploy.cli # open and run this in another terminal

Run with Docker

For ease of use, we provide Docker images for several tools. You can refer the detailed tools list from dockerhub.

# Pull back-end service and front-end UI service with:
docker pull chatbotuibiomania/biomania-together:v1.1.9-${LIB}-cuda12.1-ubuntu22.04

Start service with

# run on gpu
docker run -e LIB=${LIB} -e OPENAI_API_KEY=[your_openai_api_key] --gpus all -d -p 3000:3000 chatbotuibiomania/biomania-together:v1.1.9-${LIB}-cuda12.1-ubuntu22.04
# or on cpu
docker run -e LIB=${LIB} -e OPENAI_API_KEY=[your_openai_api_key] -d -p 3000:3000 chatbotuibiomania/biomania-together:v1.1.9-${LIB}-cuda12.1-ubuntu22.04

Then check UI service with http://localhost:3000/en.

Important Tips for Running Docker Without Bugs:

  • To run docker on GPU, you need to install nvidia-docker and nvidia container toolkit. Run docker info | grep "Default Runtime" to check if your device can run docker with gpu.
  • Feel free to adjust the cuda image version inside the Dockerfile to configure it for different CUDA settings which is compatible for your device.

We understand the desire to run the service on a server and visualize locally. You can initiate the ngrok service by running this script on your server:

ngrok http 3000

then get the url like https://[ngrok_id].ngrok-free.app and copy it to chrome to start!

Run with Railway

Deploy on Railway

To use railway, you'll need to fill in the OpenAI_API_KEY in the Variables page of the biomania-backend service. Then, manually enable Public Domain in the Settings/Networking session for both front-end and back-end service. Copy the url from back-end as https://[copied url] and paste it in BACKEND_URL in front-end Variables page. For front-end url, paste it to the browser to access the frontend.

Run with script

For instance, let's take scanpy as an example. Detailed library support information can be found in the Q&A

Setting up for environment

To prepare your environment for the BioMANIA project, follow these steps:

  1. Clone the repository and install dependencies:
git clone https://github.com/batmen-lab/BioMANIA.git
cd BioMANIA
conda create -n biomania python=3.10
conda activate biomania
pip install -r requirements.txt --index-url https://pypi.org/simple
export PYTHONPATH=$PYTHONPATH:$(pwd)

(Optional) 240421: We provide Git installation. We will later provide a version that is compatible with external data support.

pip install git+https://github.com/batmen-lab/BioMANIA.git
  1. Set up your OpenAI API key in the BioMANIA/.env file.
"OPENAI_API_KEY"="your-openai-api-key-here"
  • For inference purposes, a standard OpenAI API key is sufficient.
  • If you intend to use functionalities such as instruction generation or GPT API predictions, a paid OpenAI account is required as it may reach rate limit.
  • Feel free to switch to model_name='gpt-3.5-turbo-0125' or gpt-4-0125-preview in src/models/model.py if you want.

Prepare for Data and Model

Download the necessary data and models from our Google Drive link or Baidu Drive link. For those library data, you can download only the one you need.

We provide a script for downloading models and datas from Google Drive for scanpy as an example. This works if you are accessible to google. And don't forget to rename the retriever model multicorpus as your lib name for usage.

sh src/download_data_model.sh

Organize the downloaded files at BioMANIA/data or BioMANIA/hugging_models as follows (base are necessary):

data
β”œβ”€β”€ conversations
β”œβ”€β”€ others-data
└── standard_process
    β”œβ”€β”€ base
    β”‚Β Β  β”œβ”€β”€ API_composite.json
    β”‚   └── ...
    β”œβ”€β”€ scanpy
    β”‚Β Β  β”œβ”€β”€ API_composite.json
    β”‚Β Β  └── ...
    β”œβ”€β”€ {LIB}
    β”‚Β Β  β”œβ”€β”€ API_composite.json
    β”‚Β Β  └── ...
    └── ...

hugging_models
└── retriever_model_finetuned
    β”œβ”€β”€ {LIB}
    └── ...

By meticulously following the steps above, you'll have all the essential data and models perfectly organized for the project.

We also offer some demo chat, you can find them in ./examples. Notice that these demo chat are converted from the PyPI readthedoc tutorials. You can check the original tutorial link through the tutorial_links.txt.

Prepare for front-end UI service

This is compatible with Node.js version 19.

# Under folder BioMANIA/chatbot_ui_biomania
npm install && npm run build

Inference with pretrained models

Start both services for back-end and front-end UI with:

# Under folder `BioMANIA/`
sh start_script.sh

Your chatbot server is now operational at http://localhost:3000/en, primed to process user queries.

When selecting different libraries on the UI page, the retriever's path will automatically be changed based on the library selected

Build your APP!

Please refer to the separate README for tutorials that supporting converting different coding tools to our APP.

Share your APP!

If you want to share your pretrained APP to others, there are two ways.

Share docker

You can build docker and push to dockerhub, and share your docker image url in our issue. For environment setting of your tool, please refer to BioMANIA/docker_utils/{LIB}/ to add the env files, or modify the Dockerfile to build your environment.

# cd BioMANIA
docker build --build-arg LIB=[your_tool_name] -t [docker_image_name] -f Dockerfile ./
# (optional)push to docker
docker push [your_docker_repo]/[docker_image_name]:[tag]

Notice if you want to include some data inside the docker, please modify the Dockerfile carefully to copy the folders to /app. Also add your PyPI or Git pip install url to the requirements.txt before your packaging for docker.

Share data/models

You can just share your data and hugging_models folder and logo image by drive link to our issue.

Reference and Acknowledgments

We extend our gratitude to the following references:

Thank you for choosing BioMANIA. We hope this guide assists you in navigating through our project with ease.

Version History

  • v1.1.10 (2024-04-21)
    • Add add git installation, add basic API documentation, add PyPI packaging support.
    • Add basic pytest cases.
    • Add terminal CLI with its video demo, and Colab demo (Under developing).

view version_history for more details!

Star History

Star History Chart

About

No description, website, or topics provided.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • Jupyter Notebook 50.5%
  • Python 36.3%
  • TypeScript 12.1%
  • Shell 0.7%
  • Dockerfile 0.2%
  • JavaScript 0.1%
  • Other 0.1%