Skip to content

Commit

Permalink
Merge pull request #13 from CloudNativeAI/feature/spec
Browse files Browse the repository at this point in the history
  • Loading branch information
chlins authored Nov 19, 2024
2 parents fd8887b + fe6da63 commit cb12b12
Show file tree
Hide file tree
Showing 47 changed files with 13 additions and 3,044 deletions.
10 changes: 2 additions & 8 deletions .github/workflows/lint.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,26 +14,20 @@ jobs:
name: Lint
runs-on: ubuntu-latest
timeout-minutes: 30
strategy:
matrix:
include:
- go-path: tools/mdctl
- go-path: specs-go
steps:
- name: Checkout code
uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332

- uses: actions/setup-go@0a12ed9d6a96ab950c8f026ed9f722fe0da7ef32
with:
go-version-file: specs-go/go.mod
go-version-file: go.mod
cache: false

- name: Golangci lint
uses: golangci/golangci-lint-action@v6
with:
version: v1.61
working-directory: ${{ matrix.go-path }}
args: --config $GITHUB_WORKSPACE/.golangci.yml --verbose
args: --verbose

- name: Markdown lint
uses: docker://avtodev/markdown-lint:v1@sha256:6aeedc2f49138ce7a1cd0adffc1b1c0321b841dc2102408967d9301c031949ee
Expand Down
13 changes: 4 additions & 9 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# CNAI Model Specification Proposal
# CNAI Model Format Specification

[![LICENSE](https://img.shields.io/github/license/CloudNativeAI/model-spec.svg?style=flat-square)](https://github.com/CloudNativeAI/model-spec/blob/main/LICENSE)
[![GoDoc](https://godoc.org/github.com/CloudNativeAI/model-spec?status.svg)](https://godoc.org/github.com/CloudNativeAI/model-spec)
Expand All @@ -15,14 +15,9 @@ Each of the new ages has brought new technologies and new ways of thinking. The

## Current Work

There are two versions of specifications proposed, both of which are under development:
The specification, provides a compatible way to package and distribute models based on the current [OCI image specification](https://github.com/opencontainers/image-spec/) and [the artifacts guidelines](https://github.com/opencontainers/image-spec/blob/main/manifest.md#guidelines-for-artifact-usage). For compatibility reasons, it only contains part of the model metadata, and handles model artifacts as opaque binaries. However, it provides a convient way to package AI models in the container image format and can be used as [OCI volume sources](https://github.com/kubernetes/enhancements/issues/4639) in Kubernetes environments.

* v1: The first version of the specification, provides a compatible way to package and distribute models based on the current [OCI image specification](https://github.com/opencontainers/image-spec/) and [the artifacts guidelines](https://github.com/opencontainers/image-spec/blob/main/manifest.md#guidelines-for-artifact-usage). For compatibility reasons, it only contains part of the model metadata, and handles model artifacts as opaque binaries. However, it provides a convient way to package AI models in the container image format and can be used as [OCI volume sources](https://github.com/kubernetes/enhancements/issues/4639) in Kubernetes environments.
* v2: The second version of the specification, in a pretty early stage, includes a model image specification and a model runtime specification. The model image specification packages models with details like model artifacts, metadata, configuration, and runtime environment. The model runtime specification defines how to run the packaged models in a cloud native environment. It builds a foundation for promoting AI models as a first-class citizen in the cloud native ecosystem, and let users build once and run anywhere.

We consider the two versions incremental steps toward a standard model specification. The v1 specification is a simple and compatible way to package AI models in the container image format, while the v2 specification is a more comprehensive and cloud native way to package, distribute, and run AI models.

For details, please see [the v1 specification](docs/v1/spec.md) and [the v2 specification introduction](docs/v2/intro.md).
For details, please see [the specification](docs/spec.md).

## LICENSE

Expand All @@ -32,6 +27,6 @@ Apache 2.0 License. Please see [LICENSE](LICENSE) for more information.

Any feedback, suggestions, and contributions are welcome. Please feel free to open an issue or pull request.

Especially, we look forward to integrating the model specification with different model registry implementations (like [Harbor](https://goharbor.io/) and [Kubeflow model registry](https://www.kubeflow.org/docs/components/model-registry/overview/)), as well as existing model centric infrastructure projects like [Kubeflow](https://www.kubeflow.org/), [ollama](https://github.com/ollama/ollama), [Huggingface](https://huggingface.co/), [Lepton](https://www.lepton.ai/), and others.
Especially, we look forward to integrating the model specification with different model registry implementations (like [Harbor](https://goharbor.io/) and [Kubeflow model registry](https://www.kubeflow.org/docs/components/model-registry/overview/)), as well as existing model centric infrastructure projects like [Huggingface](https://huggingface.co/), [KitOps](https://kitops.ml/), [Kubeflow](https://www.kubeflow.org/), [Lepton](https://www.lepton.ai/), [ollama](https://github.com/ollama/ollama), [ORAS](https://oras.land/), and others.

Enjoy!
File renamed without changes.
File renamed without changes
File renamed without changes
File renamed without changes
8 changes: 4 additions & 4 deletions docs/v1/spec.md → docs/spec.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# Model Specification Version 1
# Model Format Specification

The specification defines an open standard Artifacial Intelegence model. It is defined through the artifact extension based on [the OCI image specification](https://github.com/opencontainers/image-spec/blob/main/spec.md#image-format-specification), and extends model features through `artifactType` and `annotations`. Model storage and distribution can be optimized based on artifact extension.

Expand All @@ -19,7 +19,7 @@ Therefore, the model specification must be defined through the artifact extensio

The model specification is defined through the artifact extension based on the OCI image specification, and extend model features through `artifactType` and `annotations`. Model storage and distribution can be optimized based on artifact extension.

![manifest](../img/v1/manifest.svg)
![manifest](./img/manifest.svg)

## Workflow

Expand All @@ -31,13 +31,13 @@ Use tools(ORAS, Ollama, etc.) to build required resources in the model repositor

Next push the artifact to the OCI registry(Harbor, Docker Hub, etc.), and use the functionalities of the OCI registry to manage the model artifact.

![build-push](../img/v1/build-and-push.png)
![build-push](./img/build-and-push.png)

### PULL & SERVE

The container runtime(containerd, cri-o, etc) pulls the model artifact from the OCI registry, and mounts the model artifact as a read-only volume. Therefore, distributed model can use the P2P technology(Dragonfly, Kraken, etc) to reduce the pressure on the registry and preheat the model artifact into each node. If the model artifact is already present on the node, the container runtime can reuse the model artifact to mount different containers in the same node.

![pull-serve](../img/v1/pull-and-serve.png)
![pull-serve](./img/pull-and-serve.png)

## Understanding the Specification

Expand Down
40 changes: 0 additions & 40 deletions docs/v2/intro.md

This file was deleted.

95 changes: 0 additions & 95 deletions docs/v2/modelfile.md

This file was deleted.

51 changes: 0 additions & 51 deletions docs/v2/tool.md

This file was deleted.

3 changes: 3 additions & 0 deletions go.mod
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
module github.com/CloudNativeAI/model-spec

go 1.23.1
7 changes: 0 additions & 7 deletions specs-go/go.mod

This file was deleted.

4 changes: 0 additions & 4 deletions specs-go/go.sum

This file was deleted.

51 changes: 0 additions & 51 deletions specs-go/v2/architecture.go

This file was deleted.

40 changes: 0 additions & 40 deletions specs-go/v2/config.go

This file was deleted.

Loading

0 comments on commit cb12b12

Please sign in to comment.