IchiShira commited on
Commit
5ed5539
verified
1 Parent(s): 8b41486

Update README.md

Browse files
Files changed (1) hide show
  1. README.md +29 -0
README.md CHANGED
@@ -20,3 +20,32 @@ language:
20
  This llama model was trained 2x faster with [Unsloth](https://github.com/unslothai/unsloth) and Huggingface's TRL library.
21
 
22
  [<img src="https://raw.githubusercontent.com/unslothai/unsloth/main/images/unsloth%20made%20with%20love.png" width="200"/>](https://github.com/unslothai/unsloth)
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
20
  This llama model was trained 2x faster with [Unsloth](https://github.com/unslothai/unsloth) and Huggingface's TRL library.
21
 
22
  [<img src="https://raw.githubusercontent.com/unslothai/unsloth/main/images/unsloth%20made%20with%20love.png" width="200"/>](https://github.com/unslothai/unsloth)
23
+
24
+
25
+ # 鍑哄姏鏂规硶
26
+
27
+ """ python """
28
+
29
+ from tqdm import tqdm
30
+
31
+ # 鎺ㄨ珫
32
+ results = []
33
+ for dt in tqdm(data):
34
+ input = dt["input"]
35
+
36
+ prompt = f"""### 鎸囩ず\n{input}\n### 鍥炵瓟\n"""
37
+
38
+ inputs = tokenizer([prompt], return_tensors = "pt").to(model.device)
39
+
40
+ outputs = model.generate(**inputs, max_new_tokens = 512, use_cache = True, do_sample=False, repetition_penalty=1.2)
41
+ prediction = tokenizer.decode(outputs[0], skip_special_tokens=True).split('\n### 鍥炵瓟')[-1]
42
+
43
+ results.append({"task_id": data["task_id"], "input": input, "output": output})
44
+
45
+ with open(f"/content/{model_name}_output.jsonl", 'w', encoding='utf-8') as f:
46
+ for result in results:
47
+ json.dump(result, f, ensure_ascii=False)
48
+ f.write('\n')
49
+
50
+ """
51
+