Skip to content

Commit

Permalink
vision : use --image parameter for vision example
Browse files Browse the repository at this point in the history
  • Loading branch information
danbev committed Nov 11, 2024
1 parent 3cb6096 commit df21797
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 3 deletions.
2 changes: 1 addition & 1 deletion common/arg.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1394,7 +1394,7 @@ common_params_context common_params_parser_init(common_params & params, llama_ex
[](common_params & params, const std::string & value) {
params.image.emplace_back(value);
}
).set_examples({LLAMA_EXAMPLE_LLAVA}));
).set_examples({LLAMA_EXAMPLE_LLAVA, LLAMA_EXAMPLE_VISION}));
if (llama_supports_rpc()) {
add_opt(common_arg(
{"--rpc"}, "SERVERS",
Expand Down
1 change: 1 addition & 0 deletions common/common.h
Original file line number Diff line number Diff line change
Expand Up @@ -80,6 +80,7 @@ enum llama_example {
LLAMA_EXAMPLE_PARALLEL,

LLAMA_EXAMPLE_COUNT,
LLAMA_EXAMPLE_VISION,
};

enum common_sampler_type {
Expand Down
4 changes: 2 additions & 2 deletions examples/vision/vision.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ int main(int argc, char ** argv) {
"USER:<img_placement>\nwhat did you see?\nASSISTANT:";
params.n_predict = 32;

if (!common_params_parse(argc, argv, params, LLAMA_EXAMPLE_COMMON, print_usage)) {
if (!common_params_parse(argc, argv, params, LLAMA_EXAMPLE_VISION, print_usage)) {
return 1;
}

Expand Down Expand Up @@ -98,7 +98,7 @@ int main(int argc, char ** argv) {

// load image
llama_batch_img img_batch = llama_batch_img_init(1);
img_batch.imgs[0] = load_image_from_file("models/eiffel-tower-3349075_1280.jpg");
img_batch.imgs[0] = load_image_from_file(params.image[0].c_str());

// create a llama_batch with size 512
// we use this object to submit token data for decoding
Expand Down

0 comments on commit df21797

Please sign in to comment.