nkmry commited on
Commit
58ba941
·
verified ·
1 Parent(s): f500385

Upload folder using huggingface_hub

Browse files
Files changed (1) hide show
  1. README.md +15 -2
README.md CHANGED
@@ -53,13 +53,21 @@ model = PeftModel.from_pretrained(
53
 
54
  # Generate outputs
55
 
 
 
 
 
 
 
 
 
 
 
56
  PROMPT = """### 指示
57
  {input}
58
  ### 回答
59
  """
60
 
61
- datasets = ...
62
-
63
  results = []
64
  FastLanguageModel.for_inference(model)
65
  for data in tqdm(datasets):
@@ -78,6 +86,11 @@ for data in tqdm(datasets):
78
  )[0]
79
  output = tokenizer.decode(outputs[tokenized_input.size(1):], skip_special_tokens=True)
80
  results.append({"task_id": data["task_id"], "input": input, "output": output})
 
 
 
 
 
81
  ```
82
 
83
 
 
53
 
54
  # Generate outputs
55
 
56
+ datasets = []
57
+ with open("./elyza-tasks-100-TV_0.jsonl", "r") as f:
58
+ item = ""
59
+ for line in f:
60
+ line = line.strip()
61
+ item += line
62
+ if item.endswith("}"):
63
+ datasets.append(json.loads(item))
64
+ item = ""
65
+
66
  PROMPT = """### 指示
67
  {input}
68
  ### 回答
69
  """
70
 
 
 
71
  results = []
72
  FastLanguageModel.for_inference(model)
73
  for data in tqdm(datasets):
 
86
  )[0]
87
  output = tokenizer.decode(outputs[tokenized_input.size(1):], skip_special_tokens=True)
88
  results.append({"task_id": data["task_id"], "input": input, "output": output})
89
+
90
+ with open(f"./outputs.jsonl", 'w', encoding='utf-8') as f:
91
+ for result in results:
92
+ json.dump(result, f, ensure_ascii=False)
93
+ f.write('\n')
94
  ```
95
 
96