# Train bert from scratch using run\_mlm.py

**URL:** <https://discuss.huggingface.co/t/train-bert-from-scratch-using-run-mlm-py/16050>\
**Category:** Beginners\
**Created:** [March 25, 2022, 3:18am UTC](https://discuss.huggingface.co/t/train-bert-from-scratch-using-run-mlm-py/16050 "2022-03-25T03:18:16Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![hxz116](https://avatars.discourse-cdn.com/v4/letter/h/b5e925/32.png) [@hxz116](https://discuss.huggingface.co/u/hxz116)\
**Post date:** [March 25, 2022, 3:18am UTC](https://discuss.huggingface.co/t/train-bert-from-scratch-using-run-mlm-py/16050/1 "2022-03-25T03:18:16Z")

</div>

following [the huggingface example](https://github.com/huggingface/transformers/tree/main/examples/pytorch/language-modeling) I ran:

> python run\_mlm.py   
> –model\_type bert   
> –tokenizer\_name roberta-base   
> –dataset\_name wikitext   
> –dataset\_config\_name wikitext-2-raw-v1   
> –output\_dir /tmp/mlm-full/

However the above script finished pre-maturely without training:  
Dropping the following result as it does not have all the necessary fields:  
{‘task’: {‘name’: ‘Masked Language Modeling’, ‘type’: ‘fill-mask’}, ‘dataset’: {‘name’: ‘wikitext wikitext-2-raw-v1’, ‘type’: ‘wikitext’, ‘args’: ‘wikitext-2-raw-v1’}}

how do i do a **train from scratch**? any arguments i missed? I am a beginner.
