File size: 964 Bytes
a77a662 589dcc4 deac434 589dcc4 deac434 589dcc4 5360d39 589dcc4 deac434 589dcc4 |
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 |
---
library_name: peft
base_model: tiiuae/falcon-7b
---
### Direct Use
```python
from transformers import AutoTokenizer, AutoModelForCausalLM
import transformers
import torch
model = "Dhruvil47/falcon-7b-bioarxiv-qa"
tokenizer = AutoTokenizer.from_pretrained(model)
pipeline = transformers.pipeline(
"text-generation",
model=model,
tokenizer=tokenizer,
torch_dtype=torch.bfloat16,
trust_remote_code=True,
device_map="auto",
)
input_prompt = "Question: Are group 2 innate lymphoid cells ( ILC2s ) increased in chronic rhinosinusitis with nasal polyps or eosinophilia?\nAnswer:"
sequences = pipeline(
input_prompt,
max_length=300,
do_sample=True,
top_k=10,
num_return_sequences=1,
eos_token_id=tokenizer.eos_token_id,
)
for seq in sequences:
generated_text = seq['generated_text'].split("\nQuestion:")[0]
generated_text = generated_text.replace(input_prompt, "").strip()
print(generated_text)
```
|