Remove automatic recompilation
This commit is contained in:
parent
75bae768b6
commit
4ddeefad07
|
@ -20,26 +20,9 @@ class Classifier:
|
|||
"""
|
||||
|
||||
def __init__(self, model):
|
||||
try:
|
||||
model_version = model["__version__"]
|
||||
except:
|
||||
model_version = 1
|
||||
|
||||
if model_version == 3:
|
||||
self.model = model
|
||||
else:
|
||||
# The model is an unsupported version
|
||||
try:
|
||||
raw_model = model["__raw__"]
|
||||
except:
|
||||
raise gptc.exceptions.UnsupportedModelError(
|
||||
"this model is unsupported and does not contain a raw model for recompiling"
|
||||
)
|
||||
|
||||
warnings.warn(
|
||||
"model needed to be recompiled on-the-fly; please re-compile it and use the new compiled model in the future"
|
||||
)
|
||||
self.model = gptc.compiler.compile(raw_model)
|
||||
if model.get("__version__", 0) != 3:
|
||||
raise gptc.exceptions.UnsupportedModelError(f"unsupported model version")
|
||||
self.model = model
|
||||
|
||||
def confidence(self, text):
|
||||
"""Classify text with confidence.
|
||||
|
|
|
@ -60,6 +60,5 @@ def compile(raw_model):
|
|||
model["__names__"] = names
|
||||
|
||||
model["__version__"] = 3
|
||||
model["__raw__"] = raw_model
|
||||
|
||||
return model
|
||||
|
|
Loading…
Reference in New Issue
Block a user