Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

License

NotificationsYou must be signed in to change notification settings

dawnmsg/TaskMatrix

 
 

TaskMatrix connects ChatGPT and a series of Visual Foundation Models to enablesending andreceiving images during chatting.

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

Open in SpacesOpen in Colab

Updates:

  • Now TaskMatrix supportsGroundingDINO andsegment-anything! Thanks@jordddan for his efforts. For the image editing case,GroundingDINO is first used to locate bounding boxes guided by given text, thensegment-anything is used to generate the related mask, and finally stable diffusion inpainting is used to edit image based on the mask.

    • Firstly, runpython visual_chatgpt.py --load "Text2Box_cuda:0,Segmenting_cuda:0,Inpainting_cuda:0,ImageCaptioning_cuda:0"
    • Then, sayfind xxx in the image orsegment xxx in the image.xxx is an object. TaskMatrix will return the detection or segmentation result!
  • Now TaskMatrix can support Chinese! Thanks to@Wang-Xiaodong1899 for his efforts.

  • We propose thetemplate idea in TaskMatrix!

    • A template is apre-defined execution flow that assists ChatGPT in assembling complex tasks involving multiple foundation models.
    • A template contains theexperiential solution to complex tasks as determined by humans.
    • A template caninvoke multiple foundation models or evenestablish a new ChatGPT session
    • To define atemplate, simply adding a class with attributestemplate_model = True
  • Thanks to@ShengmingYin and@thebestannie for providing a template example inInfinityOutPainting class (see the following gif)

    • Firstly, runpython visual_chatgpt.py --load "Inpainting_cuda:0,ImageCaptioning_cuda:0,VisualQuestionAnswering_cuda:0"
    • Secondly, sayextend the image to 2048x1024 to TaskMatrix!
    • By simply creating anInfinityOutPainting template, TaskMatrix can seamlessly extend images to any size through collaboration with existingImageCaptioning,Inpainting, andVisualQuestionAnswering foundation models,without the need for additional training.
  • TaskMatrix needs the effort of the community! We crave your contribution to add new and interesting features!

Insight & Goal:

On the one hand,ChatGPT (or LLMs) serves as ageneral interface that provides a broad and diverse understanding of awide range of topics. On the other hand,Foundation Models serve asdomain experts by providing deep knowledge in specific domains.By leveragingboth 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 repogit clone https://github.com/microsoft/TaskMatrix.git# Go to directorycd visual-chatgpt# create a new environmentconda create -n visgpt python=3.8# activate the new environmentconda activate visgpt#  prepare the basic environmentspip install -r requirements.txtpip install  git+https://github.com/IDEA-Research/GroundingDINO.gitpip 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 Userspython 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 ModelGPU Memory (MB)
ImageEditing3981
InstructPix2Pix2827
Text2Image3385
ImageCaptioning1209
Image2Canny0
CannyText2Image3531
Image2Line0
LineText2Image3529
Image2Hed0
HedText2Image3529
Image2Scribble0
ScribbleText2Image3531
Image2Pose0
PoseText2Image3529
Image2Seg919
SegText2Image3529
Image2Depth0
DepthText2Image3531
Image2Normal0
NormalText2Image3529
VisualQuestionAnswering1495

Acknowledgement

We appreciate the open source of the following projects:

Hugging FaceLangChainStable DiffusionControlNetInstructPix2PixCLIPSegBLIP

Contact Information

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

For other communications, please contact Chenfei WU (chewu@microsoft.com) or Nan DUAN (nanduan@microsoft.com).

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 followMicrosoft’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.

About

No description, website, or topics provided.

Resources

License

Code of conduct

Contributing

Security policy

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • Python80.5%
  • HTML19.2%
  • Dockerfile0.3%

[8]ページ先頭

©2009-2025 Movatter.jp