Open-source project
chenfei-wu/TaskMatrix avatar
chenfei-wu/TaskMatrix

TaskMatrix: Wiring ChatGPT to Visual Foundation Models for Image Chat

TaskMatrix

33,885 stars3,180 forksPythonNOASSERTION

At a glance

What is it?
TaskMatrix (the code behind the Visual ChatGPT paper) lets a ChatGPT session call visual foundation models so users can send and receive images. It is an orchestration layer, not a single model, and its value depends on how many templates you are willing to add.
Who is it for?
Adopt TaskMatrix if you already rely on ChatGPT and want a research-grade way to chain visual models like Stable Diffusion, ControlNet, and GroundingDINO through natural language. Do not adopt it for production: the README shows no API stability, no release history, and a license marked NOASSERTION, so you must verify every bundled model's license and the OpenAI key handling yourself.
Can I use it commercially?
Check first. The repository uses a licence we do not classify automatically, so read its LICENSE file before any commercial use.
Is it still maintained?
Probably not. The repository last received commits 35 months ago, on January 6, 2024.
What is it written in?
Mainly Python, according to GitHub's language statistics.

Answers come from the project's GitHub data, last synced on November 23, 2026, and from our analysis. They are not legal advice.

From daily snapshots

Star history

  • chenfei-wu/TaskMatrix33,885 ★ · -125
Star history
Repository2026-08-182026-11-23
chenfei-wu/TaskMatrix34k33.9k

-125 Stars in the last 97 days, measured from the daily GitHub snapshot. Compare with other projects

Editorial analysis

What TaskMatrix Actually Is

TaskMatrix is the reference implementation for the Visual ChatGPT paper. It is not a visual model itself. It is a Python program that gives ChatGPT the ability to send and receive images by routing requests to a set of visual foundation models. The README describes ChatGPT as a general interface and foundation models as domain experts. That split is the core idea: the language model decides which visual tool to call, and the tool does the heavy lifting. The target user is a researcher or engineer who wants to prototype multi-modal chat flows without training a new model. The repository acknowledges Hugging Face, LangChain, Stable Diffusion, ControlNet, InstructPix2Pix, CLIPSeg, and BLIP as open-source projects it appreciates, so the audience is people comfortable assembling those pieces.

How the Orchestration Works

The mechanism is visible in the code structure and the README's template description. A template is a pre-defined execution flow that assists ChatGPT in assembling complex tasks involving multiple foundation models. Each template is a class with the attribute template_model = True. When a user says something like extend the image to 2048x1024, ChatGPT matches that request to a template. The InfinityOutPainting template then works with the existing ImageCaptioning, Inpainting, and VisualQuestionAnswering models without additional training. That is the key architectural point: TaskMatrix does not fine-tune anything. It relies on ChatGPT's ability to select the right template from a list of available tools. For example, the image editing flow uses GroundingDINO to locate bounding boxes from text, segment-anything to generate a mask, and stable diffusion inpainting to edit the image. Each foundation model is loaded as a separate module, and the GPU memory table shows that many models consume over 3 GB each.

Getting It Running: Commands and Config

The Quick Start section gives concrete steps. You clone the repository, create a conda environment with Python 3.8, and install dependencies from requirements.txt. Then you install two external packages directly from GitHub: GroundingDINO and segment-anything. After that, you set your OpenAI API key as an environment variable, either export OPENAI_API_KEY on Linux or set OPENAI_API_KEY on Windows. The program is launched with a command that specifies which models to load and on which GPU. For example: python visual_chatgpt.py --load "Text2Box_cuda:0,Segmenting_cuda:0,Inpainting_cuda:0,ImageCaptioning_cuda:0". The --load argument is the main configuration surface. You choose which foundation models to activate and assign each to a CUDA device. The README also shows a second example for the outpainting template: python visual_chatgpt.py --load "Inpainting_cuda:0,ImageCaptioning_cuda:0,VisualQuestionAnswering_cuda:0".

GPU Memory: The Real Cost of Entry

The README includes a table of GPU memory usage for each visual foundation model. The numbers are specific and useful. ImageEditing takes 3981 MB, Text2Image takes 3385 MB, and CannyText2Image takes 3531 MB. Some models like Image2Canny and Image2Depth use 0 MB in the table. But the generation models are heavy, at roughly 3.4 to 4 GB each. The table is a practical planning tool. The README does not state the total memory for a typical session, so you must add the numbers yourself. For a single 8 GB card, you can only load one or two of the larger models. That constraint shapes who can use this project.

The Template Idea: Power and Fragility

The template mechanism is the project's most distinctive contribution. Instead of hard-coding a pipeline, you define a class with template_model = True, and ChatGPT decides when to invoke it. The InfinityOutPainting example shows how a template can chain multiple models and even start a new ChatGPT session. That is elegant for research. But it also introduces a failure mode: the system depends on ChatGPT correctly interpreting user requests and choosing the right template. If the user says something ambiguous, ChatGPT might call the wrong model or no model at all. The README does not describe any error handling or fallback logic. The template approach also means every new task requires writing a new Python class and testing it against ChatGPT's behavior. That is not a zero-cost extension. The README explicitly asks the community to contribute new and interesting features.

Limitations and Wrong Use Cases

