Add LoRA support (#820)

This commit is contained in:
slaren 2023-04-17 17:28:55 +02:00 committed by GitHub
parent efd05648c8
commit 315a95a4d3
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
10 changed files with 753 additions and 41 deletions

12
llama.h
View file

@ -96,6 +96,18 @@ extern "C" {
const char * fname_out,
enum llama_ftype ftype);
// Apply a LoRA adapter to a loaded model
// path_base_model is the path to a higher quality model to use as a base for
// the layers modified by the adapter. Can be NULL to use the current loaded model.
// The model needs to be reloaded before applying a new adapter, otherwise the adapter
// will be applied on top of the previous one
// Returns 0 on success
LLAMA_API int llama_apply_lora_from_file(
struct llama_context * ctx,
const char * path_lora,
const char * path_base_model,
int n_threads);
// Returns the KV cache that will contain the context for the
// ongoing prediction with the model.
LLAMA_API const uint8_t * llama_get_kv_cache(struct llama_context * ctx);