Dhruvil47 commited on
Commit
7579793
1 Parent(s): 570718c

Update README.md

Browse files
Files changed (1) hide show
  1. README.md +28 -1
README.md CHANGED
@@ -39,7 +39,34 @@ base_model: tiiuae/falcon-7b
39
 
40
  ### Direct Use
41
 
42
- <!-- This section is for the model use without fine-tuning or plugging into a larger ecosystem/app. -->
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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