Skip to content

Distribute and run LLMs with a single file.

Revise previous commit

Justine Tunney616f0a57f2ed
diff --git a/llama.cpp/llava/llava-cli.cpp b/llama.cpp/llava/llava-cli.cpp
index bb8a2478..388a7d2f 100644
--- a/llama.cpp/llava/llava-cli.cpp
+++ b/llama.cpp/llava/llava-cli.cpp
@@ -275,11 +275,6 @@ static void llava_free(struct llava_context * ctx_llava) {
int llava_cli(int argc, char ** argv, gpt_params * params) {
- if (params->mmproj.empty()) {
- fprintf(stderr, "%s: fatal error: --mmproj must also be passed when an --image is specified in cli mode\n", argv[0]);
- return 1;
- }
-
auto ctx_llava = llava_init(params);
if (ctx_llava == NULL) {
fprintf(stderr, "%s: error: failed to init llava\n", __func__);
diff --git a/llama.cpp/main/main.cpp b/llama.cpp/main/main.cpp
index 5eea639f..069c7bad 100644
--- a/llama.cpp/main/main.cpp
+++ b/llama.cpp/main/main.cpp
@@ -152,8 +152,14 @@ int main(int argc, char ** argv) {
llama_log_set(llama_log_callback_logTee, nullptr);
#endif // LOG_DISABLE_LOGS
- if (!params.image.empty() &&
- params.prompt.find("<img src=\"") != std::string::npos) {
+ if (!params.image.empty() && params.mmproj.empty()) {
+ fprintf(stderr, "%s: fatal error: --mmproj must also be passed when an --image is specified in cli mode\n", argv[0]);
+ return 1;
+ }
+
+ if (!params.mmproj.empty() &&
+ (!params.image.empty() ||
+ params.prompt.find("<img src=\"") != std::string::npos)) {
return llava_cli(argc, argv, &params);
}