fairseq/models/huggingface/hf_gpt2.py

Killed 6 out of 24 mutants

Survived

Survived mutation testing. These mutants show holes in your test suite.

Mutant 1632

--- fairseq/models/huggingface/hf_gpt2.py
+++ fairseq/models/huggingface/hf_gpt2.py
@@ -21,7 +21,7 @@
     # it's prioritized over other installations. This allows
     # making local changes in the submodule.
     sys.path.insert(
-        0, os.path.join(os.path.dirname(__file__), 'transformers', 'src')
+        1, os.path.join(os.path.dirname(__file__), 'transformers', 'src')
     )
     from transformers import AutoModel, GPT2Config, GPT2LMHeadModel
     has_hf = True

Mutant 1633

--- fairseq/models/huggingface/hf_gpt2.py
+++ fairseq/models/huggingface/hf_gpt2.py
@@ -21,7 +21,7 @@
     # it's prioritized over other installations. This allows
     # making local changes in the submodule.
     sys.path.insert(
-        0, os.path.join(os.path.dirname(__file__), 'transformers', 'src')
+        0, os.path.join(os.path.dirname(__file__), 'XXtransformersXX', 'src')
     )
     from transformers import AutoModel, GPT2Config, GPT2LMHeadModel
     has_hf = True

Mutant 1634

--- fairseq/models/huggingface/hf_gpt2.py
+++ fairseq/models/huggingface/hf_gpt2.py
@@ -21,7 +21,7 @@
     # it's prioritized over other installations. This allows
     # making local changes in the submodule.
     sys.path.insert(
-        0, os.path.join(os.path.dirname(__file__), 'transformers', 'src')
+        0, os.path.join(os.path.dirname(__file__), 'transformers', 'XXsrcXX')
     )
     from transformers import AutoModel, GPT2Config, GPT2LMHeadModel
     has_hf = True

Mutant 1635

--- fairseq/models/huggingface/hf_gpt2.py
+++ fairseq/models/huggingface/hf_gpt2.py
@@ -26,7 +26,7 @@
     from transformers import AutoModel, GPT2Config, GPT2LMHeadModel
     has_hf = True
 except ImportError:
-    has_hf = False
+    has_hf = True
 
 
 logger = logging.getLogger(__name__)

Mutant 1636

--- fairseq/models/huggingface/hf_gpt2.py
+++ fairseq/models/huggingface/hf_gpt2.py
@@ -26,7 +26,7 @@
     from transformers import AutoModel, GPT2Config, GPT2LMHeadModel
     has_hf = True
 except ImportError:
-    has_hf = False
+    has_hf = None
 
 
 logger = logging.getLogger(__name__)

Mutant 1637

--- fairseq/models/huggingface/hf_gpt2.py
+++ fairseq/models/huggingface/hf_gpt2.py
@@ -29,7 +29,7 @@
     has_hf = False
 
 
-logger = logging.getLogger(__name__)
+logger = None
 
 
 DEFAULT_MAX_TARGET_POSITIONS = 1024

Mutant 1638

--- fairseq/models/huggingface/hf_gpt2.py
+++ fairseq/models/huggingface/hf_gpt2.py
@@ -32,7 +32,7 @@
 logger = logging.getLogger(__name__)
 
 
-DEFAULT_MAX_TARGET_POSITIONS = 1024
+DEFAULT_MAX_TARGET_POSITIONS = 1025
 
 
 @register_model('hf_gpt2')

Mutant 1639

--- fairseq/models/huggingface/hf_gpt2.py
+++ fairseq/models/huggingface/hf_gpt2.py
@@ -32,7 +32,7 @@
 logger = logging.getLogger(__name__)
 
 
-DEFAULT_MAX_TARGET_POSITIONS = 1024
+DEFAULT_MAX_TARGET_POSITIONS = None
 
 
 @register_model('hf_gpt2')

Mutant 1642

--- fairseq/models/huggingface/hf_gpt2.py
+++ fairseq/models/huggingface/hf_gpt2.py
@@ -49,7 +49,6 @@
                 'fairseq/models/huggingface/transformers'
             )
 
-    @staticmethod
     def add_args(parser):
         """Add model-specific arguments to the parser."""
         # fmt: off

Mutant 1643

--- fairseq/models/huggingface/hf_gpt2.py
+++ fairseq/models/huggingface/hf_gpt2.py
@@ -64,9 +64,7 @@
                                  'in the embeddings, encoder, and pooler')
         parser.add_argument('--attention-dropout', type=float, metavar='D',
                             help='dropout probability for attention weights')
-        # fmt: on
 
