Add runtime check to ensure embedding is enabled if trying to generate embeddings

This commit is contained in:
Andrei Betlen 2023-04-05 03:25:37 -04:00
parent 5c50af7462
commit cefc69ea43

View file

@ -242,6 +242,11 @@ class Llama:
"""
assert self.ctx is not None
if self.params.embedding == False:
raise RuntimeError(
"Llama model must be created with embedding=True to call this method"
)
if self.verbose:
llama_cpp.llama_reset_timings(self.ctx)