Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Decouple tasks from model engines and introduce modalities #15

Merged
merged 3 commits into from
Mar 15, 2023

Conversation

dlqqq
Copy link
Member

@dlqqq dlqqq commented Mar 14, 2023

Demo

Screen.Recording.2023-03-13.at.6.18.48.PM.mov

Description

  • Decouples tasks from model engines by introducing the concept of modalities. Defined loosely, they can be thought of as representing the input and output types for a model.

    • This is motivated by the fact that tasks are frequently shared between model engines of a common modality (e.g. txt2txt: GPT-3/ChatGPT, txt2img: DALL-E/Stable Diffusion). It is redundant to have each model engine of a common modality to re-define the default tasks they offer.
    • Each modality is associated with a string representation known as a modality ID.
    • Right now, there are only two modality IDs under Jupyter AI:
      1. txt2txt: accepts an English text prompt and generates English text that roughly corresponds to the prompt
      2. txt2img: accepts an English text prompt and generates an image that roughly corresponds to the prompt
  • Model engines now must declare what modalities they support as a class attribute. This is simply a list of modality IDs, for example:

class ChatGptModelEngine(BaseModelEngine):
    id = "chatgpt"
    name = "ChatGPT"
    modalities = [
        "txt2txt"
    ]
  • Model engines may support multiple modalities, but most models available today only can handle one.
  • A modality is defined strictly as a pair of two sets: a set of input types and a set of output types.
    • For example, a model that generates both an image and a text caption would have to declare a unique modality, such as text-to-captioned-image. This is because this model has two output types, and its modality is not described by txt2txt or txt2img.
    • For example, an extremely fine-tuned language model that can only answer questions in Chinese would also have to declare a unique modality, as its set of input types consists exclusively of Chinese text, not English text.
  • Tasks must declare one and only one modality.
  • Tasks are now declared as entrypoints under jupyter_ai.default_tasks.
  • The DescribeTask API response now includes a list of valid model engines that support the modality of a given task. Very useful 😁
  • The Dialog UI now includes a dropdown to select a model engine for a given task. The only model engines listed are ones that support a task's modality.
  • Model engines now declare their ID in a separate attribute id. name is now reserved for a model engine's human readable name, e.g. "ChatGPT".

Notes

You need to delete the SQLite DB at ~/.local/share/jupyter/ai_task_manager.db.

Other fixes

  • Fixes dev setup
  • Re-enables check-release workflow for PRs (I know I backtracked on this, but since we don't have any other workflows, this one will have to do for now)

@dlqqq dlqqq added the enhancement New feature or request label Mar 14, 2023
@dlqqq dlqqq merged commit 6c0d59a into jupyterlab:main Mar 15, 2023
@dlqqq dlqqq deleted the decouple-tasks branch March 15, 2023 17:05
@dlqqq dlqqq mentioned this pull request Mar 15, 2023
dbelgrod pushed a commit to dbelgrod/jupyter-ai that referenced this pull request Jun 10, 2024
…b#15)

* fix example playground config

* re-enable check-release workflow for PRs

* decouple tasks from models
Marchlak pushed a commit to Marchlak/jupyter-ai that referenced this pull request Oct 28, 2024
…b#15)

* fix example playground config

* re-enable check-release workflow for PRs

* decouple tasks from models
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant