Views
No views yet
1{
2 "hidden_size": 128,
3 "hidden_act": "gelu",
4 "initializer_range": 0.02,
5 "vocab_size": 30522,
6 "hidden_dropout_prob": 0.1,
7 "num_attention_heads": 2,
8 "type_vocab_size": 2,
9 "max_position_embeddings": 512,
10 "num_hidden_layers": 2,
11 "intermediate_size": 512,
12 "attention_probs_dropout_prob": 0.1
13}1from transformers import BertForPreTraining, BertTokenizer
2
3# Load the model and tokenizer
4model = BertForPreTraining.from_pretrained('bansalaman18/bert-uncased_L-2_H-128_A-2')
5tokenizer = BertTokenizer.from_pretrained('bansalaman18/bert-uncased_L-2_H-128_A-2')
6
7# Example usage
8text = "Hello, this is a sample text for BERT."
9inputs = tokenizer(text, return_tensors='pt')
10outputs = model(**inputs)1@article{devlin2018bert,
2 title={BERT: Pre-training of Deep Bidirectional Transformers for Language Understanding},
3 author={Devlin, Jacob and Chang, Ming-Wei and Lee, Kenton and Toutanova, Kristina},
4 journal={arXiv preprint arXiv:1810.04805},
5 year={2018}
6}