ctransformers icon indicating copy to clipboard operation
ctransformers copied to clipboard

How to specify Maximum Context Length for my llm

Open Harri1703 opened this issue 2 years ago • 2 comments

Harri1703 avatar Sep 21 '23 10:09 Harri1703

you can use this code to increase maximun context length for your llm config = {'max_new_tokens': 256, 'repetition_penalty': 1.1,'context_length':1000}

llm = CTransformers(model='marella/gpt-2-ggml', config=config) for more infromation you can check below links

https://python.langchain.com/docs/integrations/providers/ctransformers

https://github.com/marella/ctransformers#config

alifatmi avatar Oct 12 '23 06:10 alifatmi

If you are loading directly from Huggingface:

from ctransformers import AutoModelForCausalLM

llm = AutoModelForCausalLM.from_pretrained("TheBloke/zephyr-7B-beta-GGUF", gpu_layers=50)

llm.config.context_length = 8192

sawradip avatar Nov 15 '23 06:11 sawradip