Daniel Hesslow commited on
Commit
ebc2a3c
1 Parent(s): 56dde4b

Create README.md

Browse files
Files changed (1) hide show
  1. README.md +33 -0
README.md ADDED
@@ -0,0 +1,33 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+
2
+ # Example usage
3
+
4
+ ```python
5
+ from transformers import AutoTokenizer, AutoModelForCausalLM
6
+ import transformers
7
+ import torch
8
+
9
+ model = "tiiuae/falcon-40B"
10
+
11
+ tokenizer = AutoTokenizer.from_pretrained(model)
12
+ pipeline = transformers.pipeline(
13
+ "text-generation",
14
+ model=model,
15
+ tokenizer=tokenizer,
16
+ torch_dtype=torch.bfloat16,
17
+ trust_remote_code=True,
18
+ device_map="auto",
19
+ )
20
+ sequences = pipeline(
21
+ "My favourite data joke is",
22
+ max_length=200,
23
+ do_sample=True,
24
+ top_k=10,
25
+ num_return_sequences=1,
26
+ eos_token_id=tokenizer.eos_token_id,
27
+ )
28
+ print("=" * 30)
29
+ print("Results:")
30
+ for seq in sequences:
31
+ print(f"Result: {seq['generated_text']}")
32
+
33
+ ```