Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 6 additions & 6 deletions scripts/regression/test_dpo_tiny-random-glm4moe.py
Original file line number Diff line number Diff line change
Expand Up @@ -236,15 +236,15 @@ def test_dpo_lora(self):
self.dpotrain_tester.assert_loss(resume_p.stdout, DPO_LORA_RESUME_EXCEPTED_LOSS)

# test lora merge
# lora_merge_output_dir = os.path.join(output_dir, "export")
lora_merge_output_dir = os.path.join(output_dir, "export")
# cli mode
lora_merge_cmd = ["paddleformers-cli", "export", updated_config_path]
lora_merge_p = subprocess.run(lora_merge_cmd, stdout=subprocess.PIPE, stderr=subprocess.STDOUT, text=True)
self.dpotrain_tester.assert_result(lora_merge_p.returncode, lora_merge_p.stdout)

# test lora_merge_model generate
# EXPECTED_RESULT = paddle.to_tensor(DPO_LORA_EXCEPTED_RESULT)
# self.dpotrain_tester.create_and_check_model_generate(lora_merge_output_dir, EXPECTED_RESULT)
EXPECTED_RESULT = paddle.to_tensor(DPO_LORA_EXCEPTED_RESULT)
self.dpotrain_tester.create_and_check_model_generate(lora_merge_output_dir, EXPECTED_RESULT)

def test_dpo_full_tp_pp(self):
output_dir = os.path.join(OUTPUT_DIR, "dpo_full_tp_pp")
Expand Down Expand Up @@ -348,15 +348,15 @@ def test_dpo_lora_tp_pp(self):
self.dpotrain_tester.assert_loss(resume_p.stdout, DPO_LORA_TP_PP_RESUME_EXCEPTED_LOSS)

# test lora merge
# lora_merge_output_dir = os.path.join(output_dir, "export")
lora_merge_output_dir = os.path.join(output_dir, "export")
# cli mode
lora_merge_cmd = ["paddleformers-cli", "export", updated_config_path]
lora_merge_p = subprocess.run(lora_merge_cmd, stdout=subprocess.PIPE, stderr=subprocess.STDOUT, text=True)
self.dpotrain_tester.assert_result(lora_merge_p.returncode, lora_merge_p.stdout)

# test lora_merge_model generate
# EXPECTED_RESULT = paddle.to_tensor(DPO_LORA_TP_PP_EXCEPTED_RESULT)
# self.dpotrain_tester.create_and_check_model_generate(lora_merge_output_dir, EXPECTED_RESULT)
EXPECTED_RESULT = paddle.to_tensor(DPO_LORA_TP_PP_EXCEPTED_RESULT)
self.dpotrain_tester.create_and_check_model_generate(lora_merge_output_dir, EXPECTED_RESULT)

# def test_dpo_full_function_call(self):
# output_dir = os.path.join(OUTPUT_DIR, "dpo_full_function_call")
Expand Down
16 changes: 8 additions & 8 deletions scripts/regression/test_pt_tiny-random-glm4moe.py
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@

PT_LORA_EXCEPTED_LOSS = 12.746171
PT_LORA_RESUME_EXCEPTED_LOSS = 12.751431
PT_LORA_EXCEPTED_RESULT = [[51172, 37927, 96130, 27654, 133362, 95331, 133362, 30625, 95331, 4198]]
PT_LORA_EXCEPTED_RESULT = [[51172, 37927, 96130, 27654, 133362, 95331, 27654, 133362, 115845, 115845]]

