Update README.md
Browse files
README.md
CHANGED
@@ -39,7 +39,34 @@ base_model: tiiuae/falcon-7b
|
|
39 |
|
40 |
### Direct Use
|
41 |
|
42 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
43 |
|
44 |
[More Information Needed]
|
45 |
|
|
|
39 |
|
40 |
### Direct Use
|
41 |
|
42 |
+
```python
|
43 |
+
from transformers import AutoTokenizer, AutoModelForCausalLM
|
44 |
+
import transformers
|
45 |
+
import torch
|
46 |
+
|
47 |
+
model = "Dhruvil47/falcon-7b-bioarxiv"
|
48 |
+
|
49 |
+
tokenizer = AutoTokenizer.from_pretrained(model)
|
50 |
+
pipeline = transformers.pipeline(
|
51 |
+
"text-generation",
|
52 |
+
model=model,
|
53 |
+
tokenizer=tokenizer,
|
54 |
+
torch_dtype=torch.bfloat16,
|
55 |
+
trust_remote_code=True,
|
56 |
+
device_map="auto",
|
57 |
+
)
|
58 |
+
sequences = pipeline(
|
59 |
+
"NKX2-1 works through",
|
60 |
+
max_length=200,
|
61 |
+
do_sample=True,
|
62 |
+
top_k=10,
|
63 |
+
num_return_sequences=1,
|
64 |
+
eos_token_id=tokenizer.eos_token_id,
|
65 |
+
)
|
66 |
+
for seq in sequences:
|
67 |
+
print(f"Result: {seq['generated_text']}")
|
68 |
+
|
69 |
+
```
|
70 |
|
71 |
[More Information Needed]
|
72 |
|