Skip to content

Commit 9379999

Browse files
ekcaseydoringeman
authored andcommitted
Optionally set context-size in artifact (docker#92)
Signed-off-by: Emily Casey <emily.casey@docker.com>
1 parent 188ff82 commit 9379999

File tree

1 file changed

+16
-2
lines changed

1 file changed

+16
-2
lines changed

cmd/mdltool/main.go

Lines changed: 16 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -152,9 +152,18 @@ func cmdPull(client *distribution.Client, args []string) int {
152152
}
153153

154154
func cmdPackage(args []string) int {
155-
fs := flag.NewFlagSet("push", flag.ExitOnError)
155+
fs := flag.NewFlagSet("package", flag.ExitOnError)
156156
var licensePaths stringSliceFlag
157+
var contextSize uint64
158+
157159
fs.Var(&licensePaths, "licenses", "Paths to license files (can be specified multiple times)")
160+
fs.Uint64Var(&contextSize, "context-size", 0, "Context size in tokens")
161+
fs.Usage = func() {
162+
fmt.Fprintf(os.Stderr, "Usage: model-distribution-tool package [OPTIONS] <path-to-gguf> <reference>\n\n")
163+
fmt.Fprintf(os.Stderr, "Options:\n")
164+
fs.PrintDefaults()
165+
}
166+
158167
if err := fs.Parse(args); err != nil {
159168
fmt.Fprintf(os.Stderr, "Error parsing flags: %v\n", err)
160169
return 1
@@ -163,7 +172,7 @@ func cmdPackage(args []string) int {
163172

164173
if len(args) < 2 {
165174
fmt.Fprintf(os.Stderr, "Error: missing arguments\n")
166-
fmt.Fprintf(os.Stderr, "Usage: model-distribution-tool push <source> <reference> [--licenses <path-to-license-file1> --licenses <path-to-license-file2> ...]\n")
175+
fs.Usage()
167176
return 1
168177
}
169178

@@ -222,6 +231,11 @@ func cmdPackage(args []string) int {
222231
}
223232
}
224233

234+
if contextSize > 0 {
235+
fmt.Println("Setting context size:", contextSize)
236+
builder = builder.WithContextSize(contextSize)
237+
}
238+
225239
// Push the image
226240
if err := builder.Build(ctx, target, os.Stdout); err != nil {
227241
fmt.Fprintf(os.Stderr, "Error writing model %q to registry: %v\n", reference, err)

0 commit comments

Comments
 (0)