metadata
library_name: peft
base_model: tiiuae/falcon-7b
Direct Use
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",
)
sequences = pipeline(
"Question: Are group 2 innate lymphoid cells ( ILC2s ) increased in chronic rhinosinusitis with nasal polyps or eosinophilia?\nAnsw> max_length=1000,
do_sample=True,
top_k=10,
num_return_sequences=1,
eos_token_id=tokenizer.eos_token_id,
)
for seq in sequences:
generated_text = "Question: " + " ".join(seq['generated_text'].split("Question:")[:2])
print(f"Result: {generated_text}")