Skip to content

Commit 59785a0

Browse files
authored
Merge pull request #124 from bergwolf/getting-started
docs: add getting-started guide and ecosystem diagram
2 parents 591f937 + 7440b98 commit 59785a0

File tree

3 files changed

+157
-0
lines changed

3 files changed

+157
-0
lines changed

README.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,10 @@ This specification provides a compatible way to package and distribute models ba
2121

2222
For details, please see [the specification](docs/spec.md).
2323

24+
## Getting Started
25+
26+
Please see [the getting started guide](docs/getting-started.md) for a quick introduction to the specification and how to use it.
27+
2428
## Copyright
2529

2630
Copyright © contributors to ModelPack, established as ModelPack a Series of LF Projects, LLC.

docs/getting-started.md

Lines changed: 153 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,153 @@
1+
# Getting Started with CNCF ModelPack Specification
2+
3+
Welcome to the CNCF ModelPack Specification project! This guide will help you understand the specification and its role in the broader AI/ML ecosystem, as well as providing practical steps to get started.
4+
5+
## What is the ModelPack Specification?
6+
7+
The CNCF ModelPack Specification is an open standard for packaging, distributing, and running AI models in cloud-native environments. It builds upon the proven [OCI (Open Container Initiative) image specification](https://github.com/opencontainers/image-spec/) to bring the same standardization and interoperability benefits that containers brought to application deployment to the world of AI models.
8+
9+
### Why This Matters
10+
11+
We are entering the fourth age of infrastructure evolution:
12+
13+
1. **Machine-centric** (GNU/Linux distributions)
14+
2. **Virtual Machine-centric** (Cloud computing, virtualization)
15+
3. **Container-centric** (Docker, Kubernetes, OCI standards)
16+
4. **AI Model-centric** (Current era - AI model development and deployment)
17+
18+
Just as OCI standards revolutionized how we package and distribute applications, the ModelPack specification aims to standardize AI model packaging and distribution, moving away from vendor-specific formats toward an open, interoperable standard.
19+
20+
## The ModelPack Ecosystem
21+
22+
The ModelPack specification is designed to integrate seamlessly with existing cloud-native and AI/ML tools. Here's how the key components work together:
23+
24+
![high level architecture](img/ecosystem_arch.png)
25+
26+
### Core Infrastructure
27+
28+
This section lists the core infrastructure components that ModelPack is working with.
29+
30+
- **[OCI Registries](https://github.com/opencontainers/distribution-spec)**: Store model artifacts using the same proven infrastructure as container images. One example of such implementation of an OCI registry is **[Harbor](https://goharbor.io/)**, which provides enterprise-grade OCI registry service that can host model artifacts with security scanning, policy management, and RBAC.
31+
- Model distribution service: Provide efficient model artifacts distribution. One example of such implementation is **[Dragonfly](https://d7y.io/)**, a P2P-based file distribution system at scale.
32+
33+
### Model Management Tools
34+
35+
- **[modctl](https://github.com/modelpack/modctl)**: CLI tool for building, pushing, pulling, and managing OCI model artifacts
36+
- **[KitOps](https://kitops.ml/)**: ModelKit packaging and deployment platform that supports the ModelPack specification
37+
38+
### Kubernetes Integration
39+
40+
- **[Model CSI Driver](https://github.com/modelpack/model-csi-driver)**: Kubernetes CSI driver for mounting model artifacts as persistent volumes
41+
- **[OCI Volume Sources](https://kubernetes.io/blog/2024/08/16/kubernetes-1-31-image-volume-source/)**: Mount model artifacts directly as volumes in Kubernetes pods without init containers
42+
- **[CRI-O](https://cri-o.io/)**: Container runtime that supports OCI artifacts, enabling seamless model deployment in Kubernetes environments
43+
44+
## Key Benefits
45+
46+
- **Standardization**: The use of familiar OCI tooling and infrastructure for AI models
47+
- **Interoperability**: Models packaged once work across different platforms and tools
48+
- **Security**: Leverage existing OCI security features like image signing and vulnerability scanning
49+
- **Efficiency**: Native Kubernetes integration eliminates the need for manually downloading models
50+
- **Versioning**: The use of OCI tags and digests enables robust model version control
51+
- **Ecosystem**: Build on top of the mature container ecosystem, rather than creating new infrastructure and components
52+
53+
## Getting Started
54+
55+
### Prerequisites
56+
57+
- Basic understanding of containers and OCI concepts
58+
- Access to an OCI-compatible registry (Docker Hub, Harbor, etc.)
59+
60+
### Practical Steps
61+
62+
#### 1. Install modctl
63+
64+
Follow the instructions to install `modctl` from the [modctl GitHub repository](https://github.com/modelpack/modctl/blob/main/docs/getting-started.md#installation) to install the CLI tool.
65+
66+
#### 2. Install Model CSI Driver
67+
68+
If you plan to use models in Kubernetes, install the Model CSI Driver by following the instructions in the [Model CSI Driver repository](https://github.com/modelpack/model-csi-driver/blob/main/docs/getting-started.md#helm-installation).
69+
70+
#### 3. Download A Model
71+
72+
To package a model, you need to download it to your local directory. The following example shows how to download a model from Huggingface.
73+
74+
```bash
75+
export HF_MODEL="Qwen/Qwen3-0.6B"
76+
export MODEL_PATH=my-model-directory
77+
78+
# Install the huggingface cli
79+
pip install 'huggingface_hub'
80+
81+
# Login the huggingface cli
82+
hf auth login --token <your-huggingface-token>
83+
84+
# Download a model
85+
hf download $HF_MODEL --local-dir $MODEL_PATH
86+
```
87+
88+
#### 4. Package Your First Model
89+
90+
The following script will walk through how to build a ModelPack format model artifact and push it to the model registry.
91+
92+
```bash
93+
# Please modify the MODEL_REGISTRY environment variable to point to your OCI model registry
94+
export MODEL_REGISTRY=myregistry.com
95+
96+
# If $MODEL_REGISTRY needs authentication, please login first
97+
modctl login -u <username> -p <password> $MODEL_REGISTRY
98+
99+
# Generate a sample Modelfile, and edit the fields as needed
100+
modctl modelfile generate $MODEL_PATH
101+
102+
# Build a model artifact from your model files
103+
modctl build -t $MODEL_REGISTRY/mymodel:v1.0 $MODEL_PATH
104+
105+
# Push to an OCI registry
106+
modctl push $MODEL_REGISTRY/mymodel:v1.0
107+
```
108+
109+
#### 5. Use Models in Kubernetes
110+
111+
Here's an example Kubernetes pod spec that mounts a model artifact using the model CSI driver. The model will be available under the `/model` directory inside the container.
112+
113+
```yaml
114+
apiVersion: v1
115+
kind: Pod
116+
metadata:
117+
name: model-inference-pod
118+
spec:
119+
containers:
120+
- name: inference-server
121+
image: ubuntu:24.04
122+
command: ["sleep", "infinity"]
123+
volumeMounts:
124+
- name: model-volume
125+
mountPath: /model
126+
readOnly: true
127+
volumes:
128+
- name: model-volume
129+
csi:
130+
driver: model.csi.modelpack.org
131+
volumeAttributes:
132+
modelRef: "myregistry.com/mymodel:v1.0"
133+
```
134+
135+
This example shows how to mount a model artifact directly into a Kubernetes pod using the model CSI driver. The contents of the model is available within the /model directory within the running pod.
136+
137+
## Next Steps
138+
139+
1. **Explore the [full ModelPack specification](./spec.md)** for technical implementation details
140+
2. **Try more options of the [modctl tool](https://github.com/modelpack/modctl)** for additional hands-on experience
141+
3. **Join the community** on [CNCF Slack #modelpack](https://cloud-native.slack.com/archives/C07T0V480LF)
142+
4. **Contribute** to the ModelPack project - see our [contributing guidelines](../CONTRIBUTING.md)
143+
144+
## Additional Resources
145+
146+
- [OCI Image Specification](https://github.com/opencontainers/image-spec)
147+
- [Harbor Project](https://goharbor.io/)
148+
- [Dragonfly Project](https://d7y.io/)
149+
- [CRI-O](https://cri-o.io/)
150+
- [KitOps](https://kitops.ml/)
151+
- [Hugging Face](https://huggingface.co/)
152+
153+
The ModelPack specification represents the next evolution in infrastructure standardization, bringing the benefits of containerization to AI model management. Start with the basics, explore the ecosystem, and join our growing community of contributors and users building the future of cloud-native AI.

docs/img/ecosystem_arch.png

151 KB
Loading

0 commit comments

Comments
 (0)