Skip to content

Commit 5f26421

Browse files
authored
feat: add doc and config artifactType for spec (#18)
Signed-off-by: Gaius <[email protected]>
1 parent 0acf99a commit 5f26421

File tree

2 files changed

+16
-7
lines changed

2 files changed

+16
-7
lines changed

docs/annotations.md

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,4 @@ This property contains arbitrary metadata, and SHOULD follow the rules of [OCI i
3535

3636
- **`org.cnai.model.readme`**: Specifies the layer is a README.md file (boolean), such as `true` or `false`.
3737
- **`org.cnai.model.license`**: Specifies the layer is a LICENSE file (boolean), such as `true` or `false`.
38-
- **`org.cnai.model.config`**: Specifies the layer is a configuration file (boolean), such as `true` or `false`.
39-
- **`org.cnai.model.model`**: Specifies the layer is a model file (boolean), such as `true` or `false`.
4038
- **`org.cnai.model.filepath`**: Specifies the file path of the layer (string).

docs/spec.md

Lines changed: 16 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ The model specification needs to consider two factors:
1111
packaging content other than OCI image specification.
1212
2. The model needs to be mounted by the container runtime as
1313
[read only volumes based on the OCI Artifacts in Kubernetes 1.31+](https://kubernetes.io/blog/2024/08/16/kubernetes-1-31-image-volume-source/).
14-
Container runtimes can only pull OCI artifact that follows the OCI image specification.
14+
Container runtimes can only pull OCI artifact that follow the OCI image specification.
1515

1616
Therefore, the model specification must be defined through the artifact extension based on the [OCI image specification](https://github.com/opencontainers/image-spec/blob/main/spec.md#image-format-specification). It can be better compatible with the kubernetes ecosystem.
1717

@@ -51,14 +51,25 @@ The model specification is based on the [OCI image specification](https://github
5151

5252
- **`layers`** _array of objects_
5353

54+
- **`mediaType`** _string_
55+
56+
`mediaType` MUST follow the [OCI image specification](https://github.com/opencontainers/image-spec/blob/main/layer.md), because the model needs to be mounted
57+
by the container runtime as [read only volumes based on the OCI Artifacts in Kubernetes 1.31+](https://kubernetes.io/blog/2024/08/16/kubernetes-1-31-image-volume-source/).
58+
Container runtimes can only pull OCI artifact that follow the OCI image specification.
59+
5460
- **`artifactType`** _string_
5561

5662
Implementations MUST support at least the following media types:
5763

58-
- `application/vnd.cnai.model.layer.v1.tar`
59-
- `application/vnd.cnai.model.layer.v1.tar+gzip`
60-
61-
If `mediaType` is `application/vnd.oci.image.layer.v1.tar`, the `artifactType` MUST be `application/vnd.cnai.model.layer.v1.tar`. If `mediaType` is `application/vnd.oci.image.layer.v1.tar+gzip`, the `artifactType` MUST be `application/vnd.cnai.model.layer.v1.tar+gzip`. The `mediaType` and `artifactType` MUST be consistent, for detailed definitions of Filesystem Layers, please refer to the [Image Layer Filesystem Changeset](https://github.com/opencontainers/image-spec/blob/main/layer.md).
64+
- `application/vnd.cnai.model.layer.v1.tar`: The layer is a tarball that contains the model weight file. If the model has multiple weight files,
65+
need to package them in separate layers.
66+
- `application/vnd.cnai.model.layer.v1.tar+gzip`: The layer is a tarball that contains the model weight file and is compressed by gzip.
67+
If the model has multiple weight files, need to package them in separate layers. But recommended package model weight files without compressed to
68+
avoid the container runtime decompressing the model layer. Because the model weight files have been compressed, the container runtime will
69+
cost long time to decompress the model layer.
70+
- `application/vnd.cnai.model.doc.v1.tar`: The layer is a tarball that contains the model documentation file, such as README.md, LICENSE, etc.
71+
- `application/vnd.cnai.model.config.v1.tar`: The layer is a tarball that contains the model configuration file,
72+
such as config.json, tokenizer.json, generation_config.json, etc.
6273

6374
- **`annotations`** _string-string map_
6475

0 commit comments

Comments
 (0)