eryk-mazus commited on
Commit
c4c61cf
1 Parent(s): 468ec96

Update README.md

Browse files
Files changed (1) hide show
  1. README.md +16 -1
README.md CHANGED
@@ -26,5 +26,20 @@ The training took 425 GPU hours on a single 8 x RTX 4090 machine with DeepSpeed
26
  ## Sample code
27
 
28
  ```python
29
- ...
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
30
  ```
 
26
  ## Sample code
27
 
28
  ```python
29
+ from transformers import AutoModelForCausalLM, AutoTokenizer
30
+
31
+ model_name = "eryk-mazus/polka-1.1b"
32
+
33
+ tokenizer = AutoTokenizer.from_pretrained(model_name, padding_side="left")
34
+ tokenizer.pad_token = tokenizer.eos_token
35
+
36
+ model = AutoModelForCausalLM.from_pretrained(model_name, device_map="auto", load_in_8bit=True)
37
+
38
+ prompt = """..."""
39
+
40
+ model_inputs = tokenizer([prompt], return_tensors="pt").to("cuda")
41
+ generated_ids = model.generate(**model_inputs, max_new_tokens=512, do_sample=True, penalty_alpha=0.6, top_k=5)
42
+
43
+ output = tokenizer.batch_decode(generated_ids, skip_special_tokens=True)[0]
44
+ print(output)
45
  ```