pytorch jax gpt2 lm-head causal-lm transformers salesken text-generation
.gitattributes README.md config.json flax_model.msgpack merges.txt pytorch_model.bin tokenizer.json vocab.json
---
tags: salesken
widget:
 - text: "Which name is also used to describe the Amazon rainforest in English? "
---

```python
from transformers import AutoTokenizer, AutoModelWithLMHead
import torch
if torch.cuda.is_available():
    device = torch.device("cuda")
else :
    device = "cpu"
    
tokenizer = AutoTokenizer.from_pretrained("salesken/text_generate")
model = AutoModelWithLMHead.from_pretrained("salesken/text_generate").to(device)

input_query="tough challenges make you stronger.  "
input_ids = tokenizer.encode(input_query.lower(), return_tensors='pt').to(device)

sample_outputs = model.generate(input_ids,
                                do_sample=True,
                                num_beams=1, 
                                max_length=1024,
                                temperature=0.99,
                                top_k = 10,
                                num_return_sequences=1)

for i in range(len(sample_outputs)):
    print(tokenizer.decode(sample_outputs[i], skip_special_tokens=True))
```