1
1
# r8im
2
2
3
- This is a suite of assorted tools for inspecting and manipulating docker and OCI images.
3
+ This is a suite of assorted tools for inspecting and manipulating
4
+ docker and OCI images for machine learning workloads.
5
+
6
+ - it does * not* depend on a local docker daemon; it directly manipulates the layers as tar files
7
+ - it works with the image registry directly
8
+ - it can modify existing images without downloading layers
9
+ - it can attach weights to an existing image
10
+ - it works from inside docker
4
11
5
12
## Configuration
6
13
@@ -18,6 +25,11 @@ Add a new layer to an existing image, without changing any of the existing layer
18
25
r8im affix --base <base-image> --dest <destination-image> --tar <layer-tar-file>
19
26
```
20
27
28
+ CAUTION: ` affix ` can result in broken images. Because you aren't
29
+ building an image using a traditional build process, there's no
30
+ guarantees that dependencies will work correctly after manipulating an
31
+ image.
32
+
21
33
## extract
22
34
23
35
Extract weights from an image.
@@ -49,104 +61,15 @@ weights from a second image, combining them together into a new image.
49
61
r8im remix --base <image-including-tag> --weights <image-including-tag> --dest <image-dest>
50
62
```
51
63
64
+ CAUTION: ` remix ` can result in broken images. Because you aren't
65
+ building an image using a traditional build process, there's no
66
+ guarantees that dependencies will work correctly after manipulating an
67
+ image.
68
+
52
69
## zstd
53
70
54
71
Recompress the layers of an image using zstd.
55
72
56
- Examples
57
- --------
58
-
59
- Here are some examples of how to use the tool:
60
-
61
- * To report the layers of an image, run:
62
- ```
63
- $ r8im report my-image
64
- ```
65
- This will output the layers of the specified image, along with their sizes and hashes.
66
-
67
- * To recompress an image using zstd, run:
68
- ```
69
- $ r8im recompress my-image
70
- ```
71
- This will recompress the specified image using zstd, which can reduce the size of the image.
72
-
73
- * To add a new layer to an image, run:
74
73
```
75
- $ r8im add-layer my- image layer
74
+ r8im zstd < image> <dest>
76
75
```
77
-
78
-
79
- - doesn't require or use docker / containers
80
- - works with image registry directly
81
- - attach weights (or other changes) to an existing image
82
- - modify existing images without downloading layers
83
- - works inside of docker
84
-
85
- ## story time: the nightmare
86
-
87
- Imagine the perfect image.
88
-
89
- I'll wait
90
-
91
- Oh... Oh no! We need to make a change. We need to add the new weights.
92
-
93
- ok, I guess I need:
94
-
95
- - docker
96
- - cog
97
- - a GPU
98
- - lots of bandwidth and time
99
-
100
- ugh. I just want to add this ontop of that. And give it back to you. Why are you making me do all this work!
101
-
102
- ok... :sadpanda:
103
-
104
- ## story time: a new day?
105
-
106
- Oh, some nice programmer created a new tool for me.
107
-
108
- It lets me talk to replicate's image registry - and tweak and image without the nightmare / crying...
109
-
110
- Let see, how can I use it?
111
-
112
- $ ./r8im affix --help
113
-
114
- Usage of ./r8-affix:
115
- -base string
116
- base image reference - include tag: r8.im/username/modelname@sha256:hexdigest
117
- -dest string
118
- destination image reference: r8.im/username/modelname
119
- -registry string
120
- registry host (default "r8.im")
121
- -tar string
122
- tar file to append as new layer
123
- -token string
124
- replicate cog token
125
-
126
- Some of those are confusing. What is the tar file exactly? (Perhaps that programmer isn't as nice as they seemed at first ..)
127
-
128
- Let's see if I can use this anyway.
129
-
130
- I have this file called ` weights.tar ` that I got from my custom dreambooth trainer. And I have a "cog token" from https://replicate.com/auth/token
131
-
132
-
133
- ./r8im affix --token $REPLICATE_COG_TOKEN \
134
- --base "r8.im/replicate/dreambooth-template@sha256:d0b01c9e0d4bc94c8d642064b349261c0d5147a784dab8011c0adb77fe0b27d3 \
135
- --dest "r8.im/anotherjesse/my-dreambooths" \
136
- --tar "weights.tar"
137
-
138
- fetching metadata for r8.im/replicate/dreambooth-template@sha256:d0b01c9e0d4bc94c8d642064b349261c0d5147a784dab8011c0adb77fe0b27d3
139
- pulling took 325.867939ms
140
- appending as new layer /home/jesse/output.tar
141
- appending took 29.523629917s
142
- pushing took 18.92398947s
143
- r8.im/anotherjesse/faster@sha256:f5406d243df29db34ea441401141bf7f0f79da679651f110871a78d37c897c73
144
-
145
-
146
- yay, it looks like I have a new version of ` my-dreambooths ` that added my weights on top of my template
147
-
148
- - I didn't have to install docker or nvidia gpu just to add my weights
149
- - I didn't have to wait for the layers from ` dreambooth-template ` to download, I just downloaded the metadata
150
- - This can run anywhere! Perhaps it can even run INSIDE replicate!? So I don't need to do anything?
151
-
152
- Oh, I just noticed that if my tar file has an update for predict.py, it can result in a broken image. Perhaps this is a tool to use with caution?
0 commit comments