| <!--Copyright 2020 The HuggingFace Team. All rights reserved. | |
| Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with | |
| the License. You may obtain a copy of the License at | |
| http://www.apache.org/licenses/LICENSE-2.0 | |
| Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on | |
| an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the | |
| specific language governing permissions and limitations under the License. | |
| โ ๏ธ Note that this file is in Markdown but contain specific syntax for our doc-builder (similar to MDX) that may not be | |
| rendered properly in your Markdown viewer. | |
| --> | |
| # BERTweet [[bertweet]] | |
| ## ๊ฐ์ [[overview]] | |
| BERTweet ๋ชจ๋ธ์ Dat Quoc Nguyen, Thanh Vu, Anh Tuan Nguyen์ ์ํด [BERTweet: A pre-trained language model for English Tweets](https://www.aclweb.org/anthology/2020.emnlp-demos.2.pdf) ์์ ์ ์๋์์ต๋๋ค. | |
| ํด๋น ๋ ผ๋ฌธ์ ์ด๋ก : | |
| *์์ด ํธ์์ ์ํ ์ต์ด์ ๊ณต๊ฐ ๋๊ท๋ชจ ์ฌ์ ํ์ต๋ ์ธ์ด ๋ชจ๋ธ์ธ BERTweet์ ์๊ฐํฉ๋๋ค. | |
| BERTweet์ BERT-base(Devlin et al., 2019)์ ๋์ผํ ์ํคํ ์ฒ๋ฅผ ๊ฐ์ง๊ณ ์์ผ๋ฉฐ, RoBERTa ์ฌ์ ํ์ต ์ ์ฐจ(Liu et al., 2019)๋ฅผ ์ฌ์ฉํ์ฌ ํ์ต๋์์ต๋๋ค. | |
| ์คํ ๊ฒฐ๊ณผ, BERTweet์ ๊ฐ๋ ฅํ ๊ธฐ์ค ๋ชจ๋ธ์ธ RoBERTa-base ๋ฐ XLM-R-base(Conneau et al., 2020)์ ์ฑ๋ฅ์ ๋ฅ๊ฐํ์ฌ ์ธ ๊ฐ์ง ํธ์ NLP ์์ (ํ์ฌ ํ๊น , ๊ฐ์ฒด๋ช ์ธ์, ํ ์คํธ ๋ถ๋ฅ)์์ ์ด์ ์ต์ ๋ชจ๋ธ๋ณด๋ค ๋ ๋์ ์ฑ๋ฅ์ ๋ณด์ฌ์ฃผ์์ต๋๋ค.* | |
| ์ด ๋ชจ๋ธ์ [dqnguyen](https://huggingface.co/dqnguyen) ๊ป์ ๊ธฐ์ฌํ์ จ์ต๋๋ค. ์๋ณธ ์ฝ๋๋ [์ฌ๊ธฐ](https://github.com/VinAIResearch/BERTweet).์์ ํ์ธํ ์ ์์ต๋๋ค. | |
| ## ์ฌ์ฉ ์์ [[usage-example]] | |
| ```python | |
| >>> import torch | |
| >>> from transformers import AutoModel, AutoTokenizer | |
| >>> bertweet = AutoModel.from_pretrained("vinai/bertweet-base") | |
| >>> # ํธ๋์คํฌ๋จธ ๋ฒ์ 4.x ์ด์ : | |
| >>> tokenizer = AutoTokenizer.from_pretrained("vinai/bertweet-base", use_fast=False) | |
| >>> # ํธ๋์คํฌ๋จธ ๋ฒ์ 3.x ์ด์: | |
| >>> # tokenizer = AutoTokenizer.from_pretrained("vinai/bertweet-base") | |
| >>> # ์ ๋ ฅ๋ ํธ์์ ์ด๋ฏธ ์ ๊ทํ๋์์ต๋๋ค! | |
| >>> line = "SC has first two presumptive cases of coronavirus , DHEC confirms HTTPURL via @USER :cry:" | |
| >>> input_ids = torch.tensor([tokenizer.encode(line)]) | |
| >>> with torch.no_grad(): | |
| ... features = bertweet(input_ids) # Models outputs are now tuples | |
| >>> # With TensorFlow 2.0+: | |
| >>> # from transformers import TFAutoModel | |
| >>> # bertweet = TFAutoModel.from_pretrained("vinai/bertweet-base") | |
| ``` | |
| <Tip> | |
| ์ด ๊ตฌํ์ ํ ํฐํ ๋ฐฉ๋ฒ์ ์ ์ธํ๊ณ ๋ BERT์ ๋์ผํฉ๋๋ค. API ์ฐธ์กฐ ์ ๋ณด๋ [BERT ๋ฌธ์](bert) ๋ฅผ ์ฐธ์กฐํ์ธ์. | |
| </Tip> | |
| ## Bertweet ํ ํฐํ(BertweetTokenizer) [[transformers.BertweetTokenizer]] | |
| [[autodoc]] BertweetTokenizer | |