-    @classmethod
     def build_model(cls, args, task):
         """Build a new model instance."""
         default_architecture(args)

Mutant 1645

--- fairseq/models/huggingface/hf_gpt2.py
+++ fairseq/models/huggingface/hf_gpt2.py
@@ -162,7 +162,7 @@
         return self.model.config.n_positions - 1
 
 
-@register_model_architecture('hf_gpt2', 'hf_gpt2')
+@register_model_architecture('hf_gpt2', 'XXhf_gpt2XX')
 def default_architecture(args):
     if getattr(args, 'max_target_positions', None) is None:
         args.max_target_positions = getattr(

Mutant 1646

--- fairseq/models/huggingface/hf_gpt2.py
+++ fairseq/models/huggingface/hf_gpt2.py
@@ -161,8 +161,6 @@
     def max_positions(self):
         return self.model.config.n_positions - 1
 
-
-@register_model_architecture('hf_gpt2', 'hf_gpt2')
 def default_architecture(args):
     if getattr(args, 'max_target_positions', None) is None:
         args.max_target_positions = getattr(

Mutant 1648

--- fairseq/models/huggingface/hf_gpt2.py
+++ fairseq/models/huggingface/hf_gpt2.py
@@ -175,7 +175,7 @@
     args.attention_dropout = getattr(args, 'attention_dropout', 0.1)
 
 
-@register_model_architecture('hf_gpt2', 'hf_gpt2_medium')
+@register_model_architecture('hf_gpt2', 'XXhf_gpt2_mediumXX')
 def hf_gpt2_medium(args):
     args.embed_dim = getattr(args, 'embed_dim', 1024)
     args.num_attention_heads = getattr(args, 'num_attention_heads', 16)

Mutant 1649

--- fairseq/models/huggingface/hf_gpt2.py
+++ fairseq/models/huggingface/hf_gpt2.py
@@ -174,8 +174,6 @@
     args.dropout = getattr(args, 'dropout', 0.1)
     args.attention_dropout = getattr(args, 'attention_dropout', 0.1)
 
-
-@register_model_architecture('hf_gpt2', 'hf_gpt2_medium')
 def hf_gpt2_medium(args):
     args.embed_dim = getattr(args, 'embed_dim', 1024)
     args.num_attention_heads = getattr(args, 'num_attention_heads', 16)

Mutant 1651

--- fairseq/models/huggingface/hf_gpt2.py
+++ fairseq/models/huggingface/hf_gpt2.py
@@ -183,7 +183,7 @@
     default_architecture(args)
 
 
-@register_model_architecture('hf_gpt2', 'hf_gpt2_large')
+@register_model_architecture('hf_gpt2', 'XXhf_gpt2_largeXX')
 def hf_gpt2_large(args):
     args.embed_dim = getattr(args, 'embed_dim', 1280)
     args.num_attention_heads = getattr(args, 'num_attention_heads', 20)

Mutant 1652

--- fairseq/models/huggingface/hf_gpt2.py
+++ fairseq/models/huggingface/hf_gpt2.py
@@ -182,8 +182,6 @@
     args.num_layers = getattr(args, 'num_layers', 24)
     default_architecture(args)
 
-
-@register_model_architecture('hf_gpt2', 'hf_gpt2_large')
 def hf_gpt2_large(args):
     args.embed_dim = getattr(args, 'embed_dim', 1280)
     args.num_attention_heads = getattr(args, 'num_attention_heads', 20)

Mutant 1654

--- fairseq/models/huggingface/hf_gpt2.py
+++ fairseq/models/huggingface/hf_gpt2.py
@@ -191,7 +191,7 @@
     default_architecture(args)
 
 
-@register_model_architecture('hf_gpt2', 'hf_gpt2_xl')
+@register_model_architecture('hf_gpt2', 'XXhf_gpt2_xlXX')
 def hf_gpt2_xl(args):
     args.embed_dim = getattr(args, 'embed_dim', 1600)
     args.num_attention_heads = getattr(args, 'num_attention_heads', 25)

Mutant 1655

--- fairseq/models/huggingface/hf_gpt2.py
+++ fairseq/models/huggingface/hf_gpt2.py
@@ -190,8 +190,6 @@
     args.num_layers = getattr(args, 'num_layers', 36)
     default_architecture(args)
 
-
-@register_model_architecture('hf_gpt2', 'hf_gpt2_xl')
 def hf_gpt2_xl(args):
     args.embed_dim = getattr(args, 'embed_dim', 1600)
     args.num_attention_heads = getattr(args, 'num_attention_heads', 25)