Skip to content

fix: rename op_offloat to op_offload in llama.py #2046

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

sergey21000
Copy link

Fix typo in variable name: replace op_offloat with op_offload in llama.py (v0.3.14), that caused AttributeError during model copying

Steps to Reproduce:

# pip install llama_cpp_python 
from copy import copy, deepcopy
from llama_cpp import Llama

model = Llama.from_pretrained(
    repo_id='bartowski/google_gemma-3-1b-it-GGUF',
    filename='google_gemma-3-1b-it-Q8_0.gguf',
    verbose=False,
)
deepcopy(model)

---------------------------------------------------------------------------
AttributeError                            Traceback (most recent call last)
[/tmp/ipython-input-119572725.py](https://localhost:8080/#) in <cell line: 0>()
      8     verbose=False,
      9 )
---> 10 deepcopy(model)

1 frames
[/usr/lib/python3.11/copy.py](https://localhost:8080/#) in deepcopy(x, memo, _nil)
    159                     reductor = getattr(x, "__reduce_ex__", None)
    160                     if reductor is not None:
--> 161                         rv = reductor(4)
    162                     else:
    163                         reductor = getattr(x, "__reduce__", None)

[/usr/local/lib/python3.11/dist-packages/llama_cpp/llama.py](https://localhost:8080/#) in __getstate__(self)
   2098             offload_kqv=self.context_params.offload_kqv,
   2099             flash_attn=self.context_params.flash_attn,
-> 2100             op_offloat=self.context_params.op_offloat,
   2101             swa_full=self.context_params.swa_full,
   2102             # Sampling Params

AttributeError: 'llama_context_params' object has no attribute 'op_offloat'

Impact: breaks Gradio integration

# pip install gradio 
import gradio as gr
model_state = gr.State({'model': model})
# AttributeError: 'llama_context_params' object has no attribute 'op_offloat'

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant