|
--- |
|
license: apache-2.0 |
|
datasets: |
|
- Open-Orca/SlimOrca |
|
language: |
|
- en |
|
pipeline_tag: text-generation |
|
inference: false |
|
tags: |
|
- text-generation-inference |
|
--- |
|
|
|
```python |
|
from transformers import AutoTokenizer, AutoModelForCausalLM |
|
import transformers |
|
import torch |
|
|
|
model = 'ericzzz/falcon-rw-1b-instruct-openorca' |
|
|
|
tokenizer = AutoTokenizer.from_pretrained(model) |
|
pipeline = transformers.pipeline( |
|
"text-generation", |
|
model=model, |
|
tokenizer=tokenizer, |
|
torch_dtype=torch.bfloat16, |
|
device_map="auto", |
|
) |
|
|
|
system_message = "You are a helpful assistant. Give short answers." |
|
instruction = "What is AI? Give some examples." |
|
prompt = f"<SYS> {system_message} <INST> {instruction} <RESP> " |
|
|
|
response = pipeline( |
|
prompt, |
|
max_length=200, |
|
repetition_penalty=1.05 |
|
) |
|
|
|
print(response[0]['generated_text']) |
|
# AI, or Artificial Intelligence, refers to the ability of machines and software to perform tasks that require human intelligence, such as learning, reasoning, and problem-solving. It can be used in various fields like computer science, engineering, medicine, and more. Some common applications include image recognition, speech translation, and natural language processing. |
|
``` |