Added LoRA Loading

Someone please test this. I have no LoRAs available to test. The code is direct from the base repo so it should be fine.
This commit is contained in:
Randall Fitzgerald 2023-05-25 12:53:05 -07:00 committed by GitHub
parent 8d7b28c28d
commit c2b55cc917
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -421,6 +421,8 @@ void server_print_usage(int /*argc*/, char **argv, const gpt_params &params)
fprintf(stderr, " number of layers to store in VRAM\n");
fprintf(stderr, " -m FNAME, --model FNAME\n");
fprintf(stderr, " model path (default: %s)\n", params.model.c_str());
fprintf(stderr, " --lora FNAME apply LoRA adapter (implies --no-mmap)\n");
fprintf(stderr, " --lora-base FNAME optional model to use as a base for the layers modified by the LoRA adapter\n");
fprintf(stderr, " -host ip address to listen (default 127.0.0.1)\n");
fprintf(stderr, " -port PORT port to listen (default 8080)\n");
fprintf(stderr, "\n");
@ -505,6 +507,24 @@ bool server_params_parse(int argc, char **argv, server_params &sparams, gpt_para
}
params.n_gpu_layers = std::stoi(argv[i]);
}
else if (arg == "--lora")
{
if (++i >= argc)
{
invalid_param = true;
break;
}
params.lora_adapter = argv[i];
params.use_mmap = false;
}
else if (arg == "--lora-base")
{
if (++i >= argc) {
invalid_param = true;
break;
}
params.lora_base = argv[i];
}
else
{
fprintf(stderr, "error: unknown argument: %s\n", arg.c_str());