Delete plbert.py
Browse files
plbert.py
DELETED
@@ -1,15 +0,0 @@
|
|
1 |
-
# https://github.com/yl4579/StyleTTS2/blob/main/Utils/PLBERT/util.py
|
2 |
-
from transformers import AlbertConfig, AlbertModel
|
3 |
-
|
4 |
-
class CustomAlbert(AlbertModel):
|
5 |
-
def forward(self, *args, **kwargs):
|
6 |
-
# Call the original forward method
|
7 |
-
outputs = super().forward(*args, **kwargs)
|
8 |
-
# Only return the last_hidden_state
|
9 |
-
return outputs.last_hidden_state
|
10 |
-
|
11 |
-
def load_plbert():
|
12 |
-
plbert_config = {'vocab_size': 178, 'hidden_size': 768, 'num_attention_heads': 12, 'intermediate_size': 2048, 'max_position_embeddings': 512, 'num_hidden_layers': 12, 'dropout': 0.1}
|
13 |
-
albert_base_configuration = AlbertConfig(**plbert_config)
|
14 |
-
bert = CustomAlbert(albert_base_configuration)
|
15 |
-
return bert
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|