File size: 1,057 Bytes
c3db405 d356770 3b1611a 01d267d bce61c7 9a02357 f24048d 9cc558c cfff294 9cc558c cfff294 7f2058c cfff294 76ec38a |
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 |
---
license: cc-by-nc-4.0
pipeline_tag: text-generation
language:
- en
library_name: transformers
tags:
- pytorch
---
**working in progress**
```python
from transformers import AutoTokenizer, AutoModelForCausalLM
import transformers
import torch
model = "Terry0320/Kestrel"
tokenizer = AutoTokenizer.from_pretrained(model)
model = AutoModelForCausalLM.from_pretrained(model, trust_remote_code=True)
pipeline = transformers.pipeline(
"text-generation",
model=model,
tokenizer=tokenizer,
torch_dtype=torch.bfloat16,
trust_remote_code=True,
device_map="auto",
)
sequences = pipeline(
"Generelativa is obsessed with general relativity and believes that it is the greatest theory in the world. He thinks that any other theory, including special relativity, is simply not worth mentioning.\nHoward: Hello, Generelativa!\nGenerelativa:",
max_length=200,
do_sample=True,
top_k=10,
num_return_sequences=1,
eos_token_id=tokenizer.eos_token_id,
)
for seq in sequences:
print(f"Result: {seq['generated_text']}")
``` |