julien-c HF staff commited on
Commit
df81b5e
โ€ข
1 Parent(s): 1888a06

Migrate model card from transformers-repo

Browse files

Read announcement at https://discuss.huggingface.co/t/announcement-all-model-cards-will-be-migrated-to-hf-co-model-repos/2755
Original file history: https://github.com/huggingface/transformers/commits/master/model_cards/krevas/finance-koelectra-small-discriminator/README.md

Files changed (1) hide show
  1. README.md +45 -0
README.md ADDED
@@ -0,0 +1,45 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ ---
2
+ language: ko
3
+ ---
4
+
5
+ # ๐Ÿ“ˆ Financial Korean ELECTRA model
6
+
7
+ Pretrained ELECTRA Language Model for Korean (`finance-koelectra-small-discriminator`)
8
+
9
+ > ELECTRA is a new method for self-supervised language representation learning. It can be used to
10
+ > pre-train transformer networks using relatively little compute. ELECTRA models are trained to
11
+ > distinguish "real" input tokens vs "fake" input tokens generated by another neural network, similar to
12
+ > the discriminator of a GAN.
13
+
14
+ More details about ELECTRA can be found in the [ICLR paper](https://openreview.net/forum?id=r1xMH1BtvB)
15
+ or in the [official ELECTRA repository](https://github.com/google-research/electra) on GitHub.
16
+
17
+ ## Stats
18
+
19
+ The current version of the model is trained on a financial news data of Naver news.
20
+
21
+ The final training corpus has a size of 25GB and 2.3B tokens.
22
+
23
+ This model was trained a cased model on a TITAN RTX for 500k steps.
24
+
25
+ ## Usage
26
+
27
+ ```python
28
+ from transformers import ElectraForPreTraining, ElectraTokenizer
29
+ import torch
30
+ discriminator = ElectraForPreTraining.from_pretrained("krevas/finance-koelectra-small-discriminator")
31
+ tokenizer = ElectraTokenizer.from_pretrained("krevas/finance-koelectra-small-discriminator")
32
+ sentence = "๋‚ด์ผ ํ•ด๋‹น ์ข…๋ชฉ์ด ๋Œ€ํญ ์ƒ์Šนํ•  ๊ฒƒ์ด๋‹ค"
33
+ fake_sentence = "๋‚ด์ผ ํ•ด๋‹น ์ข…๋ชฉ์ด ๋ง›์žˆ๊ฒŒ ์ƒ์Šนํ•  ๊ฒƒ์ด๋‹ค"
34
+ fake_tokens = tokenizer.tokenize(fake_sentence)
35
+ fake_inputs = tokenizer.encode(fake_sentence, return_tensors="pt")
36
+ discriminator_outputs = discriminator(fake_inputs)
37
+ predictions = torch.round((torch.sign(discriminator_outputs[0]) + 1) / 2)
38
+ [print("%7s" % token, end="") for token in fake_tokens]
39
+ [print("%7s" % int(prediction), end="") for prediction in predictions.tolist()[1:-1]]
40
+ print("fake token : %s" % fake_tokens[predictions.tolist()[1:-1].index(1)])
41
+ ```
42
+
43
+ # Huggingface model hub
44
+
45
+ All models are available on the [Huggingface model hub](https://huggingface.co/krevas).