File tree Expand file tree Collapse file tree 1 file changed +7
-5
lines changed
Filter options
Expand file tree Collapse file tree 1 file changed +7
-5
lines changed
Original file line number Diff line number Diff line change @@ -1638,12 +1638,14 @@ def create_chat_completion(
1638
1638
)
1639
1639
return self ._convert_completion_to_chat (completion_or_chunks , stream = stream ) # type: ignore
1640
1640
1641
- def _free_model (self ):
1642
- if hasattr (self , "model" ) and self .model is not None :
1643
- llama_cpp .llama_free_model (self .model )
1641
+ def _free_model (self , * , _lfree_model = llama_cpp ._lib .llama_free_model , _free = llama_cpp ._lib .llama_free ):
1642
+ model = getattr (self , 'model' , None )
1643
+ if model is not None :
1644
+ _lfree_model (model )
1644
1645
self .model = None
1645
- if hasattr (self , "ctx" ) and self .ctx is not None :
1646
- llama_cpp .llama_free (self .ctx )
1646
+ ctx = getattr (self , 'ctx' , None )
1647
+ if ctx is not None :
1648
+ _free (ctx )
1647
1649
self .ctx = None
1648
1650
1649
1651
def __del__ (self ):
You can’t perform that action at this time.
0 commit comments