The most obvious limitation is the dependency on a private OpenAI API key. TaskMatrix is not a self-contained system. It requires an external ChatGPT API, and the README gives no guidance on rate limits, cost, or version compatibility. If OpenAI changes the API, the project may break without warning. The license is listed as NOASSERTION, which means GitHub did not identify a standard license; the repository does contain a LICENSE.txt, so read its terms before adopting. The README also includes a disclaimer that Microsoft is not liable for third-party rights infringements from the recommended models. Each visual model has its own license, and you must check those separately. This project is wrong for any production system that needs a stable, licensed codebase. It is also wrong for teams without a GPU that meets the memory requirements. The README shows no testing framework, no CI configuration, and no release history, so reliability is unproven.

Alternative Approaches

A direct alternative is LangChain, which TaskMatrix lists as a dependency. LangChain provides a general framework for chaining language models with tools, including image generation and retrieval. The difference is scope: LangChain is a broad orchestration library with many integrations, while TaskMatrix is a focused prototype for visual chat. LangChain gives you more control over the conversation flow and supports many model providers, but it does not come with the pre-built visual templates like InfinityOutPainting. Another alternative is to write your own pipeline using the underlying models directly. You can call Stable Diffusion and ControlNet from Python without ChatGPT in the loop. That gives you deterministic behavior and no dependency on an LLM's judgment. The trade-off is that you lose the natural language interface that TaskMatrix provides. For a researcher who wants to experiment with LLM-driven tool use, TaskMatrix is a useful starting point. For a developer who needs predictable outputs, a hand-coded pipeline is safer.

Maintenance and Upgrade Cost

The README does not mention a versioning scheme or a changelog. There are no recent releases listed. The project appears to be a research artifact tied to a paper, not a maintained library. The dependency list is long and includes packages installed directly from GitHub, which means upgrades are manual and can break. The template mechanism is tightly coupled to ChatGPT's behavior, so any change in how ChatGPT parses tool calls could require rewriting templates. Before adopting, you should contact the authors for license clarification, as the README provides contact emails. The maintenance cost is high: you will likely need to fork the repository and patch it yourself. For a one-off research demo, that is acceptable. For a long-term project, it is a serious risk.

Editorial conclusion

Adopt TaskMatrix if you already rely on ChatGPT and want a research-grade way to chain visual models like Stable Diffusion, ControlNet, and GroundingDINO through natural language. Do not adopt it for production: the README shows no API stability, no release history, and a license marked NOASSERTION, so you must verify every bundled model's license and the OpenAI key handling yourself. Before using it, check that your GPU memory covers the models you load, and confirm that the template mechanism still works with your ChatGPT version, because the project depends on an evolving external API.

Frequently asked questions

What is TaskMatrix, the Visual ChatGPT code?

TaskMatrix connects ChatGPT and a series of visual foundation models to enable sending and receiving images during a conversation. It is the implementation behind the paper Visual ChatGPT: Talking, Drawing and Editing with Visual Foundation Models, arXiv 2303.04671, and the project describes the design as pairing a general interface with domain experts.

How do I install TaskMatrix?

The quick start creates a conda environment with `conda create -n visgpt python=3.8`, activates it, runs `pip install -r requirements.txt`, then installs GroundingDINO and segment-anything from their git URLs, and sets OPENAI_API_KEY with the export form on Linux or the set form on Windows. Note that the clone command in that block points at github.com/microsoft/TaskMatrix and changes into a visual-chatgpt directory, neither of which matches this repository's tree.

How much GPU memory does TaskMatrix need?

The README publishes a table in megabytes. ImageEditing is listed at 3981, Text2Image at 3385, InstructPix2Pix at 2827, VisualQuestionAnswering at 1495, ImageCaptioning at 1209 and Image2Seg at 919, while the Image2 models other than Image2Seg are 0 and the matching Text2Image generators sit at 3529 or 3531 each. You choose which models to load with the --load list.

How do I use a TaskMatrix template?

You add a class with the attribute template_model = True, which marks it as a pre-defined execution flow that ChatGPT can assemble to handle a complex task across several models. The InfinityOutPainting example loads Inpainting, ImageCaptioning and VisualQuestionAnswering, and asking it to extend the image to 2048x1024 uses those existing models with no additional training.

Is TaskMatrix still being worked on?

The repository is not archived, but the last push was 2024-01-06 and there are no GitHub releases. The requirements file pins langchain at 0.0.101, torch at 1.13.1 and torchvision at 0.14.1, and the documented environment is Python 3.8, so the dependency set is from an earlier era than those dates. The README asks for community contributions and says issues are the way to get help.

Official sources

  1. Official README
  2. Project repository
  3. README
  4. Releases
Add this badge to your README

If you maintain this project, the badge below links readers to this analysis and shows its maintenance status from the daily GitHub snapshot. Paste the markdown into your README; add ?metric=license or ?metric=stars to the image URL for a different field.

Add this badge to your README

markdown
[![Hysen Labs](https://hysenlabs.com/badge/chenfei-wu-taskmatrix.svg)](https://hysenlabs.com/projects/chenfei-wu-taskmatrix)

Star history chart for your README

markdown
[![Star history](https://hysenlabs.com/chart/chenfei-wu-taskmatrix.svg)](https://hysenlabs.com/projects/chenfei-wu-taskmatrix)

Was this useful?