Galuh
commited on
Commit
·
f50e22b
1
Parent(s):
79140ed
Update README.md
Browse files
README.md
CHANGED
@@ -16,7 +16,7 @@ The demo can be found [here](https://huggingface.co/spaces/flax-community/gpt2-i
|
|
16 |
You can use this model directly with a pipeline for text generation. Since the generation relies on some randomness, we set a seed for reproducibility:
|
17 |
```python
|
18 |
>>> from transformers import pipeline, set_seed
|
19 |
-
>>> generator = pipeline('text-generation', model='flax-community/gpt2-
|
20 |
>>> set_seed(42)
|
21 |
>>> generator("Sewindu sudah kita tak berjumpa,", max_length=30, num_return_sequences=5)
|
22 |
|
@@ -32,8 +32,8 @@ Tuhan akan memberi lebih dari apa yang kita'}]
|
|
32 |
Here is how to use this model to get the features of a given text in PyTorch:
|
33 |
```python
|
34 |
from transformers import GPT2Tokenizer, GPT2Model
|
35 |
-
tokenizer = GPT2Tokenizer.from_pretrained('flax-community/gpt2-
|
36 |
-
model = GPT2Model.from_pretrained('flax-community/gpt2-
|
37 |
text = "Ubah dengan teks apa saja."
|
38 |
encoded_input = tokenizer(text, return_tensors='pt')
|
39 |
output = model(**encoded_input)
|
@@ -42,8 +42,8 @@ output = model(**encoded_input)
|
|
42 |
and in TensorFlow:
|
43 |
```python
|
44 |
from transformers import GPT2Tokenizer, TFGPT2Model
|
45 |
-
tokenizer = GPT2Tokenizer.from_pretrained('flax-community/gpt2-
|
46 |
-
model = TFGPT2Model.from_pretrained('flax-community/gpt2-
|
47 |
text = "Ubah dengan teks apa saja."
|
48 |
encoded_input = tokenizer(text, return_tensors='tf')
|
49 |
output = model(encoded_input)
|
|
|
16 |
You can use this model directly with a pipeline for text generation. Since the generation relies on some randomness, we set a seed for reproducibility:
|
17 |
```python
|
18 |
>>> from transformers import pipeline, set_seed
|
19 |
+
>>> generator = pipeline('text-generation', model='flax-community/gpt2-medium-indonesian')
|
20 |
>>> set_seed(42)
|
21 |
>>> generator("Sewindu sudah kita tak berjumpa,", max_length=30, num_return_sequences=5)
|
22 |
|
|
|
32 |
Here is how to use this model to get the features of a given text in PyTorch:
|
33 |
```python
|
34 |
from transformers import GPT2Tokenizer, GPT2Model
|
35 |
+
tokenizer = GPT2Tokenizer.from_pretrained('flax-community/gpt2-medium-indonesian')
|
36 |
+
model = GPT2Model.from_pretrained('flax-community/gpt2-medium-indonesian')
|
37 |
text = "Ubah dengan teks apa saja."
|
38 |
encoded_input = tokenizer(text, return_tensors='pt')
|
39 |
output = model(**encoded_input)
|
|
|
42 |
and in TensorFlow:
|
43 |
```python
|
44 |
from transformers import GPT2Tokenizer, TFGPT2Model
|
45 |
+
tokenizer = GPT2Tokenizer.from_pretrained('flax-community/gpt2-medium-indonesian')
|
46 |
+
model = TFGPT2Model.from_pretrained('flax-community/gpt2-medium-indonesian')
|
47 |
text = "Ubah dengan teks apa saja."
|
48 |
encoded_input = tokenizer(text, return_tensors='tf')
|
49 |
output = model(encoded_input)
|