How mlwithme/bertwithpretrained works
BertWithPretrained is a PyTorch BERT implementation and task-training suite. Users provide task datasets and pretrained model files, run a task script, and receive trained or inferred classification, entailment, multiple-choice, question-answering, NER, or pretraining results. Task-specific dataset loaders prepare examples; task heads use the shared BERT encoder. The graph preserves the README’s documented capabilities, but several task implementations and loader-to-task calls were not excerpted, so those relationships are documented at the README level rather than inferred from unsampled code.
Main entry points: Bert.py BERT encoder · data_helpers.py Task dataset loaders · bert_base_chinese Pretrained files · TaskForSingleSentenceClassification.py Chinese classification
Components 20
Task workflows
- Chinese classification
Tasks/TaskForSingleSentenceClassification.py - MNLI entailment
Tasks/TaskForPairSentenceClassification.py - SWAG choices
Tasks/TaskForMultipleChoice.py - SQuAD answers
Tasks/TaskForSQuADQuestionAnswering.py - Chinese NER
Tasks/TaskForChineseNER.py - BERT pretraining
Tasks/TaskForPretraining.py
Data preparation
- Task datasets
data - Pretrained files
bert_base_chinese - Task dataset loaders
utils/data_helpers.py - Pretraining data builder
utils/create_pretraining_data.py
Task heads
- Sentence classifier
model/DownstreamTasks/BertForSentenceClassification.py - Multiple-choice head
model/DownstreamTasks/BertForMultipleChoice.py - Question-answer head
model/DownstreamTasks/BertForQuestionAnswering.py - Token classifier
model/DownstreamTasks/BertForTokenClassification.py - NSP and MLM heads
model/DownstreamTasks/BertForNSPAndMLM.py
BERT core
- BERT encoder
model/BasicBert/Bert.py - Input embeddings
model/BasicBert/BertEmbedding.py - Attention layers
model/BasicBert/MyTransformer.py - BERT configuration
model/BasicBert/BertConfig.py
Other components
- Engineer
Connections 32
- Engineer → Chinese classification: runs
README.md - Engineer → MNLI entailment: runs
README.md - Engineer → SWAG choices: runs
README.md - Engineer → SQuAD answers: runs
README.md - Engineer → Chinese NER: runs
README.md - Engineer → BERT pretraining: runs
README.md - Task datasets → Task dataset loaders: provides examples
README.md - Task dataset loaders → Chinese classification: prepares input
README.md - Task dataset loaders → MNLI entailment: prepares input
README.md - Task dataset loaders → SWAG choices: prepares input
README.md - Task dataset loaders → SQuAD answers: prepares input
README.md - Task dataset loaders → Chinese NER: prepares input
README.md - Pretraining data builder → BERT pretraining: prepares examples
README.md - Chinese classification → Sentence classifier: trains or infers
README.md - MNLI entailment → Sentence classifier: trains or infers
README.md - SWAG choices → Multiple-choice head: trains or infers
README.md - SQuAD answers → Question-answer head: trains or infers
README.md - Chinese NER → Token classifier: trains or infers
README.md - BERT pretraining → NSP and MLM heads: trains
README.md - Sentence classifier → BERT encoder: calls encoder
model/DownstreamTasks/BertForSentenceClassification.py - Multiple-choice head → BERT encoder: calls encoder
model/DownstreamTasks/BertForMultipleChoice.py - Question-answer head → BERT encoder: calls encoder
model/DownstreamTasks/BertForQuestionAnswering.py - Token classifier → BERT encoder: calls encoder
model/DownstreamTasks/BertForTokenClassification.py - NSP and MLM heads → BERT encoder: uses encoder
model/DownstreamTasks/BertForNSPAndMLM.py - BERT encoder → Input embeddings: uses embeddings
model/BasicBert/Bert.py - BERT encoder → Attention layers: uses attention
model/BasicBert/Bert.py - BERT encoder → BERT configuration: configured by
- Chinese classification → Pretrained files: loads weights
- MNLI entailment → Pretrained files: loads weights
- SWAG choices → Pretrained files: loads weights
- SQuAD answers → Pretrained files: loads weights
- Chinese NER → Pretrained files: loads weights