macedonizer
commited on
Commit
•
a48dbbe
1
Parent(s):
c2f7ea2
Update README.md
Browse files
README.md
CHANGED
@@ -1,14 +1,13 @@
|
|
1 |
---
|
2 |
language:
|
3 |
-
-
|
4 |
thumbnail: https://huggingface.co/macedonizer/mk-roberta-base/blaze-koneski.jpg
|
5 |
license: apache-2.0
|
6 |
datasets:
|
7 |
-
- wiki-
|
8 |
-
- time-mk-news-2010-2015
|
9 |
---
|
10 |
|
11 |
-
#
|
12 |
Test the whole generation capabilities here: https://transformer.huggingface.co/doc/gpt2-large
|
13 |
Pretrained model on English language using a causal language modeling (CLM) objective. It was introduced in
|
14 |
[this paper](https://d4mucfpksywv.cloudfront.net/better-language-models/language_models_are_unsupervised_multitask_learners.pdf)
|
@@ -32,14 +31,14 @@ Here is how to use this model to get the features of a given text in PyTorch:
|
|
32 |
import random
|
33 |
from transformers import AutoTokenizer, AutoModelWithLMHead
|
34 |
|
35 |
-
tokenizer = AutoTokenizer.from_pretrained('macedonizer/
|
36 |
-
|
37 |
|
38 |
-
input_text = '
|
39 |
|
40 |
if len(input_text) == 0: \
|
41 |
encoded_input = tokenizer(input_text, return_tensors="pt") \
|
42 |
-
|
43 |
bos_token_id=random.randint(1, 50000), \
|
44 |
do_sample=True, \
|
45 |
top_k=50, \
|
@@ -50,17 +49,16 @@ if len(input_text) == 0: \
|
|
50 |
else: \
|
51 |
encoded_input = tokenizer(input_text, return_tensors="pt") \
|
52 |
output = model.generate( \
|
53 |
-
|
54 |
-
|
55 |
-
|
56 |
-
|
57 |
-
|
58 |
-
|
59 |
-
|
60 |
-
|
61 |
|
62 |
-
decoded_output = [] \
|
63 |
-
|
64 |
-
decoded_output.append(tokenizer.decode(sample, skip_special_tokens=True))
|
65 |
|
66 |
print(decoded_output)
|
|
|
1 |
---
|
2 |
language:
|
3 |
+
- gr
|
4 |
thumbnail: https://huggingface.co/macedonizer/mk-roberta-base/blaze-koneski.jpg
|
5 |
license: apache-2.0
|
6 |
datasets:
|
7 |
+
- wiki-gr
|
|
|
8 |
---
|
9 |
|
10 |
+
# gr-gpt2
|
11 |
Test the whole generation capabilities here: https://transformer.huggingface.co/doc/gpt2-large
|
12 |
Pretrained model on English language using a causal language modeling (CLM) objective. It was introduced in
|
13 |
[this paper](https://d4mucfpksywv.cloudfront.net/better-language-models/language_models_are_unsupervised_multitask_learners.pdf)
|
|
|
31 |
import random
|
32 |
from transformers import AutoTokenizer, AutoModelWithLMHead
|
33 |
|
34 |
+
tokenizer = AutoTokenizer.from_pretrained('macedonizer/gr-gpt2') \
|
35 |
+
nmodel = AutoModelWithLMHead.from_pretrained('macedonizer/gr-gpt2')
|
36 |
|
37 |
+
input_text = 'Η Αθήνα είναι'
|
38 |
|
39 |
if len(input_text) == 0: \
|
40 |
encoded_input = tokenizer(input_text, return_tensors="pt") \
|
41 |
+
output = model.generate( \
|
42 |
bos_token_id=random.randint(1, 50000), \
|
43 |
do_sample=True, \
|
44 |
top_k=50, \
|
|
|
49 |
else: \
|
50 |
encoded_input = tokenizer(input_text, return_tensors="pt") \
|
51 |
output = model.generate( \
|
52 |
+
**encoded_input, \
|
53 |
+
bos_token_id=random.randint(1, 50000), \
|
54 |
+
do_sample=True, \
|
55 |
+
top_k=50, \
|
56 |
+
max_length=1024, \
|
57 |
+
top_p=0.95, \
|
58 |
+
num_return_sequences=1, \
|
59 |
+
)
|
60 |
|
61 |
+
decoded_output = [] \\nfor sample in output: \
|
62 |
+
decoded_output.append(tokenizer.decode(sample, skip_special_tokens=True))
|
|
|
63 |
|
64 |
print(decoded_output)
|