GPT2-Malayalam / README.md
ashiqabdulkhader's picture
Update README.md
253a4b5
|
raw
history blame
2.29 kB
---
license: bigscience-bloom-rail-1.0
widget :
- text: "ആധുനിക ഭാരതം കണ്ട "
example_title: "ആധുനിക ഭാരതം"
- text : "മലയാളഭാഷ എഴുതുന്നതിനായി"
example_title: "മലയാളഭാഷ എഴുതുന്നതിനായി"
- text : "ഇന്ത്യയിൽ കേരള സംസ്ഥാനത്തിലും"
example_title : "ഇന്ത്യയിൽ കേരള"
---
# GPT2-Malayalam
## Model description
GPT2-Malayalam is a GPT-2 transformer model fine Tuned on a large corpus of Malayalam data in a self-supervised fashion. This means it was pretrained on the raw texts only, with no humans labelling them in any way with an automatic process to generate inputs and labels from those texts. More precisely, it was trained to guess the next word in sentences.
More precisely, inputs are sequences of continuous text of a certain length and the targets are the same sequence, shifted one token (word or piece of word) to the right. The model uses internally a mask-mechanism to make sure the predictions for the token i only uses the inputs from 1 to i but not the future tokens.
This way, the model learns an inner representation of the Malayalam language that can then be used to extract features useful for downstream tasks.
## Intended uses & limitations
You can use the raw model for text generation or fine-tune it to a downstream task. See the
[model hub](https://huggingface.co/models?filter=gpt2) to look for fine-tuned versions on a task that interests you.
## Usage
You can use this model for Malayalam text generation:
```python
>>> from transformers import TFGPT2LMHeadModel, GPT2Tokenizer
>>> tokenizer = GPT2Tokenizer.from_pretrained("ashiqabdulkhader/GPT2-Malayalam")
>>> model = TFGPT2LMHeadModel.from_pretrained("ashiqabdulkhader/GPT2-Malayalam")
>>> text = "മലയാളത്തിലെ പ്രധാന ഭാഷയാണ്"
>>> encoded_text = tokenizer.encode(text, return_tensors='tf')
>>> beam_output = model.generate(
encoded_text,
max_length=100,
num_beams=5,
temperature=0.7,
no_repeat_ngram_size=2,
num_return_sequences=5
)
>>> print(tokenizer.decode(beam_output[0], skip_special_tokens=True))
```