simonw / llm-gpt4all

Plugin for LLM adding support for the GPT4All collection of models
Apache License 2.0
218 stars 20 forks source link

Overriding default context length #42

Open sbooeshaghi opened 1 month ago

sbooeshaghi commented 1 month ago

GPT4All sets the default context length

$ cat gpt4all.py| nl | grep n_ctx
   151          n_ctx: int = 2048,
   174              n_ctx: Maximum size of context window
   205          self.model = LLModel(self.config["path"], n_ctx, ngl, backend)

Different models have different context length limits, for example the Meta Llama 3 (https://huggingface.co/meta-llama/Llama-3.1-8B-Instruct#model-information) has a context limit of 128k tokens.

$ llm models | grep Meta-Llama-3
gpt4all: Meta-Llama-3 - Llama 3.1 8B Instruct 128k, 4.34GB download, needs 8GB RAM (installed)

Is there a way to increase the context length when running llm? Something like:

$ llm --model Meta-Llama-3 -o "n_ctx" "128000"

Or having a way to default to the max context limit size per model?