File size: 2,835 Bytes
c075a14
915b89b
c075a14
 
 
915b89b
 
 
 
 
c075a14
 
 
 
915b89b
c075a14
 
 
915b89b
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
c075a14
 
 
 
 
 
915b89b
c075a14
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
8191ff5
 
 
 
c075a14
 
 
 
 
 
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
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
---
language: ne
license: mit
tags:
- generated_from_trainer
- gpt2
- ne
datasets: Oscar
widget:
-  text: "गर्मि मौसममा चिसो खाने"
---

# gpt2-medium-ne

This model is a fine-tuned version of [gpt2](https://huggingface.co/gpt2) on Oscar Dataset.

## Model description

This model is trained on Oscar Nepali Dataset.

## How to use

You can use this model directly with a pipeline for text generation.

```python
>>> from transformers import pipeline, set_seed
>>> generator = pipeline('text-generation', model='Someman/gpt2-medium-ne')
>>> set_seed(42)
>>> generator("उच्च अदालतले बिहीबार दिएको आदेशले", max_length=30, num_return_sequences=5)

[{'generated_text': 'उच्च अदालतले बिहीबार दिएको आदेशले महिनात्रि'},
 {'generated_text': 'उच्च अदालतले बिहीबार दिएको आदेशले बिहानैदे'},
 {'generated_text': 'उच्च अदालतले बिहीबार दिएको आदेशले गिरिजाली'},
 {'generated_text': 'उच्च अदालतले बिहीबार दिएको आदेशले गरेको प्रथम त'},
 {'generated_text': 'उच्च अदालतले बिहीबार दिएको आदेशले कुनै साथी'}]
```


Here is how to use this model to get the features of a given text in PyTorch:

```python
from transformers import GPT2Tokenizer, GPT2Model
tokenizer = GPT2Tokenizer.from_pretrained('Someman/gpt2-medium-ne')
model = GPT2Model.from_pretrained('Someman/gpt2-medium-ne')
text = "Replace me by any text you'd like."
encoded_input = tokenizer(text, return_tensors='pt')
output = model(**encoded_input)
```

and in TensorFlow:

```python
from transformers import GPT2Tokenizer, TFGPT2Model
tokenizer = GPT2Tokenizer.from_pretrained('Someman/gpt2-medium-ne')
model = TFGPT2Model.from_pretrained('Someman/gpt2-medium-ne')
text = "Replace me by any text you'd like."
encoded_input = tokenizer(text, return_tensors='tf')
output = model(encoded_input)
```


More information needed

## Training and evaluation data

Training data contains 197k Nepali sentences.

## Training procedure

### Training hyperparameters

The following hyperparameters were used during training:
- learning_rate: 5e-05
- train_batch_size: 1
- eval_batch_size: 1
- seed: 42
- gradient_accumulation_steps: 32
- total_train_batch_size: 32
- optimizer: Adam with betas=(0.9,0.999) and epsilon=1e-08
- lr_scheduler_type: linear
- lr_scheduler_warmup_steps: 1000
- num_epochs: 1

### Training results



### Framework versions

- Transformers 4.21.1
- Pytorch 1.12.0+cu116
- Datasets 2.4.0
- Tokenizers 0.12.1