Skip to content

Commit 0a39207

Browse files
authored
feat: update modelfile commands to uppercase format (#118)
Signed-off-by: Gaius <[email protected]>
1 parent 60e5dee commit 0a39207

File tree

6 files changed

+231
-230
lines changed

6 files changed

+231
-230
lines changed

docs/getting-started.md

Lines changed: 12 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -39,43 +39,40 @@ Example of Modelfile:
3939

4040
```shell
4141
# Model name (string), such as llama3-8b-instruct, gpt2-xl, qwen2-vl-72b-instruct, etc.
42-
name gemma-2b
42+
NAME gemma-2b
4343

4444
# Model architecture (string), such as transformer, cnn, rnn, etc.
45-
arch transformer
45+
ARCH transformer
4646

4747
# Model family (string), such as llama3, gpt2, qwen2, etc.
48-
family gemma
48+
FAMILY gemma
4949

5050
# Model format (string), such as onnx, tensorflow, pytorch, etc.
51-
format safetensors
51+
FORMAT safetensors
5252

5353
# Number of parameters in the model (integer).
54-
paramsize 16
54+
PARAMSIZE 16
5555

5656
# Model precision (string), such as bf16, fp16, int8, etc.
57-
precision bf16
57+
PRECISION bf16
5858

5959
# Model quantization (string), such as awq, gptq, etc.
60-
quantization awq
60+
QUANTIZATION awq
6161

6262
# Specify model configuration file, support glob path pattern.
63-
config config.json
63+
CONFIG config.json
6464

6565
# Specify model configuration file, support glob path pattern.
66-
config generation_config.json
66+
CONFIG generation_config.json
6767

6868
# Model weight, support glob path pattern.
69-
model *.safetensors
69+
MODEL *.safetensors
7070

7171
# Specify code, support glob path pattern.
72-
code *.py
72+
CODE *.py
7373

7474
# Specify documentation, support glob path pattern.
75-
doc *.md
76-
77-
# Specify dataset, support glob path pattern.
78-
dataset *.csv
75+
DOC *.md
7976
```
8077

8178
Then run the following command to build the model artifact:

pkg/modelfile/command/command.go

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -22,58 +22,58 @@ const (
2222
// the model to be served, such as the config.json, generation_config.json, etc.
2323
// The CONFIG command can be used multiple times in a modelfile, it
2424
// will be copied the config file to the artifact package as a layer.
25-
CONFIG = "config"
25+
CONFIG = "CONFIG"
2626

2727
// MODEL is the command to set the model file path. The value of this command
2828
// is the glob of the model file path to match the model file name.
2929
// The MODEL command can be used multiple times in a modelfile, it will scan
3030
// the model file path by the glob and copy each model file to the artifact
3131
// package, and each model file will be a layer.
32-
MODEL = "model"
32+
MODEL = "MODEL"
3333

3434
// CODE is the command to set the code file path. The value of this commands
3535
// is the glob of the code file path to match the code file name.
3636
// The CODE command can be used multiple times in a modelfile, it will scan
3737
// the code file path by the glob and copy each code file to the artifact
3838
// package, and each code file will be a layer.
39-
CODE = "code"
39+
CODE = "CODE"
4040

4141
// DATASET is the command to set the dataset file path. The value of this commands
4242
// is the glob of the dataset file path to match the dataset file name.
4343
// The DATASET command can be used multiple times in a modelfile, it will scan
4444
// the dataset file path by the glob and copy each dataset file to the artifact
4545
// package, and each dataset file will be a layer.
46-
DATASET = "dataset"
46+
DATASET = "DATASET"
4747

4848
// DOC is the command to set the documentation file path. The value of this commands
4949
// is the glob of the documentation file path to match the documentation file name.
5050
// The DOC command can be used multiple times in a modelfile, it will scan
5151
// the documentation file path by the glob and copy each documentation file to the artifact
5252
// package, and each documentation file will be a layer.
53-
DOC = "doc"
53+
DOC = "DOC"
5454

5555
// NAME is the command to set the model name, such as llama3-8b-instruct, gpt2-xl,
5656
// qwen2-vl-72b-instruct, etc.
57-
NAME = "name"
57+
NAME = "NAME"
5858

5959
// ARCH is the command to set the architecture of the model, such as transformer,
6060
// cnn, rnn, etc.
61-
ARCH = "arch"
61+
ARCH = "ARCH"
6262

6363
// FAMILY is the command to set the family of the model, such as llama3, gpt2, qwen2, etc.
64-
FAMILY = "family"
64+
FAMILY = "FAMILY"
6565

6666
// FORMAT is the command to set the format of the model, such as onnx, tensorflow, pytorch, etc.
67-
FORMAT = "format"
67+
FORMAT = "FORMAT"
6868

6969
// PARAMSIZE is the command to set the parameter size of the model.
70-
PARAMSIZE = "paramsize"
70+
PARAMSIZE = "PARAMSIZE"
7171

7272
// PRECISION is the command to set the precision of the model, such as bf16, fp16, int8, etc.
73-
PRECISION = "precision"
73+
PRECISION = "PRECISION"
7474

7575
// QUANTIZATION is the command to set the quantization of the model, such as awq, gptq, etc.
76-
QUANTIZATION = "quantization"
76+
QUANTIZATION = "QUANTIZATION"
7777
)
7878

7979
// Commands is a list of all the commands that can be used in a modelfile.

pkg/modelfile/constants.go

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -116,6 +116,7 @@ func isFileType(filename string, patterns []string) bool {
116116
return true
117117
}
118118
}
119+
119120
return false
120121
}
121122

@@ -135,5 +136,6 @@ func isSkippable(filename string) bool {
135136
return true
136137
}
137138
}
139+
138140
return false
139141
}

0 commit comments

Comments
 (0)