PT_FULL_TP_PP_EXCEPTED_LOSS = 11.932426
PT_FULL_TP_PP_RESUME_EXCEPTED_LOSS = 11.932665
Expand Down Expand Up @@ -108,7 +108,7 @@ def create_and_check_model_generate(
result = model.generate(input_ids, attention_mask=attention_mask, max_new_tokens=10)
print(f"excepted_result is : {excepted_result}")
print(f"result[0] is : {result[0]}")
self.assertTrue(paddle.allclose(result[0], excepted_result))
self.assertTrue(paddle.allclose(result[0].astype("float32"), excepted_result.astype("float32")))


class PTTrainTest(unittest.TestCase):
Expand Down Expand Up @@ -223,15 +223,15 @@ def test_pt_lora(self):
self.pttrain_tester.assert_loss(resume_p.stdout, PT_LORA_RESUME_EXCEPTED_LOSS)

# test lora merge
# lora_merge_output_dir = os.path.join(output_dir, "export")
lora_merge_output_dir = os.path.join(output_dir, "export")
# cli mode
lora_merge_cmd = ["paddleformers-cli", "export", updated_config_path]
lora_merge_p = subprocess.run(lora_merge_cmd, stdout=subprocess.PIPE, stderr=subprocess.STDOUT, text=True)
self.pttrain_tester.assert_result(lora_merge_p.returncode, lora_merge_p.stdout)

# test lora_merge_model generate
# EXPECTED_RESULT = paddle.to_tensor(PT_LORA_EXCEPTED_RESULT)
# self.pttrain_tester.create_and_check_model_generate(lora_merge_output_dir, EXPECTED_RESULT)
EXPECTED_RESULT = paddle.to_tensor(PT_LORA_EXCEPTED_RESULT)
self.pttrain_tester.create_and_check_model_generate(lora_merge_output_dir, EXPECTED_RESULT)

def test_pt_full_tp_pp(self):
output_dir = os.path.join(OUTPUT_DIR, "pt_full_tp_pp")
Expand Down Expand Up @@ -334,12 +334,12 @@ def test_pt_lora_tp_pp(self):
self.pttrain_tester.assert_loss(resume_p.stdout, PT_LORA_TP_PP_RESUME_EXCEPTED_LOSS)

# test lora merge
# lora_merge_output_dir = os.path.join(output_dir, "export")
lora_merge_output_dir = os.path.join(output_dir, "export")
# cli mode
lora_merge_cmd = ["paddleformers-cli", "export", updated_config_path]
lora_merge_p = subprocess.run(lora_merge_cmd, stdout=subprocess.PIPE, stderr=subprocess.STDOUT, text=True)
self.pttrain_tester.assert_result(lora_merge_p.returncode, lora_merge_p.stdout)

# test lora_merge_model generate
# EXPECTED_RESULT = paddle.to_tensor(PT_LORA_TP_PP_EXCEPTED_RESULT)
# self.pttrain_tester.create_and_check_model_generate(lora_merge_output_dir, EXPECTED_RESULT)
EXPECTED_RESULT = paddle.to_tensor(PT_LORA_TP_PP_EXCEPTED_RESULT)
self.pttrain_tester.create_and_check_model_generate(lora_merge_output_dir, EXPECTED_RESULT)
12 changes: 6 additions & 6 deletions scripts/regression/test_sft_tiny-random-glm4moe.py
Original file line number Diff line number Diff line change
Expand Up @@ -221,15 +221,15 @@ def test_sft_lora(self):
self.sfttrain_tester.assert_loss(resume_p.stdout, SFT_LORA_RESUME_EXCEPTED_LOSS)

# test lora merge
# lora_merge_output_dir = os.path.join(output_dir, "export")
lora_merge_output_dir = os.path.join(output_dir, "export")
# cli mode
lora_merge_cmd = ["paddleformers-cli", "export", updated_config_path]
lora_merge_p = subprocess.run(lora_merge_cmd, stdout=subprocess.PIPE, stderr=subprocess.STDOUT, text=True)
self.sfttrain_tester.assert_result(lora_merge_p.returncode, lora_merge_p.stdout)

# test lora_merge_model generate
# EXPECTED_RESULT = paddle.to_tensor(SFT_LORA_EXCEPTED_RESULT)
# self.sfttrain_tester.create_and_check_model_generate(lora_merge_output_dir, EXPECTED_RESULT)
EXPECTED_RESULT = paddle.to_tensor(SFT_LORA_EXCEPTED_RESULT)
self.sfttrain_tester.create_and_check_model_generate(lora_merge_output_dir, EXPECTED_RESULT)

def test_sft_full_tp_pp(self):
output_dir = os.path.join(OUTPUT_DIR, "sft_full_tp_pp")
Expand Down Expand Up @@ -332,15 +332,15 @@ def test_sft_lora_tp_pp(self):
self.sfttrain_tester.assert_loss(resume_p.stdout, SFT_LORA_TP_PP_RESUME_EXCEPTED_LOSS)

# test lora merge
# lora_merge_output_dir = os.path.join(output_dir, "export")
lora_merge_output_dir = os.path.join(output_dir, "export")
# cli mode
lora_merge_cmd = ["paddleformers-cli", "export", updated_config_path]
lora_merge_p = subprocess.run(lora_merge_cmd, stdout=subprocess.PIPE, stderr=subprocess.STDOUT, text=True)
self.sfttrain_tester.assert_result(lora_merge_p.returncode, lora_merge_p.stdout)

# test lora_merge_model generate
# EXPECTED_RESULT = paddle.to_tensor(SFT_LORA_TP_PP_EXCEPTED_RESULT)
# self.sfttrain_tester.create_and_check_model_generate(lora_merge_output_dir, EXPECTED_RESULT)
EXPECTED_RESULT = paddle.to_tensor(SFT_LORA_TP_PP_EXCEPTED_RESULT)
self.sfttrain_tester.create_and_check_model_generate(lora_merge_output_dir, EXPECTED_RESULT)

def test_sft_full_function_call(self):
output_dir = os.path.join(OUTPUT_DIR, "sft_full_function_call")
Expand Down
Loading