File tree Expand file tree Collapse file tree 1 file changed +4
-3
lines changed Expand file tree Collapse file tree 1 file changed +4
-3
lines changed Original file line number Diff line number Diff line change 55import  uuid 
66import  time 
77import  json 
8+ import  ctypes 
89import  fnmatch 
910import  multiprocessing 
11+ 
1012from  typing  import  (
1113    List ,
1214    Optional ,
2022from  collections  import  deque 
2123from  pathlib  import  Path 
2224
23- import  ctypes 
2425
2526from  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 (
 
 
   
 
     
   
   
          
    
    
     
    
      
     
     
    You can’t perform that action at this time.
  
 
    
  
    
      
        
     
       
      
     
   
 
    
    
  
 
  
 
     
    
0 commit comments