Download darkbert_model/benchmark-dataset.py from Bartholomew-1/darkbert: direct link, hf CLI and curl.
- Browser
- Download file 575 Bytes
-
https://huggingface.co/Bartholomew-1/darkbert/resolve/main/darkbert_model/benchmark-dataset.py
- Command line
-
hf download hf://Bartholomew-1/darkbert/darkbert_model/benchmark-dataset.py
-
curl -L -o benchmark-dataset.py https://huggingface.co/Bartholomew-1/darkbert/resolve/main/darkbert_model/benchmark-dataset.py
575 Bytes
| from transformers import pipeline | |
| folder_dir = "DarkBERT" | |
| unmasker = pipeline('fill-mask', model=folder_dir) | |
| unmasker("RagnarLocker, LockBit, and REvil are types of <mask>.") | |
| from transformers import AutoModel, AutoTokenizer | |
| model = AutoModel.from_pretrained(folder_dir) | |
| tokenizer = AutoTokenizer.from_pretrained(folder_dir) | |
| text = "Recent research has suggested that there are clear differences in the language used in the Dark Web compared to that of the Surface Web." | |
| encoded = tokenizer(text, return_tensors="pt") | |
| output = model(**encoded) | |
| output[0].shape | |