From 321c05abab5a182c8cdc28f4fddea65458785640 Mon Sep 17 00:00:00 2001 From: krevas Date: Mon, 29 Jun 2020 14:47:44 +0900 Subject: [PATCH] Model cards for finance-koelectra models (#5313) * Add finance-koelectra readme card * Add finance-koelectra readme card * Add finance-koelectra readme card * Add finance-koelectra readme card --- .../README.md | 45 +++++++++++++++++++ .../README.md | 41 +++++++++++++++++ .../README.md | 45 +++++++++++++++++++ .../README.md | 41 +++++++++++++++++ 4 files changed, 172 insertions(+) create mode 100644 model_cards/krevas/finance-koelectra-base-discriminator/README.md create mode 100644 model_cards/krevas/finance-koelectra-base-generator/README.md create mode 100644 model_cards/krevas/finance-koelectra-small-discriminator/README.md create mode 100644 model_cards/krevas/finance-koelectra-small-generator/README.md diff --git a/model_cards/krevas/finance-koelectra-base-discriminator/README.md b/model_cards/krevas/finance-koelectra-base-discriminator/README.md new file mode 100644 index 0000000000..0f9a0f336e --- /dev/null +++ b/model_cards/krevas/finance-koelectra-base-discriminator/README.md @@ -0,0 +1,45 @@ +--- +language: korean +--- + +# 📈 Financial Korean ELECTRA model + +Pretrained ELECTRA Language Model for Korean (`finance-koelectra-base-discriminator`) + +> ELECTRA is a new method for self-supervised language representation learning. It can be used to +> pre-train transformer networks using relatively little compute. ELECTRA models are trained to +> distinguish "real" input tokens vs "fake" input tokens generated by another neural network, similar to +> the discriminator of a GAN. + +More details about ELECTRA can be found in the [ICLR paper](https://openreview.net/forum?id=r1xMH1BtvB) +or in the [official ELECTRA repository](https://github.com/google-research/electra) on GitHub. + +## Stats + +The current version of the model is trained on a financial news data of Naver news. + +The final training corpus has a size of 25GB and 2.3B tokens. + +This model was trained a cased model on a TITAN RTX for 500k steps. + +## Usage + +```python +from transformers import ElectraForPreTraining, ElectraTokenizer +import torch +discriminator = ElectraForPreTraining.from_pretrained("krevas/finance-koelectra-base-discriminator") +tokenizer = ElectraTokenizer.from_pretrained("krevas/finance-koelectra-base-discriminator") +sentence = "내일 해당 종목이 대폭 상승할 것이다" +fake_sentence = "내일 해당 종목이 맛있게 상승할 것이다" +fake_tokens = tokenizer.tokenize(fake_sentence) +fake_inputs = tokenizer.encode(fake_sentence, return_tensors="pt") +discriminator_outputs = discriminator(fake_inputs) +predictions = torch.round((torch.sign(discriminator_outputs[0]) + 1) / 2) +[print("%7s" % token, end="") for token in fake_tokens] +[print("%7s" % int(prediction), end="") for prediction in predictions.tolist()[1:-1]] +print("fake token : %s" % fake_tokens[predictions.tolist()[1:-1].index(1)]) +``` + +# Huggingface model hub + +All models are available on the [Huggingface model hub](https://huggingface.co/krevas). diff --git a/model_cards/krevas/finance-koelectra-base-generator/README.md b/model_cards/krevas/finance-koelectra-base-generator/README.md new file mode 100644 index 0000000000..8b1db4211f --- /dev/null +++ b/model_cards/krevas/finance-koelectra-base-generator/README.md @@ -0,0 +1,41 @@ +--- +language: korean +--- + +# 📈 Financial Korean ELECTRA model + +Pretrained ELECTRA Language Model for Korean (`finance-koelectra-base-generator`) + +> ELECTRA is a new method for self-supervised language representation learning. It can be used to +> pre-train transformer networks using relatively little compute. ELECTRA models are trained to +> distinguish "real" input tokens vs "fake" input tokens generated by another neural network, similar to +> the discriminator of a GAN. + +More details about ELECTRA can be found in the [ICLR paper](https://openreview.net/forum?id=r1xMH1BtvB) +or in the [official ELECTRA repository](https://github.com/google-research/electra) on GitHub. + +## Stats + +The current version of the model is trained on a financial news data of Naver news. + +The final training corpus has a size of 25GB and 2.3B tokens. + +This model was trained a cased model on a TITAN RTX for 500k steps. + +## Usage + +```python +from transformers import pipeline + +fill_mask = pipeline( + "fill-mask", + model="krevas/finance-koelectra-base-generator", + tokenizer="krevas/finance-koelectra-base-generator" + ) + +print(fill_mask(f"내일 해당 종목이 대폭 {fill_mask.tokenizer.mask_token}할 것이다.")) +``` + +# Huggingface model hub + +All models are available on the [Huggingface model hub](https://huggingface.co/krevas). diff --git a/model_cards/krevas/finance-koelectra-small-discriminator/README.md b/model_cards/krevas/finance-koelectra-small-discriminator/README.md new file mode 100644 index 0000000000..e46844f120 --- /dev/null +++ b/model_cards/krevas/finance-koelectra-small-discriminator/README.md @@ -0,0 +1,45 @@ +--- +language: korean +--- + +# 📈 Financial Korean ELECTRA model + +Pretrained ELECTRA Language Model for Korean (`finance-koelectra-small-discriminator`) + +> ELECTRA is a new method for self-supervised language representation learning. It can be used to +> pre-train transformer networks using relatively little compute. ELECTRA models are trained to +> distinguish "real" input tokens vs "fake" input tokens generated by another neural network, similar to +> the discriminator of a GAN. + +More details about ELECTRA can be found in the [ICLR paper](https://openreview.net/forum?id=r1xMH1BtvB) +or in the [official ELECTRA repository](https://github.com/google-research/electra) on GitHub. + +## Stats + +The current version of the model is trained on a financial news data of Naver news. + +The final training corpus has a size of 25GB and 2.3B tokens. + +This model was trained a cased model on a TITAN RTX for 500k steps. + +## Usage + +```python +from transformers import ElectraForPreTraining, ElectraTokenizer +import torch +discriminator = ElectraForPreTraining.from_pretrained("krevas/finance-koelectra-small-discriminator") +tokenizer = ElectraTokenizer.from_pretrained("krevas/finance-koelectra-small-discriminator") +sentence = "내일 해당 종목이 대폭 상승할 것이다" +fake_sentence = "내일 해당 종목이 맛있게 상승할 것이다" +fake_tokens = tokenizer.tokenize(fake_sentence) +fake_inputs = tokenizer.encode(fake_sentence, return_tensors="pt") +discriminator_outputs = discriminator(fake_inputs) +predictions = torch.round((torch.sign(discriminator_outputs[0]) + 1) / 2) +[print("%7s" % token, end="") for token in fake_tokens] +[print("%7s" % int(prediction), end="") for prediction in predictions.tolist()[1:-1]] +print("fake token : %s" % fake_tokens[predictions.tolist()[1:-1].index(1)]) +``` + +# Huggingface model hub + +All models are available on the [Huggingface model hub](https://huggingface.co/krevas). diff --git a/model_cards/krevas/finance-koelectra-small-generator/README.md b/model_cards/krevas/finance-koelectra-small-generator/README.md new file mode 100644 index 0000000000..b32e743b52 --- /dev/null +++ b/model_cards/krevas/finance-koelectra-small-generator/README.md @@ -0,0 +1,41 @@ +--- +language: korean +--- + +# 📈 Financial Korean ELECTRA model + +Pretrained ELECTRA Language Model for Korean (`finance-koelectra-small-generator`) + +> ELECTRA is a new method for self-supervised language representation learning. It can be used to +> pre-train transformer networks using relatively little compute. ELECTRA models are trained to +> distinguish "real" input tokens vs "fake" input tokens generated by another neural network, similar to +> the discriminator of a GAN. + +More details about ELECTRA can be found in the [ICLR paper](https://openreview.net/forum?id=r1xMH1BtvB) +or in the [official ELECTRA repository](https://github.com/google-research/electra) on GitHub. + +## Stats + +The current version of the model is trained on a financial news data of Naver news. + +The final training corpus has a size of 25GB and 2.3B tokens. + +This model was trained a cased model on a TITAN RTX for 500k steps. + +## Usage + +```python +from transformers import pipeline + +fill_mask = pipeline( + "fill-mask", + model="krevas/finance-koelectra-small-generator", + tokenizer="krevas/finance-koelectra-small-generator" + ) + +print(fill_mask(f"내일 해당 종목이 대폭 {fill_mask.tokenizer.mask_token}할 것이다.")) +``` + +# Huggingface model hub + +All models are available on the [Huggingface model hub](https://huggingface.co/krevas).