Instructions to use igorktech/hibial-bert-i3-mlm-v0.1 with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Transformers
How to use igorktech/hibial-bert-i3-mlm-v0.1 with Transformers:
# Use a pipeline as a high-level helper from transformers import pipeline pipe = pipeline("fill-mask", model="igorktech/hibial-bert-i3-mlm-v0.1", trust_remote_code=True)# Load model directly from transformers import AutoModelForMaskedLM model = AutoModelForMaskedLM.from_pretrained("igorktech/hibial-bert-i3-mlm-v0.1", trust_remote_code=True, dtype="auto") - Notebooks
- Google Colab
- Kaggle
Update modelling_hibial.py
Browse files- modelling_hibial.py +3 -1
modelling_hibial.py
CHANGED
|
@@ -180,7 +180,7 @@ class TransformerEncoderLayer(Module):
|
|
| 180 |
|
| 181 |
# Extend mask
|
| 182 |
# src_mask = src_mask.repeat(self.self_attn.num_heads, 1, 1)
|
| 183 |
-
|
| 184 |
# PreLayerNorm
|
| 185 |
if self.norm_first:
|
| 186 |
|
|
@@ -334,6 +334,8 @@ class HiBiAlBert(Module):
|
|
| 334 |
bialibi_utt_mask[enc_mask_utt.bool()] = float('-inf')
|
| 335 |
bialibi_ct_mask[enc_mask_ct.bool()] = float('-inf')
|
| 336 |
|
|
|
|
|
|
|
| 337 |
# memory = self.encoder(input_ids, mask=src_mask, src_key_padding_mask=src_key_padding_mask)
|
| 338 |
|
| 339 |
# Encoding
|
|
|
|
| 180 |
|
| 181 |
# Extend mask
|
| 182 |
# src_mask = src_mask.repeat(self.self_attn.num_heads, 1, 1)
|
| 183 |
+
|
| 184 |
# PreLayerNorm
|
| 185 |
if self.norm_first:
|
| 186 |
|
|
|
|
| 334 |
bialibi_utt_mask[enc_mask_utt.bool()] = float('-inf')
|
| 335 |
bialibi_ct_mask[enc_mask_ct.bool()] = float('-inf')
|
| 336 |
|
| 337 |
+
src_key_padding_mask = torch.where(src_key_padding_mask, torch.tensor(float('-inf')), torch.tensor(0.0))
|
| 338 |
+
|
| 339 |
# memory = self.encoder(input_ids, mask=src_mask, src_key_padding_mask=src_key_padding_mask)
|
| 340 |
|
| 341 |
# Encoding
|