Instructions to use HPLT/hplt_bert_base_ja with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Transformers
How to use HPLT/hplt_bert_base_ja with Transformers:
# Use a pipeline as a high-level helper from transformers import pipeline pipe = pipeline("fill-mask", model="HPLT/hplt_bert_base_ja", trust_remote_code=True)# Load model directly from transformers import AutoModelForMaskedLM model = AutoModelForMaskedLM.from_pretrained("HPLT/hplt_bert_base_ja", trust_remote_code=True, dtype="auto") - Notebooks
- Google Colab
- Kaggle
Update modeling_ltgbert.py
#1
by KoichiYasuoka - opened
- modeling_ltgbert.py +4 -2
modeling_ltgbert.py
CHANGED
|
@@ -252,8 +252,10 @@ class LtgbertPreTrainedModel(PreTrainedModel):
|
|
| 252 |
elif isinstance(module, nn.Embedding):
|
| 253 |
nn.init.trunc_normal_(module.weight.data, mean=0.0, std=std, a=-2*std, b=2*std)
|
| 254 |
elif isinstance(module, nn.LayerNorm):
|
| 255 |
-
module.bias
|
| 256 |
-
|
|
|
|
|
|
|
| 257 |
|
| 258 |
|
| 259 |
class LtgbertModel(LtgbertPreTrainedModel):
|
|
|
|
| 252 |
elif isinstance(module, nn.Embedding):
|
| 253 |
nn.init.trunc_normal_(module.weight.data, mean=0.0, std=std, a=-2*std, b=2*std)
|
| 254 |
elif isinstance(module, nn.LayerNorm):
|
| 255 |
+
if module.bias is not None:
|
| 256 |
+
module.bias.data.zero_()
|
| 257 |
+
if module.weight is not None:
|
| 258 |
+
module.weight.data.fill_(1.0)
|
| 259 |
|
| 260 |
|
| 261 |
class LtgbertModel(LtgbertPreTrainedModel):
|