Initial commit
Browse files- config.json +30 -0
 - configuration.py +9 -0
 - modeling.py +11 -0
 - pytorch_model.bin +3 -0
 
    	
        config.json
    ADDED
    
    | 
         @@ -0,0 +1,30 @@ 
     | 
|
| 
         | 
|
| 
         | 
|
| 
         | 
|
| 
         | 
|
| 
         | 
|
| 
         | 
|
| 
         | 
|
| 
         | 
|
| 
         | 
|
| 
         | 
|
| 
         | 
|
| 
         | 
|
| 
         | 
|
| 
         | 
|
| 
         | 
|
| 
         | 
|
| 
         | 
|
| 
         | 
|
| 
         | 
|
| 
         | 
|
| 
         | 
|
| 
         | 
|
| 
         | 
|
| 
         | 
|
| 
         | 
|
| 
         | 
|
| 
         | 
|
| 
         | 
|
| 
         | 
|
| 
         | 
| 
         | 
|
| 1 | 
         
            +
            {
         
     | 
| 2 | 
         
            +
              "_name_or_path": "hf-internal-testing/tiny-bert",
         
     | 
| 3 | 
         
            +
              "architectures": [
         
     | 
| 4 | 
         
            +
                "NewModel"
         
     | 
| 5 | 
         
            +
              ],
         
     | 
| 6 | 
         
            +
              "attention_probs_dropout_prob": 0.1,
         
     | 
| 7 | 
         
            +
              "auto_map": {
         
     | 
| 8 | 
         
            +
                "AutoConfig": "configuration.NewModelConfig",
         
     | 
| 9 | 
         
            +
                "AutoModel": "modeling.NewModel"
         
     | 
| 10 | 
         
            +
              },
         
     | 
| 11 | 
         
            +
              "classifier_dropout": null,
         
     | 
| 12 | 
         
            +
              "hidden_act": "gelu",
         
     | 
| 13 | 
         
            +
              "hidden_dropout_prob": 0.1,
         
     | 
| 14 | 
         
            +
              "hidden_size": 128,
         
     | 
| 15 | 
         
            +
              "initializer_range": 0.02,
         
     | 
| 16 | 
         
            +
              "intermediate_size": 512,
         
     | 
| 17 | 
         
            +
              "layer_norm_eps": 1e-12,
         
     | 
| 18 | 
         
            +
              "max_position_embeddings": 512,
         
     | 
| 19 | 
         
            +
              "model_type": "new-model",
         
     | 
| 20 | 
         
            +
              "new_hidden_size": 12,
         
     | 
| 21 | 
         
            +
              "num_attention_heads": 2,
         
     | 
| 22 | 
         
            +
              "num_hidden_layers": 2,
         
     | 
| 23 | 
         
            +
              "pad_token_id": 0,
         
     | 
| 24 | 
         
            +
              "position_embedding_type": "absolute",
         
     | 
| 25 | 
         
            +
              "torch_dtype": "float32",
         
     | 
| 26 | 
         
            +
              "transformers_version": "4.16.0.dev0",
         
     | 
| 27 | 
         
            +
              "type_vocab_size": 2,
         
     | 
| 28 | 
         
            +
              "use_cache": true,
         
     | 
| 29 | 
         
            +
              "vocab_size": 30522
         
     | 
| 30 | 
         
            +
            }
         
     | 
    	
        configuration.py
    ADDED
    
    | 
         @@ -0,0 +1,9 @@ 
     | 
|
| 
         | 
|
| 
         | 
|
| 
         | 
|
| 
         | 
|
| 
         | 
|
| 
         | 
|
| 
         | 
|
| 
         | 
|
| 
         | 
| 
         | 
|
| 1 | 
         
            +
             
     | 
| 2 | 
         
            +
            from transformers import BertConfig
         
     | 
| 3 | 
         
            +
             
     | 
| 4 | 
         
            +
            class NewModelConfig(BertConfig):
         
     | 
| 5 | 
         
            +
                model_type = "new-model"
         
     | 
| 6 | 
         
            +
                
         
     | 
| 7 | 
         
            +
                def __init__(self, *args, new_hidden_size=12, **kwargs):
         
     | 
| 8 | 
         
            +
                    super().__init__(*args, **kwargs)
         
     | 
| 9 | 
         
            +
                    self.new_hidden_size = new_hidden_size
         
     | 
    	
        modeling.py
    ADDED
    
    | 
         @@ -0,0 +1,11 @@ 
     | 
|
| 
         | 
|
| 
         | 
|
| 
         | 
|
| 
         | 
|
| 
         | 
|
| 
         | 
|
| 
         | 
|
| 
         | 
|
| 
         | 
|
| 
         | 
|
| 
         | 
| 
         | 
|
| 1 | 
         
            +
            import torch
         
     | 
| 2 | 
         
            +
            from transformers import BertModel
         
     | 
| 3 | 
         
            +
             
     | 
| 4 | 
         
            +
            from .configuration import NewModelConfig
         
     | 
| 5 | 
         
            +
             
     | 
| 6 | 
         
            +
            class NewModel(BertModel):
         
     | 
| 7 | 
         
            +
                config_class = NewModelConfig
         
     | 
| 8 | 
         
            +
             
     | 
| 9 | 
         
            +
                def __init__(self, config):
         
     | 
| 10 | 
         
            +
                    super().__init__(config)
         
     | 
| 11 | 
         
            +
                    self.last_layer = torch.nn.Linear(config.hidden_size, config.new_hidden_size)
         
     | 
    	
        pytorch_model.bin
    ADDED
    
    | 
         @@ -0,0 +1,3 @@ 
     | 
|
| 
         | 
|
| 
         | 
|
| 
         | 
| 
         | 
|
| 1 | 
         
            +
            version https://git-lfs.github.com/spec/v1
         
     | 
| 2 | 
         
            +
            oid sha256:abe537dcbbc0a24d9d81979744669d1f8d7adca535f81cb76f68c42b3fe18ace
         
     | 
| 3 | 
         
            +
            size 17568615
         
     |