Daniel Hesslow commited on
Commit
e251c35
1 Parent(s): 06337a9

Create README.md

Browse files
Files changed (1) hide show
  1. README.md +35 -0
README.md ADDED
@@ -0,0 +1,35 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # How to use me?
2
+
3
+ ```python
4
+ from transformers import AutoTokenizer, AutoModelForCausalLM
5
+ import transformers
6
+ import torch
7
+
8
+ tokenizer = AutoTokenizer.from_pretrained("tiiuae/falcon_tokenizer")
9
+
10
+
11
+ model = AutoModelForCausalLM.from_pretrained(
12
+ "tiiuae/falcon-micro-self-instruct",
13
+ trust_remote_code=True,
14
+ torch_dtype=torch.bfloat16,
15
+ use_auth_token="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",
16
+ )
17
+
18
+ model.bfloat16()
19
+ model.cuda()
20
+
21
+ pipeline = transformers.pipeline("text-generation", model=model, tokenizer=tokenizer, device="cuda:0")
22
+ sequences = pipeline(
23
+ "What is your favourite dad joke?",
24
+ max_length=200,
25
+ do_sample=True,
26
+ top_k=10,
27
+ repetition_penalty=1.2,
28
+ num_return_sequences=2,
29
+ eos_token_id=tokenizer.eos_token_id,
30
+ )
31
+
32
+ for seq in sequences:
33
+ print(f"Result: {seq['generated_text']}")
34
+
35
+ ```