10000 fix: module 'llama_cpp.llama_cpp' has no attribute 'c_uint8' · ducky777/llama-cpp-python@db776a8 · GitHub
[go: up one dir, main page]

Skip to content

Commit db776a8

Browse files
committed
fix: module 'llama_cpp.llama_cpp' has no attribute 'c_uint8'
1 parent 427d816 commit db776a8

File tree

1 file changed

+4
-3
lines changed

1 file changed

+4
-3
lines changed

llama_cpp/llama.py

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -5,8 +5,10 @@
55
import uuid
66
import time
77
import json
8+
import ctypes
89
import fnmatch
910
import multiprocessing
11+
1012
from typing import (
1113
List,
1214
Optional,
@@ -20,7 +22,6 @@
2022
from collections import deque
2123
from pathlib import Path
2224

23-
import ctypes
2425

2526
from llama_cpp.llama_types import List
2627

@@ -1789,15 +1790,15 @@ def save_state(self) -> LlamaState:
17891790
state_size = llama_cpp.llama_get_state_size(self._ctx.ctx)
17901791
if self.verbose:
17911792
print(f"Llama.save_state: got state size: {state_size}", file=sys.stderr)
1792-
llama_state = (llama_cpp.c_uint8 * int(state_size))()
1793+
llama_state = (ctypes.c_uint8 * int(state_size))()
17931794
if self.verbose:
17941795
print("Llama.save_state: allocated state", file=sys.stderr)
17951796
n_bytes = llama_cpp.llama_copy_state_data(self._ctx.ctx, llama_state)
17961797
if self.verbose:
17971798
print(f"Llama.save_state: copied llama state: {n_bytes}", file=sys.stderr)
17981799
if int(n_bytes) > int(state_size):
17991800
raise RuntimeError("Failed to copy llama state data")
1800-
llama_state_compact = (llama_cpp.c_uint8 * int(n_bytes))()
1801+
llama_state_compact = (ctypes.c_uint8 * int(n_bytes))()
18011802
llama_cpp.ctypes.memmove(llama_state_compact, llama_state, int(n_bytes))
18021803
if self.verbose:
18031804
print(

0 commit comments

Comments
 (0)
0