Spaces:
Build error
Build error
Download model.py from cswamy/masked_language_model: direct link, hf CLI and curl.
- Browser
- Download file 347 Bytes
-
https://huggingface.co/spaces/cswamy/masked_language_model/resolve/main/model.py
- Command line
-
hf download hf://spaces/cswamy/masked_language_model/model.py
-
curl -L -o model.py https://huggingface.co/spaces/cswamy/masked_language_model/resolve/main/model.py
347 Bytes
| from transformers import AutoModelForMaskedLM, AutoTokenizer | |
| def create_distilbert_mlm(): | |
| """ | |
| Initializes model and tokenizer for distilbert checkpoint. | |
| """ | |
| checkpoint = "distilbert-base-uncased" | |
| tokenizer = AutoTokenizer.from_pretrained(checkpoint) | |
| model = AutoModelForMaskedLM.from_pretrained(checkpoint) | |
| return model, tokenizer | |