yusukeurakami commited on
Commit
fcc44d5
·
verified ·
1 Parent(s): 57bf407

Update README.md

Browse files
Files changed (1) hide show
  1. README.md +5 -4
README.md CHANGED
@@ -35,7 +35,7 @@ pip install unsloth
35
  pip uninstall unsloth -y && pip install --upgrade --no-cache-dir "unsloth[colab-new] @ git+https://github.com/unslothai/unsloth.git"
36
  ```
37
 
38
- 2. 以下のようなPythonファイルをelyza_tasks_100_tv_exllamav2.pyとして作成します。また、elyza-tasks-100-TV_0.jsonlを同じディレクトリに配置します。
39
  ```
40
  from unsloth import FastLanguageModel
41
  import torch
@@ -70,7 +70,7 @@ with open("./elyza-tasks-100-TV_0.jsonl", "r") as f:
70
 
71
  # 推論
72
  results = []
73
- for dt in tqdm(data):
74
  input = dt["input"]
75
 
76
  prompt = f"""### 指示\n{input}\n### 回答\n"""
@@ -80,8 +80,9 @@ for dt in tqdm(data):
80
  outputs = model.generate(**inputs, max_new_tokens = 512, use_cache = True, do_sample=False, repetition_penalty=1.2)
81
  prediction = tokenizer.decode(outputs[0], skip_special_tokens=True).split('\n### 回答')[-1]
82
 
83
- results.append({"task_id": data["task_id"], "input": input, "output": output})
84
 
 
85
  with open(f"./output.jsonl", 'w', encoding='utf-8') as f:
86
  for result in results:
87
  json.dump(result, f, ensure_ascii=False)
@@ -92,5 +93,5 @@ with open(f"./output.jsonl", 'w', encoding='utf-8') as f:
92
  3. 以下のように推論を実行します。推論が完了するとデフォルトでは実行ファイルと同じディレクトリのoutput.jsonlに回答が保存されます。
93
 
94
  ```bash
95
- python elyza_tasks_100_tv_exllamav2.py
96
  ```
 
35
  pip uninstall unsloth -y && pip install --upgrade --no-cache-dir "unsloth[colab-new] @ git+https://github.com/unslothai/unsloth.git"
36
  ```
37
 
38
+ 2. 以下のようなPythonファイルをelyza_tasks_100_tv.pyとして作成します。また、elyza-tasks-100-TV_0.jsonlを同じディレクトリに配置します。
39
  ```
40
  from unsloth import FastLanguageModel
41
  import torch
 
70
 
71
  # 推論
72
  results = []
73
+ for dt in tqdm(datasets):
74
  input = dt["input"]
75
 
76
  prompt = f"""### 指示\n{input}\n### 回答\n"""
 
80
  outputs = model.generate(**inputs, max_new_tokens = 512, use_cache = True, do_sample=False, repetition_penalty=1.2)
81
  prediction = tokenizer.decode(outputs[0], skip_special_tokens=True).split('\n### 回答')[-1]
82
 
83
+ results.append({"task_id": dt["task_id"], "input": input, "output": prediction})
84
 
85
+ # outputを保存
86
  with open(f"./output.jsonl", 'w', encoding='utf-8') as f:
87
  for result in results:
88
  json.dump(result, f, ensure_ascii=False)
 
93
  3. 以下のように推論を実行します。推論が完了するとデフォルトでは実行ファイルと同じディレクトリのoutput.jsonlに回答が保存されます。
94
 
95
  ```bash
96
+ python elyza_tasks_100_tv.py
97
  ```