Skip to content
Merged

no-op #2622

Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
28 changes: 17 additions & 11 deletions lit_nlp/components/ablation_flip_int_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -58,27 +58,33 @@ def predict(self,

class ModelBasedAblationFlipTest(absltest.TestCase):

def setUp(self):
super(ModelBasedAblationFlipTest, self).setUp()
self.ablation_flip = ablation_flip.AblationFlip()

@classmethod
def setUpClass(cls):
super().setUpClass()
# Classification model that clasifies a given input sentence.
self.classification_model = glue_models.SST2Model(BERT_TINY_PATH)
self.classification_config = {ablation_flip.PREDICTION_KEY: 'probas'}
cls.classification_model = glue_models.SST2Model(BERT_TINY_PATH)

# Classification model with the 'sentence' field marked as
# non-required.
self.classification_model_non_required_field = SST2ModelNonRequiredField(
BERT_TINY_PATH)
cls.classification_model_non_required_field = SST2ModelNonRequiredField(
BERT_TINY_PATH
)

# Classification model with a counter to count number of predict calls.
# TODO(ataly): Consider setting up a Mock object to count number of
# predict calls.
self.classification_model_with_predict_counter = (
SST2ModelWithPredictCounter(BERT_TINY_PATH))
cls.classification_model_with_predict_counter = SST2ModelWithPredictCounter(
BERT_TINY_PATH
)

# Regression model determining similarity between two input sentences.
self.regression_model = glue_models.STSBModel(STSB_PATH)
cls.regression_model = glue_models.STSBModel(STSB_PATH)

def setUp(self):
super().setUp()
self.ablation_flip = ablation_flip.AblationFlip()
self.classification_config = {ablation_flip.PREDICTION_KEY: 'probas'}
self.classification_model_with_predict_counter.predict_counter = 0
self.regression_config = {ablation_flip.PREDICTION_KEY: 'score'}

def test_ablation_flip_num_ex(self):
Expand Down
11 changes: 6 additions & 5 deletions lit_nlp/components/hotflip_int_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -50,13 +50,14 @@

class HotflipIntegrationTest(parameterized.TestCase):

def __init__(self, *args, **kwargs):
super(HotflipIntegrationTest, self).__init__(*args, **kwargs)
self.classification_model = glue_models.SST2Model(BERT_TINY_PATH)
self.regression_model = glue_models.STSBModel(STSB_PATH)
@classmethod
def setUpClass(cls):
super().setUpClass()
cls.classification_model = glue_models.SST2Model(BERT_TINY_PATH)
cls.regression_model = glue_models.STSBModel(STSB_PATH)

def setUp(self):
super(HotflipIntegrationTest, self).setUp()
super().setUp()
self.hotflip = hotflip.HotFlip()

@parameterized.named_parameters(
Expand Down
Loading
Loading