Terry0320 commited on
Commit
cfff294
·
1 Parent(s): d356770

Update README.md

Browse files
Files changed (1) hide show
  1. README.md +28 -1
README.md CHANGED
@@ -8,4 +8,31 @@ library_name: transformers
8
  tags:
9
  - pytorch
10
  ---
11
- working in process
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
8
  tags:
9
  - pytorch
10
  ---
11
+ ***working in progress***
12
+
13
+ from transformers import AutoTokenizer, AutoModelForCausalLM
14
+ import transformers
15
+ import torch
16
+
17
+ model = "Terry0320/Kestrel"
18
+
19
+ tokenizer = AutoTokenizer.from_pretrained(model)
20
+ model = AutoModelForCausalLM.from_pretrained(model, trust_remote_code=True)
21
+ pipeline = transformers.pipeline(
22
+ "text-generation",
23
+ model=model,
24
+ tokenizer=tokenizer,
25
+ torch_dtype=torch.bfloat16,
26
+ trust_remote_code=True,
27
+ device_map="auto",
28
+ )
29
+ sequences = pipeline(
30
+ "Girafatron is obsessed with giraffes, the most glorious animal on the face of this Earth. Giraftron believes all other animals are irrelevant when compared to the glorious majesty of the giraffe.\nDaniel: Hello, Girafatron!\nGirafatron:",
31
+ max_length=200,
32
+ do_sample=True,
33
+ top_k=10,
34
+ num_return_sequences=1,
35
+ eos_token_id=tokenizer.eos_token_id,
36
+ )
37
+ for seq in sequences:
38
+ print(f"Result: {seq['generated_text']}")