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

docs: add packaging guide #185

Merged
merged 7 commits into from
Feb 8, 2024
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
101 changes: 101 additions & 0 deletions PACKAGING-GUIDE.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,101 @@
# Packaging guide

## Catalog

AI Studio uses an internal catalog that is embedded into AI Studio. This catalog is loaded
jeffmaury marked this conversation as resolved.
Show resolved Hide resolved
by AI Studio and displayed when you access the catalog page.

The format of the catalog is JSON. It is possible for users to have a custom version of
the catalog. In order to do so, copy the file located at https://github.com/projectatomic/ai-studio/blob/main/packages/backend/src/ai.json
to $HOME/podman-desktop/ai-studio/catalog.json and AI Studio will use it instead of the embedded one.
Any change done to this file will also be automatically be loaded by AI Studio.
jeffmaury marked this conversation as resolved.
Show resolved Hide resolved

### Format of the catalog file

The catalog file has three main elements: categories, models and recipes. Each of these elements is
represented in the JSON file as an array.

#### Categories

This is the top level construct of the catalog UI. Recipes are grouped into categories. A category
represents the kind of AI application. Although the list of categories provided by default by
AI Studio represents the AI landscape, it is possible to add new categories.

A category has three main attributes: an id (which should be unique among categories), a description
and a name. The category id attribute will then be used to attach a recipe to one or several categories.

#### Models

The catalog also list the models that may be associated to recipes. A model is also a first class
jeffmaury marked this conversation as resolved.
Show resolved Hide resolved
citizen in AI Studio as they will be listed in the Models page and can be tested through the playground.

A model has the following attributes:
- ```id```: a unique identifier for the model
- ```name```: the model name
- ```description```: a detailed description about the model
- ```hw```: the hardware where the model is compatible. Possible values are CPU and GPU
- ```registry```: the model registry where the model is stored
- ```popularity```: an integer field giving the rating of the model. Can be thought as the number of stars
- ```license```: the license under which the model is available
- ```url```: the URL used to download the model

#### Recipes

A recipe is a sample AI application that is packaged as one or several containers. It is build by
AI Studio when the user chooses to download it on his workstation and run it. It is provided as
jeffmaury marked this conversation as resolved.
Show resolved Hide resolved
source code and AI Studio will make sure the container images are built prior to laucnhing the containers.
jeffmaury marked this conversation as resolved.
Show resolved Hide resolved

A recipe has the following attributes:
- ```id```: a unique identifier to the recipe
- ```name```: the recipe name
- ```description```: a detailed description about the recipe
- ```repository```: the URL where the recipe code can be retrieved
- ```categories```: an array of category id to be associated by this recipe
- ```config```: an optional path of the configuration file within the repository. If not provided, the file is assumed to be located at the root the repository and called ai-studio.yaml
- ```readme```: a markdown description of the recipe
- ```models```: an array of model id to be associated with this recipe

#### Recipe configuration file

The configuration file is called ```ai-studio.yaml``` and follows the following syntax.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Where do we need to place this file?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

See the config attribute of a recipe. Maybe I should repeat or link to the definition

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, I think it would be nice to have the context, for example saying: 'The configuration file for a recipe, as defined in the config field ...'


The root element is called ```application```. This element contains an attribute called ```containers```
whose syntax is an array of objects containing the following attribute:
jeffmaury marked this conversation as resolved.
Show resolved Hide resolved
- ```name```: the name of the container
- ```contextdir```: the context directory used to build the container.
- ```containerfile```: the containerfile used to build the image
- ```model-service```: a boolean flag used to indicate if the container is running the model or not
- ```arch```: an optional array of architecture for which this image is compatible with. The values follows the
jeffmaury marked this conversation as resolved.
Show resolved Hide resolved
[GOARCH specification](https://go.dev/src/go/build/syslist.go)
- ```gpu-env```: an optional array of GPU environment for which this image is compatible with. The only accepted value here is cuda.

The container that is running the service (having the ```model-service``` flag equal to ```true```) can use at runtime
the model managed by AI Studio through an environment variable ```MODEL_PATH``` whose value is the full path name of the
model file
jeffmaury marked this conversation as resolved.
Show resolved Hide resolved

Below is given an example of such a configuration file:
```yaml
application:
containers:
- name: chatbot-inference-app
contextdir: ai_applications
containerfile: builds/Containerfile
- name: chatbot-model-service
contextdir: model_services
containerfile: base/Containerfile
model-service: true
arch:
- arm64
- amd64
- name: chatbot-model-servicecuda
contextdir: model_services
containerfile: cuda/Containerfile
model-service: true
gpu-env:
- cuda
arch:
- amd64
```
4 changes: 4 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,10 @@ Each recipe can belong to one or several categories. Each model can be used by o

The format of the catalog is not stable nor versioned yet, you can see the current catalog's format [in the sources of the extension](https://github.com/projectatomic/studio-extension/blob/main/packages/backend/src/ai.json).

## Packaging sample applications

Sample applications may be added to the catalog. See [packaging guide](PACKAGING-GUIDE.md) for detailed information.

## Feedback

You can provide your feedback on the extension with [this form](https://forms.gle/tctQ4RtZSiMyQr3R8) or create [an issue on this repository](https://github.com/projectatomic/studio-extension/issues).
Loading