TaskMatrix README

The project's README from github.com/chenfei-wu/TaskMatrix. As one markdown file: README.md.

TaskMatrix

TaskMatrix connects ChatGPT and a series of Visual Foundation Models to enable sending and receiving images during chatting.

See our paper: Visual ChatGPT: Talking, Drawing and Editing with Visual Foundation Models

Open in Spaces Open in Colab

Updates:

Insight & Goal:

On the one hand, ChatGPT (or LLMs) serves as a general interface that provides a broad and diverse understanding of a wide range of topics. On the other hand, Foundation Models serve as domain experts by providing deep knowledge in specific domains. By leveraging both general and deep knowledge, we aim at building an AI that is capable of handling various tasks.

Demo

System Architecture

Logo

Quick Start

# clone the repo
git clone https://github.com/microsoft/TaskMatrix.git

# Go to directory
cd visual-chatgpt

# create a new environment
conda create -n visgpt python=3.8

# activate the new environment
conda activate visgpt

#  prepare the basic environments
pip install -r requirements.txt
pip install  git+https://github.com/IDEA-Research/GroundingDINO.git
pip install  git+https://github.com/facebookresearch/segment-anything.git

# prepare your private OpenAI key (for Linux)
export OPENAI_API_KEY={Your_Private_Openai_Key}

# prepare your private OpenAI key (for Windows)
set OPENAI_API_KEY={Your_Private_Openai_Key}

# Start TaskMatrix !
# You can specify the GPU/CPU assignment by "--load", the parameter indicates which 
# Visual Foundation Model to use and where it will be loaded to
# The model and device are separated by underline '_', the different models are separated by comma ','
# The available Visual Foundation Models can be found in the following table
# For example, if you want to load ImageCaptioning to cpu and Text2Image to cuda:0
# You can use: "ImageCaptioning_cpu,Text2Image_cuda:0"

# Advice for CPU Users
python visual_chatgpt.py --load ImageCaptioning_cpu,Text2Image_cpu

# Advice for 1 Tesla T4 15GB  (Google Colab)                       
python visual_chatgpt.py --load "ImageCaptioning_cuda:0,Text2Image_cuda:0"
                                
# Advice for 4 Tesla V100 32GB                            
python visual_chatgpt.py --load "Text2Box_cuda:0,Segmenting_cuda:0,
    Inpainting_cuda:0,ImageCaptioning_cuda:0,
    Text2Image_cuda:1,Image2Canny_cpu,CannyText2Image_cuda:1,
    Image2Depth_cpu,DepthText2Image_cuda:1,VisualQuestionAnswering_cuda:2,
    InstructPix2Pix_cuda:2,Image2Scribble_cpu,ScribbleText2Image_cuda:2,
    SegText2Image_cuda:2,Image2Pose_cpu,PoseText2Image_cuda:2,
    Image2Hed_cpu,HedText2Image_cuda:3,Image2Normal_cpu,
    NormalText2Image_cuda:3,Image2Line_cpu,LineText2Image_cuda:3"

GPU memory usage

Here we list the GPU memory usage of each visual foundation model, you can specify which one you like:

Foundation Model GPU Memory (MB)
ImageEditing 3981
InstructPix2Pix 2827
Text2Image 3385
ImageCaptioning 1209
Image2Canny 0
CannyText2Image 3531
Image2Line 0
LineText2Image 3529
Image2Hed 0
HedText2Image 3529
Image2Scribble 0
ScribbleText2Image 3531
Image2Pose 0
PoseText2Image 3529
Image2Seg 919
SegText2Image 3529
Image2Depth 0
DepthText2Image 3531
Image2Normal 0
NormalText2Image 3529
VisualQuestionAnswering 1495

Acknowledgement

We appreciate the open source of the following projects:

Hugging Face   LangChain   Stable Diffusion   ControlNet   InstructPix2Pix   CLIPSeg   BLIP  

Contact Information

For help or issues using the TaskMatrix, please submit a GitHub issue.

For other communications, please contact Chenfei WU ([email protected]) or Nan DUAN ([email protected]).

Trademark Notice

Trademarks This project may contain trademarks or logos for projects, products, or services. Authorized use of Microsoft trademarks or logos is subject to and must follow Microsoft’s Trademark & Brand Guidelines. Use of Microsoft trademarks or logos in modified versions of this project must not cause confusion or imply Microsoft sponsorship. Any use of third-party trademarks or logos are subject to those third-party’s policies.

Disclaimer

The recommended models in this Repo are just examples, used for scientific research exploring the concept of task automation and benchmarking with the paper published at Visual ChatGPT: Talking, Drawing and Editing with Visual Foundation Models. Users can replace the models in this Repo according to their research needs. When using the recommended models in this Repo, you need to comply with the licenses of these models respectively. Microsoft shall not be held liable for any infringement of third-party rights resulting from your usage of this repo. Users agree to defend, indemnify and hold Microsoft harmless from and against all damages, costs, and attorneys' fees in connection with any claims arising from this Repo. If anyone believes that this Repo infringes on your rights, please notify the project owner email.

TaskMatrix (chenfei-wu/TaskMatrix)

Searching Database…

这是什么?TaskMatrix(也称 Visual ChatGPT)把 ChatGPT 与一组视觉基础模型连接起来,让你在聊天时可以发送和接收图片,由大语言模型来绘制、编辑和分析图片。
这是现成的聊天机器人应用,还是需要我自己用代码运行的东西?它是一个 Python 研究代码库,不是打包好的应用。你需要从命令行启动,并选择要加载哪些基础模型(如 Stable Diffusion、Inpainting、GroundingDINO 等)。
我该怎么让它运行起来?运行主脚本,并加上 --load 参数,列出你想启用的基础模型和 GPU 设备,例如同时加载检测、分割、图像修复和图像描述模型。
这是可以投入生产使用的产品,还是只是研究演示?维护者明确表示,所含模型只是用于研究探索任务自动化的示例,并非成品;并提醒你必须遵守每个底层模型各自的许可协议。
这是面向哪些人的?它面向对结合大语言模型与视觉模型感兴趣的研究人员和开发者,而不是寻找精致聊天应用的普通用户。
TaskMatrix 中的“模板”是什么?模板是预先定义好的执行流程(一个设置了 templatemodel = True 的 Python 类),它可以串联多个基础模型,甚至启动一个新的 ChatGPT 会话,来完成复杂任务,例如 InfinityOutPainting 将图片扩展到任意尺寸。
TaskMatrix 结合了哪些基础模型?它整合了用于文本引导边界框的 GroundingDINO、用于遮罩的 segment-anything、用于编辑的 Stable Diffusion 修复及 ControlNet 变体,以及用于图像描述和视觉问答的 InstructPix2Pix、CLIPSeg 和 BLIP。
它支持英文以外的语言吗?支持,TaskMatrix 在英文之外还增加了中文支持。
为什么要把 ChatGPT 和视觉模型结合起来,而不只用 ChatGPT?单独使用 ChatGPT 只能理解文本中的宽泛通用知识;与特定领域的基础模型配合后,系统才能真正看见、生成和编辑图片,而不只是描述图片。
Creator
chenfei-wu
Size
40.2 MB
Stars
34K
Updated
CommitJun 29
Age
3y
Commits · 90 Days