Huggingface Config

개발하는 G0·2023년 12월 22일
0
post-custom-banner
from transformers import BertConfig, AutoConfig, BertForPreTraining

bert_config = {'attention_probs_dropout_prob': 0.1,
                 'hidden_act': 'gelu',
                 'hidden_dropout_prob': 0.1,
                 'hidden_size': 768,
                 'initializer_range': 0.02,
                 'intermediate_size': 3072,
                 'max_position_embeddings': 512,
                 'num_attention_heads': 12,
                 'num_hidden_layers': 12,
                 'type_vocab_size': 2,
                 'vocab_size': 8002}

config = BertConfig.from_dict(bert_config)
print(config)

config = BertConfig.from_pretrained("bert-base-cased")
print(config)

config = AutoConfig.from_pretrained("bert-base-cased")
print(config)

model = BertForPreTraining.from_pretrained('bert-base-cased')
config = model.config
print(config)
profile
초보 개발자
post-custom-banner

0개의 댓글