Instructions to use weiweishi/roc-bert-base-zh with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Transformers
How to use weiweishi/roc-bert-base-zh with Transformers:
# Use a pipeline as a high-level helper from transformers import pipeline pipe = pipeline("fill-mask", model="weiweishi/roc-bert-base-zh")# pip install -U transformers accelerate # Load model directly from transformers import AutoTokenizer, AutoModelForPreTraining tokenizer = AutoTokenizer.from_pretrained("weiweishi/roc-bert-base-zh") model = AutoModelForPreTraining.from_pretrained("weiweishi/roc-bert-base-zh", device_map="auto") - Inference
- Notebooks
- Google Colab
- Kaggle
|
Download README.md from weiweishi/roc-bert-base-zh: direct link, hf CLI and curl.
- Browser
- Download file 872 Bytes
-
https://huggingface.co/weiweishi/roc-bert-base-zh/resolve/cceceb1bfe99e41d1bfb442d27961499b019d22f/README.md
- Command line
-
hf download hf://weiweishi/roc-bert-base-zh@cceceb1bfe99e41d1bfb442d27961499b019d22f/README.md
-
curl -L -o README.md https://huggingface.co/weiweishi/roc-bert-base-zh/resolve/cceceb1bfe99e41d1bfb442d27961499b019d22f/README.md
872 Bytes
| language: en | |
| # RoCBert | |
| ## Introduction | |
| RoCBert is a pretrained Chinese language model that is robust under various forms of adversarial attacks proposed by WeChatAI in 2022, | |
| More detail: https://aclanthology.org/2022.acl-long.65.pdf | |
| ## How to use | |
| ```Python | |
| from transformers import AutoTokenizer, AutoModel | |
| tokenizer = AutoTokenizer.from_pretrained("weiweishi/roc-bert-base-zh") | |
| model = AutoModel.from_pretrained("weiweishi/roc-bert-base-zh") | |
| ``` | |
| ## Citation | |
| ```bibtex | |
| @inproceedings{su2022rocbert, | |
| title={RoCBert: Robust Chinese Bert with Multimodal Contrastive Pretraining}, | |
| author={Su, Hui and Shi, Weiwei and Shen, Xiaoyu and Xiao, Zhou and Ji, Tuo and Fang, Jiarui and Zhou, Jie}, | |
| booktitle={Proceedings of the 60th Annual Meeting of the Association for Computational Linguistics (Volume 1: Long Papers)}, | |
| pages={921--931}, | |
| year={2022} | |
| } | |
| ``` |