Skip to content
This repository was archived by the owner on Sep 25, 2025. It is now read-only.
This repository was archived by the owner on Sep 25, 2025. It is now read-only.

bert loading #1391

@namai-dev

Description

@namai-dev

why is it cant work

import tensorflow as tf
from transformers import BertTokenizer, TFBertForSequenceClassification

bert_base_dir = "/path/to/bert/uncased_L-12_H-768_A-12"
model_path = bert_base_dir + "/bert_model.ckpt"
config_path = bert_base_dir + "/bert_config.json"
vocab_path = bert_base_dir + "/vocab.txt"

tokenizer = BertTokenizer.from_pretrained(vocab_path)

model = TFBertForSequenceClassification.from_pretrained(
config_path,
num_labels=2,
from_pt=True
)

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions