From a7b84d5113707ad467684b76ea2ec636e9a4859f Mon Sep 17 00:00:00 2001 From: Michael Gschwind Date: Thu, 3 Sep 2020 09:55:10 -0700 Subject: [PATCH] Prevent from changing the interface specification once set. Summary: Prevent from changing the interface specification once set. fbshipit-source-id: 123600ed4f2bf7148d46c8e3cf6dfe0d34908546 --- pytext/torchscript/module.py | 2 ++ 1 file changed, 2 insertions(+) diff --git a/pytext/torchscript/module.py b/pytext/torchscript/module.py index a431c8d21..bcc98a067 100644 --- a/pytext/torchscript/module.py +++ b/pytext/torchscript/module.py @@ -150,6 +150,8 @@ def inference_interface(self, argument_type: str): # LANGUAGES = 3 # DENSE_FEAT = 4 + if (sel.argno != -1): + raise RuntimeError("Cannot change argument type.") if argument_type == "texts": self.argno = TEXTS else: