Spaces:
Build error
Build error
ready for LF lora training
Browse files- .gitignore +1 -0
- llama-factory/config/mac_template.yaml +42 -0
- llama-factory/data/alpaca_mac.json +3 -0
- llama-factory/data/dataset_info.json +3 -0
- llm_toolkit/setup_lf.py +60 -0
- llm_toolkit/translation_utils.py +46 -11
- notebooks/00b_Data Analysis_Few_Shots.ipynb +2 -2
- results/mac-results_few_shots_metrics.csv +40 -28
- scripts/eval-mac.sh +5 -7
- scripts/tune-lf.sh +15 -0
- scripts/tune-mac.sh +23 -0
.gitignore
CHANGED
@@ -151,3 +151,4 @@ dmypy.json
|
|
151 |
/llama.cpp
|
152 |
/llama-factory/saves
|
153 |
/llama-factory/saves-1
|
|
|
|
151 |
/llama.cpp
|
152 |
/llama-factory/saves
|
153 |
/llama-factory/saves-1
|
154 |
+
/llama-factory/config/models
|
llama-factory/config/mac_template.yaml
ADDED
@@ -0,0 +1,42 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
### model
|
2 |
+
model_name_or_path: ORG_NAME/MODEL_NAME
|
3 |
+
|
4 |
+
### method
|
5 |
+
stage: sft
|
6 |
+
do_train: true
|
7 |
+
finetuning_type: lora
|
8 |
+
lora_target: all
|
9 |
+
|
10 |
+
### dataset
|
11 |
+
dataset: alpaca_mac
|
12 |
+
template: CHAT_TEMPLATE
|
13 |
+
cutoff_len: 1024
|
14 |
+
max_samples: 4528
|
15 |
+
overwrite_cache: true
|
16 |
+
preprocessing_num_workers: 16
|
17 |
+
|
18 |
+
### output
|
19 |
+
output_dir: saves/MODEL_NAME
|
20 |
+
logging_steps: 5
|
21 |
+
save_steps: 35
|
22 |
+
plot_loss: true
|
23 |
+
# overwrite_output_dir: true
|
24 |
+
|
25 |
+
### train
|
26 |
+
per_device_train_batch_size: 16
|
27 |
+
gradient_accumulation_steps: 8
|
28 |
+
learning_rate: 1.0e-4
|
29 |
+
num_train_epochs: 6.0
|
30 |
+
lr_scheduler_type: cosine
|
31 |
+
warmup_ratio: 0.1
|
32 |
+
bf16: true
|
33 |
+
ddp_timeout: 180000000
|
34 |
+
|
35 |
+
### eval
|
36 |
+
val_size: 0.01
|
37 |
+
per_device_eval_batch_size: 1
|
38 |
+
eval_strategy: steps
|
39 |
+
eval_steps: 35
|
40 |
+
|
41 |
+
report_to: wandb
|
42 |
+
run_name: MODEL_NAME_lora_sft
|
llama-factory/data/alpaca_mac.json
ADDED
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
1 |
+
version https://git-lfs.github.com/spec/v1
|
2 |
+
oid sha256:8f1fbf6e56f123addd35f9b89a29227e138e776bb9bdb69c00b1b2014927cf61
|
3 |
+
size 3281784
|
llama-factory/data/dataset_info.json
ADDED
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
1 |
+
version https://git-lfs.github.com/spec/v1
|
2 |
+
oid sha256:0e816fa8e7c69a3075e041f10e322958c2bb4ef705606d471616c509c8290ad9
|
3 |
+
size 13692
|
llm_toolkit/setup_lf.py
ADDED
@@ -0,0 +1,60 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
import os, json, sys, yaml
|
2 |
+
from dotenv import find_dotenv, load_dotenv
|
3 |
+
|
4 |
+
found_dotenv = find_dotenv(".env")
|
5 |
+
|
6 |
+
if len(found_dotenv) == 0:
|
7 |
+
found_dotenv = find_dotenv(".env.example")
|
8 |
+
print(f"loading env vars from: {found_dotenv}")
|
9 |
+
load_dotenv(found_dotenv, override=False)
|
10 |
+
|
11 |
+
path = os.path.dirname(found_dotenv)
|
12 |
+
print(f"Adding {path} to sys.path")
|
13 |
+
sys.path.append(path)
|
14 |
+
|
15 |
+
from llm_toolkit.llm_utils import *
|
16 |
+
from llm_toolkit.translation_utils import *
|
17 |
+
|
18 |
+
org_name = os.getenv("ORG_NAME")
|
19 |
+
model_name = os.getenv("MODEL_NAME")
|
20 |
+
chat_template = os.getenv("CHAT_TEMPLATE")
|
21 |
+
filename = os.getenv("YAML")
|
22 |
+
data_path = os.getenv("DATA_PATH")
|
23 |
+
|
24 |
+
print(org_name, model_name, chat_template, filename, data_path)
|
25 |
+
|
26 |
+
if not filename:
|
27 |
+
print("Error: Environment variable YAML not set")
|
28 |
+
sys.exit(1)
|
29 |
+
|
30 |
+
if not os.path.exists(filename):
|
31 |
+
print(f"Error: File {filename} not found")
|
32 |
+
sys.exit(1)
|
33 |
+
|
34 |
+
file = open(filename)
|
35 |
+
yaml_content = file.read()
|
36 |
+
file.close()
|
37 |
+
|
38 |
+
keys = ["ORG_NAME", "MODEL_NAME", "CHAT_TEMPLATE"]
|
39 |
+
for key in keys:
|
40 |
+
yaml_content = yaml_content.replace(key, os.getenv(key))
|
41 |
+
|
42 |
+
# print(f"YAML content:\n{yaml_content}")
|
43 |
+
parts = filename.split("/")
|
44 |
+
parts[-1] = "models"
|
45 |
+
parts.append(f"{os.getenv('MODEL_NAME')}.yaml")
|
46 |
+
filename = "/".join(parts)
|
47 |
+
print(f"Writing to {filename}")
|
48 |
+
|
49 |
+
# Create the parent directory if it doesn't exist
|
50 |
+
os.makedirs(os.path.dirname(filename), exist_ok=True)
|
51 |
+
|
52 |
+
file = open(filename, "w")
|
53 |
+
file.write(yaml_content)
|
54 |
+
file.close()
|
55 |
+
|
56 |
+
y = yaml.safe_load(open(filename))
|
57 |
+
print(f"{filename}:\n", json.dumps(y, indent=2))
|
58 |
+
|
59 |
+
dataset = load_alpaca_data(data_path)
|
60 |
+
print_row_details(dataset, [0, -1])
|
llm_toolkit/translation_utils.py
CHANGED
@@ -92,6 +92,9 @@ def save_results(model_name, results_path, dataset, predictions, debug=False):
|
|
92 |
df.to_csv(results_path, index=False)
|
93 |
|
94 |
|
|
|
|
|
|
|
95 |
def get_few_shot_prompt(dataset, num_shots=5):
|
96 |
translation_prompt = "You will be given a Chinese sentence to translate. If it is an incomplete sentence, or if you are unsure about the meaning, simply copy the input text as your output. Do not output any additional sentence such as explanation or reasoning.\n\n"
|
97 |
if num_shots > 0:
|
@@ -145,7 +148,7 @@ def load_translation_dataset(data_path, tokenizer=None, num_shots=5):
|
|
145 |
messages = [
|
146 |
{
|
147 |
"role": "system",
|
148 |
-
"content":
|
149 |
},
|
150 |
None,
|
151 |
]
|
@@ -485,33 +488,33 @@ def eval_openai(num_shots, datasets, model="gpt-4o-mini", max_new_tokens=300):
|
|
485 |
return predictions
|
486 |
|
487 |
|
488 |
-
def
|
489 |
# print(f"converting time_str: {time_str}")
|
490 |
# Split the time string into its components
|
491 |
time_parts = list(map(int, time_str.split(":")))
|
492 |
|
493 |
# Initialize total minutes
|
494 |
-
|
495 |
|
496 |
# Calculate total minutes based on the number of parts
|
497 |
if len(time_parts) == 3: # HH:MM:SS
|
498 |
hours, minutes, seconds = time_parts
|
499 |
-
|
500 |
elif len(time_parts) == 2: # MM:SS
|
501 |
minutes, seconds = time_parts
|
502 |
-
|
503 |
elif len(time_parts) == 1: # SS
|
504 |
seconds = time_parts[0]
|
505 |
-
|
506 |
|
507 |
-
return
|
508 |
|
509 |
|
510 |
time_pattern = re.compile(r"\[(.{5,10})<00:00")
|
511 |
metrics_pattern = re.compile(r"(.*)/shots-(.*) metrics:")
|
512 |
|
513 |
|
514 |
-
def process_log_file(log_file):
|
515 |
model = []
|
516 |
shots = []
|
517 |
eval_time = []
|
@@ -533,7 +536,9 @@ def process_log_file(log_file):
|
|
533 |
|
534 |
groups = time_pattern_matches.groups()
|
535 |
time_str = groups[0]
|
536 |
-
eval_time.append(
|
|
|
|
|
537 |
except Exception as e:
|
538 |
print(f"Error processing log file: {log_file}")
|
539 |
print(e)
|
@@ -548,7 +553,7 @@ def process_log_file(log_file):
|
|
548 |
return df
|
549 |
|
550 |
|
551 |
-
def load_eval_times(logs_folder):
|
552 |
# Get a list of all files in the logs folder
|
553 |
log_files = glob.glob(os.path.join(logs_folder, "*"))
|
554 |
log_files.sort()
|
@@ -557,8 +562,38 @@ def load_eval_times(logs_folder):
|
|
557 |
|
558 |
for log_file in log_files:
|
559 |
print(f"Loading content of {log_file}")
|
560 |
-
df = process_log_file(log_file)
|
561 |
time_df = pd.concat([time_df, df], ignore_index=True)
|
562 |
|
563 |
time_df["shots"] = time_df["shots"].apply(lambda x: int(x))
|
564 |
return time_df
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
92 |
df.to_csv(results_path, index=False)
|
93 |
|
94 |
|
95 |
+
system_prompt = "You are a helpful assistant that translates Chinese to English."
|
96 |
+
|
97 |
+
|
98 |
def get_few_shot_prompt(dataset, num_shots=5):
|
99 |
translation_prompt = "You will be given a Chinese sentence to translate. If it is an incomplete sentence, or if you are unsure about the meaning, simply copy the input text as your output. Do not output any additional sentence such as explanation or reasoning.\n\n"
|
100 |
if num_shots > 0:
|
|
|
148 |
messages = [
|
149 |
{
|
150 |
"role": "system",
|
151 |
+
"content": system_prompt,
|
152 |
},
|
153 |
None,
|
154 |
]
|
|
|
488 |
return predictions
|
489 |
|
490 |
|
491 |
+
def convert_time_to_seconds(time_str):
|
492 |
# print(f"converting time_str: {time_str}")
|
493 |
# Split the time string into its components
|
494 |
time_parts = list(map(int, time_str.split(":")))
|
495 |
|
496 |
# Initialize total minutes
|
497 |
+
total_seconds = 0
|
498 |
|
499 |
# Calculate total minutes based on the number of parts
|
500 |
if len(time_parts) == 3: # HH:MM:SS
|
501 |
hours, minutes, seconds = time_parts
|
502 |
+
total_seconds = hours * 3600 + minutes * 60 + seconds
|
503 |
elif len(time_parts) == 2: # MM:SS
|
504 |
minutes, seconds = time_parts
|
505 |
+
total_seconds = minutes * 60 + seconds
|
506 |
elif len(time_parts) == 1: # SS
|
507 |
seconds = time_parts[0]
|
508 |
+
total_seconds = seconds
|
509 |
|
510 |
+
return total_seconds
|
511 |
|
512 |
|
513 |
time_pattern = re.compile(r"\[(.{5,10})<00:00")
|
514 |
metrics_pattern = re.compile(r"(.*)/shots-(.*) metrics:")
|
515 |
|
516 |
|
517 |
+
def process_log_file(log_file, total_entries):
|
518 |
model = []
|
519 |
shots = []
|
520 |
eval_time = []
|
|
|
536 |
|
537 |
groups = time_pattern_matches.groups()
|
538 |
time_str = groups[0]
|
539 |
+
eval_time.append(
|
540 |
+
convert_time_to_seconds(time_str) / total_entries
|
541 |
+
)
|
542 |
except Exception as e:
|
543 |
print(f"Error processing log file: {log_file}")
|
544 |
print(e)
|
|
|
553 |
return df
|
554 |
|
555 |
|
556 |
+
def load_eval_times(logs_folder, total_entries=1133):
|
557 |
# Get a list of all files in the logs folder
|
558 |
log_files = glob.glob(os.path.join(logs_folder, "*"))
|
559 |
log_files.sort()
|
|
|
562 |
|
563 |
for log_file in log_files:
|
564 |
print(f"Loading content of {log_file}")
|
565 |
+
df = process_log_file(log_file, total_entries=total_entries)
|
566 |
time_df = pd.concat([time_df, df], ignore_index=True)
|
567 |
|
568 |
time_df["shots"] = time_df["shots"].apply(lambda x: int(x))
|
569 |
return time_df
|
570 |
+
|
571 |
+
|
572 |
+
def load_alpaca_data(data_path):
|
573 |
+
alpaca_data_path = "data/alpaca_mac.json"
|
574 |
+
|
575 |
+
if os.path.exists(alpaca_data_path):
|
576 |
+
print("loading existing data from:", alpaca_data_path)
|
577 |
+
data = pd.read_json(alpaca_data_path, orient="records", lines=False)
|
578 |
+
return data
|
579 |
+
|
580 |
+
datasets = load_translation_dataset(data_path)
|
581 |
+
prompt_template = get_few_shot_prompt(datasets["train"], num_shots=0)
|
582 |
+
|
583 |
+
df_train = datasets["train"].to_pandas()
|
584 |
+
df_train["instruction"] = df_train.apply(
|
585 |
+
lambda x: prompt_template.format(input=x["chinese"]), axis=1
|
586 |
+
)
|
587 |
+
|
588 |
+
df_alpaca = pd.DataFrame(
|
589 |
+
{
|
590 |
+
"system": [system_prompt] * len(df_train),
|
591 |
+
"instruction": df_train["instruction"].to_list(),
|
592 |
+
"input": [""] * len(df_train),
|
593 |
+
"output": df_train["english"].to_list(),
|
594 |
+
}
|
595 |
+
)
|
596 |
+
|
597 |
+
df_alpaca.to_json(alpaca_data_path, orient="records", lines=False, indent=2)
|
598 |
+
|
599 |
+
return df_alpaca
|
notebooks/00b_Data Analysis_Few_Shots.ipynb
CHANGED
@@ -1,3 +1,3 @@
|
|
1 |
version https://git-lfs.github.com/spec/v1
|
2 |
-
oid sha256:
|
3 |
-
size
|
|
|
1 |
version https://git-lfs.github.com/spec/v1
|
2 |
+
oid sha256:9659822963e465fcc321c5cc538b9e2eabefcc5492ddc1eaaafd510e854b7202
|
3 |
+
size 835024
|
results/mac-results_few_shots_metrics.csv
CHANGED
@@ -1,29 +1,41 @@
|
|
1 |
model,shots,meteor,bleu_1,rouge_l,ews_score,repetition_score,total_repetitions,rap,num_max_output_tokens,eval_time
|
2 |
-
Qwen/Qwen2-72B-Instruct,0,0.4003638205699929,0.12223832517678616,0.
|
3 |
-
Qwen/Qwen2-72B-Instruct,1,0.4068727655718769,0.13151008586303575,0.
|
4 |
-
Qwen/Qwen2-72B-Instruct,3,0.4086244766794449,0.13771788946915253,0.
|
5 |
-
Qwen/Qwen2-72B-Instruct,5,0.4132330811975005,0.1439773872150899,0.
|
6 |
-
Qwen/Qwen2-72B-Instruct,10,0.41598174489789025,0.14493475334416772,0.
|
7 |
-
Qwen/Qwen2-
|
8 |
-
Qwen/Qwen2-7B-Instruct,
|
9 |
-
Qwen/Qwen2-7B-Instruct,
|
10 |
-
Qwen/Qwen2-7B-Instruct,
|
11 |
-
Qwen/Qwen2-7B-Instruct,
|
12 |
-
|
13 |
-
|
14 |
-
internlm/internlm2_5-7b-chat,
|
15 |
-
internlm/internlm2_5-7b-chat,
|
16 |
-
internlm/internlm2_5-7b-chat,
|
17 |
-
internlm/internlm2_5-7b-chat,
|
18 |
-
|
19 |
-
|
20 |
-
|
21 |
-
|
22 |
-
|
23 |
-
|
24 |
-
|
25 |
-
|
26 |
-
|
27 |
-
|
28 |
-
|
29 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
model,shots,meteor,bleu_1,rouge_l,ews_score,repetition_score,total_repetitions,rap,num_max_output_tokens,eval_time
|
2 |
+
Qwen/Qwen2-72B-Instruct,0,0.4003638205699929,0.12223832517678616,0.3847629463750985,0.0,0.19593998234774934,0.19593998234774934,0.3970180421898014,1,8.894969108561341
|
3 |
+
Qwen/Qwen2-72B-Instruct,1,0.4068727655718769,0.13151008586303575,0.3944115167988717,0.0,0.15798764342453664,0.15798764342453664,0.4041216347207881,1,8.983230361871138
|
4 |
+
Qwen/Qwen2-72B-Instruct,3,0.4086244766794449,0.13771788946915253,0.39794626590394355,0.0,0.12709620476610767,0.12709620476610767,0.4063954239173824,0,11.657546337157987
|
5 |
+
Qwen/Qwen2-72B-Instruct,5,0.4132330811975005,0.1439773872150899,0.4036491307620504,0.0,0.11915269196822595,0.11915269196822595,0.41111822769434864,0,17.167696381288614
|
6 |
+
Qwen/Qwen2-72B-Instruct,10,0.41598174489789025,0.14493475334416772,0.4065107334928856,0.0,0.09620476610767872,0.09620476610767872,0.4142591929807702,0,29.728155339805824
|
7 |
+
Qwen/Qwen2-72B-Instruct,50,0.4401536409204816,0.1538634893900684,0.4172243423111057,0.0,0.10150044130626655,0.10150044130626655,0.43823160654983345,0,112.50397175639894
|
8 |
+
Qwen/Qwen2-7B-Instruct,0,0.377477070949433,0.11783492823424507,0.3679428026833277,0.0,0.07149161518093557,0.07149161518093557,0.3763128359886437,0,0.9805825242718447
|
9 |
+
Qwen/Qwen2-7B-Instruct,1,0.38000752971097884,0.11731917392837622,0.3716350861124088,0.0,0.07413945278022947,0.07413945278022947,0.37879237953430883,0,1.0529567519858782
|
10 |
+
Qwen/Qwen2-7B-Instruct,3,0.38678180999660744,0.12368875746156333,0.3775321935602687,0.0,0.1412180052956752,0.1412180052956752,0.38444052153933106,0,1.6010591350397176
|
11 |
+
Qwen/Qwen2-7B-Instruct,5,0.38784856371389564,0.1227725469820483,0.3821016566709109,0.0,0.09179170344218888,0.09179170344218888,0.38631555618548774,0,2.2894969108561343
|
12 |
+
Qwen/Qwen2-7B-Instruct,10,0.38526484346757095,0.12535252418966952,0.3819282327854221,0.0,0.10326566637246248,0.10326566637246248,0.3835535147682633,0,4.006178287731686
|
13 |
+
Qwen/Qwen2-7B-Instruct,50,0.3953455943001352,0.12949951844499932,0.3902417317381649,0.0,0.10061782877316858,0.10061782877316858,0.39363409715118836,0,17.46425419240953
|
14 |
+
internlm/internlm2_5-7b-chat,0,0.36816799960793073,0.11360521358693174,0.3600976114330957,0.0,0.2144748455428067,0.2144748455428067,0.3648059323539847,0,1.2241835834068844
|
15 |
+
internlm/internlm2_5-7b-chat,1,0.3719587471180722,0.1157707566176535,0.3636179646738983,0.0,0.14033539276257723,0.14033539276257723,0.36972107700643503,0,1.3124448367166814
|
16 |
+
internlm/internlm2_5-7b-chat,3,0.3747105229822289,0.1154826016668525,0.3683821652101455,0.0,0.17740511915269197,0.17740511915269197,0.37187052462735126,0,1.8578993821712269
|
17 |
+
internlm/internlm2_5-7b-chat,5,0.37285562384505977,0.11541534709366409,0.3683735908407485,0.0,0.14827890556045895,0.14827890556045895,0.37048732274065205,0,2.860547219770521
|
18 |
+
internlm/internlm2_5-7b-chat,10,0.3750895095392996,0.11696492920010637,0.3679980919671262,0.0,0.13062665489849956,0.13062665489849956,0.37298723763770353,0,5.722859664607237
|
19 |
+
internlm/internlm2_5-7b-chat,50,0.37213069871716603,0.11404688073207249,0.36275069101944124,0.0,0.16857899382171226,0.16857899382171226,0.3694484047441432,8,42.29214474845543
|
20 |
+
shenzhi-wang/Llama3.1-70B-Chinese-Chat,0,0.3638704024273502,0.10874677881601094,0.3532404744913337,0.0,0.15445719329214475,0.15445719329214475,0.3614642386796342,0,7.8331862312444835
|
21 |
+
shenzhi-wang/Llama3.1-70B-Chinese-Chat,1,0.37956764543783084,0.11805442002282653,0.3695558384587787,0.0,0.12533097969991175,0.12533097969991175,0.3775255236309064,0,8.307149161518094
|
22 |
+
shenzhi-wang/Llama3.1-70B-Chinese-Chat,3,0.38622483411876246,0.12306660851355093,0.374537863679436,0.0,0.14386584289496912,0.14386584289496912,0.38384366117983154,0,11.681376875551633
|
23 |
+
shenzhi-wang/Llama3.1-70B-Chinese-Chat,5,0.3895488616778815,0.12582029733797498,0.37834594185588616,0.0,0.14386584289496912,0.14386584289496912,0.38714719527562863,0,17.23389232127096
|
24 |
+
shenzhi-wang/Mistral-7B-v0.3-Chinese-Chat,0,0.3284997502705771,0.08313795089297474,0.31822074756329843,0.0,0.12797881729920565,0.12797881729920565,0.3266954815790356,0,1.204766107678729
|
25 |
+
shenzhi-wang/Mistral-7B-v0.3-Chinese-Chat,1,0.3342115436248988,0.08857909016110346,0.3235832621122292,0.0,0.6690203000882613,0.6690203000882613,0.3250691235789747,1,1.4819064430714917
|
26 |
+
shenzhi-wang/Mistral-7B-v0.3-Chinese-Chat,3,0.3435621946945506,0.09605927100886698,0.3339835066382988,0.0,0.1262135922330097,0.1262135922330097,0.3417009211692762,0,2.262135922330097
|
27 |
+
shenzhi-wang/Mistral-7B-v0.3-Chinese-Chat,5,0.34429078135481284,0.09638489591361771,0.33821501828549394,0.0,0.07590467784642542,0.07590467784642542,0.34316381414750663,2,3.3883495145631066
|
28 |
+
shenzhi-wang/Mistral-7B-v0.3-Chinese-Chat,10,0.3408431061510028,0.09735670499814125,0.3331263575051163,0.0,0.10414827890556046,0.10414827890556046,0.339316280986861,11,6.558693733451015
|
29 |
+
shenzhi-wang/Mistral-7B-v0.3-Chinese-Chat,50,0.36184201368489227,0.104864029030581,0.34553515243463534,0.0,0.5136804942630185,0.5136804942630185,0.35413782502473057,2,29.659311562224183
|
30 |
+
gpt-4o-mini,0,0.3797696357415517,0.1208238389018596,0.37039368743666584,0.0,0.09532215357458076,0.09532215357458076,0.37821133607113916,0,1.5939982347749337
|
31 |
+
gpt-4o-mini,1,0.37721414424357197,0.12013402254992751,0.36725632920414286,0.0,0.09179170344218888,0.09179170344218888,0.37572317024740703,0,1.5666372462488967
|
32 |
+
gpt-4o-mini,3,0.3772985230936086,0.12400311006855895,0.36822411288225565,0.0,0.09179170344218888,0.09179170344218888,0.3758072155821894,0,1.2868490732568403
|
33 |
+
gpt-4o-mini,5,0.35541821046691263,0.1202464326274801,0.3472080523493449,0.0,0.05030891438658429,0.05030891438658429,0.3546452926906339,0,1.203883495145631
|
34 |
+
gpt-4o-mini,10,0.37335968903521094,0.1257600824824953,0.36566914304808296,0.0,0.0706090026478376,0.0706090026478376,0.37222227656264567,0,1.1879964695498677
|
35 |
+
gpt-4o-mini,50,0.4044690970661121,0.13972883920222515,0.39117898438510224,0.0,0.08473080317740513,0.08473080317740513,0.4029924080114739,0,1.289496910856134
|
36 |
+
gpt-4o,0,0.3797419877414444,0.12054600115274576,0.3704197875229349,0.0,0.09532215357458076,0.09532215357458076,0.37818380151840997,0,1.528684907325684
|
37 |
+
gpt-4o,1,0.37588586538591867,0.12049862468096047,0.36572207722254313,0.0,0.09179170344218888,0.09179170344218888,0.3744001415355042,0,1.203883495145631
|
38 |
+
gpt-4o,3,0.3768512103553621,0.12408746322526747,0.36677555510252513,0.0,0.09355692850838482,0.09355692850838482,0.3753332737090981,0,2.05207413945278
|
39 |
+
gpt-4o,5,0.35772544915145654,0.12169683347842021,0.3480606673293163,0.0,0.0353045013239188,0.0353045013239188,0.3571787674657609,0,1.6840247131509267
|
40 |
+
gpt-4o,10,0.3746444651189953,0.12498238983123719,0.36695107795536486,0.0,0.0706090026478376,0.0706090026478376,0.37350313867182305,0,1.7899382171226832
|
41 |
+
gpt-4o,50,0.40413933252744955,0.13782450337569063,0.3905031632820436,0.0,0.07590467784642542,0.07590467784642542,0.402816463024093,0,2.025595763459841
|
scripts/eval-mac.sh
CHANGED
@@ -14,15 +14,13 @@ grep MemTotal /proc/meminfo
|
|
14 |
# pip install torch torchvision torchaudio
|
15 |
# pip install -r requirements.txt
|
16 |
|
17 |
-
export START_NUM_SHOTS=50
|
18 |
|
19 |
-
./scripts/eval-model.sh
|
20 |
|
21 |
-
|
22 |
|
23 |
-
|
24 |
|
25 |
-
|
26 |
-
|
27 |
-
# ./scripts/eval-model.sh shenzhi-wang/Llama3.1-8B-Chinese-Chat
|
28 |
|
|
|
14 |
# pip install torch torchvision torchaudio
|
15 |
# pip install -r requirements.txt
|
16 |
|
17 |
+
# export START_NUM_SHOTS=50
|
18 |
|
19 |
+
./scripts/eval-model.sh internlm/internlm2_5-7b-chat
|
20 |
|
21 |
+
./scripts/eval-model.sh Qwen/Qwen2-7B-Instruct
|
22 |
|
23 |
+
./scripts/eval-model.sh shenzhi-wang/Mistral-7B-v0.3-Chinese-Chat
|
24 |
|
25 |
+
./scripts/eval-model.sh shenzhi-wang/Llama3.1-8B-Chinese-Chat
|
|
|
|
|
26 |
|
scripts/tune-lf.sh
ADDED
@@ -0,0 +1,15 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
#!/bin/sh
|
2 |
+
|
3 |
+
BASEDIR=$(dirname "$0")
|
4 |
+
cd $BASEDIR/../llama-factory/
|
5 |
+
echo Current Directory:
|
6 |
+
pwd
|
7 |
+
|
8 |
+
export ORG_NAME=$1
|
9 |
+
export MODEL_NAME=$2
|
10 |
+
export CHAT_TEMPLATE=$3
|
11 |
+
export DATA_PATH=../datasets/mac/mac.tsv
|
12 |
+
export YAML=config/mac_template.yaml
|
13 |
+
|
14 |
+
python ../llm_toolkit/setup_lf.py
|
15 |
+
llamafactory-cli train config/models/$MODEL_NAME.yaml
|
scripts/tune-mac.sh
ADDED
@@ -0,0 +1,23 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
#!/bin/sh
|
2 |
+
|
3 |
+
BASEDIR=$(dirname "$0")
|
4 |
+
cd $BASEDIR/..
|
5 |
+
echo Current Directory:
|
6 |
+
pwd
|
7 |
+
|
8 |
+
nvidia-smi
|
9 |
+
uname -a
|
10 |
+
cat /etc/os-release
|
11 |
+
lscpu
|
12 |
+
grep MemTotal /proc/meminfo
|
13 |
+
|
14 |
+
#pip install -r requirements.txt
|
15 |
+
cd ../LLaMA-Factory && pip install -e .[torch,metrics] && cd -
|
16 |
+
|
17 |
+
./scripts/tune-lf.sh internlm internlm2_5-7b-chat intern2
|
18 |
+
|
19 |
+
./scripts/tune-lf.sh Qwen Qwen2-7B-Instruct qwen
|
20 |
+
|
21 |
+
./scripts/tune-lf.sh shenzhi-wang Mistral-7B-v0.3-Chinese-Chat mistral
|
22 |
+
|
23 |
+
./scripts/tune-lf.sh shenzhi-wang Llama3.1-8B-Chinese-Chat llama3
|