-
Notifications
You must be signed in to change notification settings - Fork 41
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
Changes from all commits
Commits
Show all changes
7 commits
Select commit
Hold shift + click to select a range
d7b0b4c
docs: add packaging guide
jeffmaury b9e08cb
fix: typo
jeffmaury 097deb8
fix: wording
jeffmaury 43a1f2f
fix: typo
jeffmaury a5f8be7
fix: typo
jeffmaury bf8c327
fix: apply suggestions from @feloy code review
jeffmaury aa27cc5
Merge branch 'main' into GH-123
jeffmaury File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,100 @@ | ||
# Packaging guide | ||
|
||
## Catalog | ||
|
||
AI Studio uses an internal catalog embedded within the application. This catalog is loaded | ||
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 loaded by AI Studio. | ||
|
||
### 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 lists the models that may be associated to recipes. A model is also a first class | ||
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 built by AI Studio when the user chooses to download and run it on their workstation. It is provided as | ||
source code and AI Studio will make sure the container images are built prior to launching the containers. | ||
|
||
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. | ||
|
||
The root element is called ```application```. This element contains an attribute called ```containers``` | ||
whose syntax is an array of objects containing the following attributes: | ||
- ```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 follow the | ||
[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. | ||
|
||
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 | ||
``` | ||
|
||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
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?
There was a problem hiding this comment.
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
There was a problem hiding this comment.
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 ...'