Skip to content

Distribute and run LLMs with a single file.

Introduce --no-warmup flag

Justine Tunney1839bfabbc3d
diff --git a/llama.cpp/common.cpp b/llama.cpp/common.cpp
index c157fcb0..d5024783 100644
--- a/llama.cpp/common.cpp
+++ b/llama.cpp/common.cpp
@@ -997,6 +997,11 @@ bool gpt_params_find_arg(int argc, char ** argv, const std::string & arg, gpt_pa
params.use_mmap = false;
return true;
}
+ if (arg == "--no-warmup") {
+ params.warmup = false;
+ FLAG_warmup = false;
+ return true;
+ }
if (arg == "--numa") {
if (++i >= argc) {
invalid_param = true;
diff --git a/llama.cpp/server/server.cpp b/llama.cpp/server/server.cpp
index 132796c3..e05b19ba 100644
--- a/llama.cpp/server/server.cpp
+++ b/llama.cpp/server/server.cpp
@@ -2597,6 +2597,10 @@ static void server_params_parse(int argc, char **argv, server_params &sparams,
{
params.use_mmap = false;
}
+ else if (arg == "--no-warmup")
+ {
+ params.warmup = false;
+ }
else if (arg == "--numa") {
if (++i >= argc) {
invalid_param = true;
diff --git a/llamafile/flags.cpp b/llamafile/flags.cpp
index 0569902f..ef1ca97c 100644
--- a/llamafile/flags.cpp
+++ b/llamafile/flags.cpp
@@ -53,6 +53,7 @@ int FLAG_split_mode = LLAMA_SPLIT_MODE_LAYER;
int FLAG_threads;
int FLAG_ubatch = 512;
int FLAG_verbose = 0;
+int FLAG_warmup = true;
int FLAG_workers;
int cpu_get_num_math();
@@ -208,6 +209,11 @@ void llamafile_get_flags(int argc, char **argv) {
continue;
}
+ if (!strcmp(flag, "--no-warmup")) {
+ FLAG_warmup = false;
+ continue;
+ }
+
//////////////////////////////////////////////////////////////////////
// cpu flags
diff --git a/llamafile/llamafile.h b/llamafile/llamafile.h
index df18bbab..33ef0360 100644
--- a/llamafile/llamafile.h
+++ b/llamafile/llamafile.h
@@ -35,6 +35,7 @@ extern int FLAG_split_mode;
extern int FLAG_threads;
extern int FLAG_ubatch;
extern int FLAG_verbose;
+extern int FLAG_warmup;
extern int FLAG_workers;
struct llamafile;
diff --git a/llamafile/schlep.c b/llamafile/schlep.c
index d647ba64..ba870f42 100644
--- a/llamafile/schlep.c
+++ b/llamafile/schlep.c
@@ -71,6 +71,10 @@ static void FormatPercent(char sbuf[static 8], double x) {
*/
void llamafile_schlep(const void *data, size_t size) {
+ // avoid warmup
+ if (!FLAG_warmup)
+ return;
+
// don't bother if logging is disabled
if (FLAG_log_disable)
return;