File size: 2,978 Bytes
17c6d62 |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 |
<!--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
|