add tests.cal_flops.py

This commit is contained in:
hiyouga committed 2023-09-16 23:40:41 +08:00
1 parent acda45e463
commit 469f859161
2 files changed
+46 -4

No files matched your search

+2 -4
View File
@@ -86,10 +86,8 @@ def load_model_and_tokenizer(
# Fix config (for Qwen)
if is_trainable and hasattr(config, "fp16") and hasattr(config, "bf16"):
if model_args.compute_dtype == torch.bfloat16:
setattr(config, "bf16", True)
else:
setattr(config, "fp16", True)
setattr(config, "fp16", model_args.compute_dtype == torch.float16)
setattr(config, "bf16", model_args.compute_dtype == torch.bfloat16)
# Set RoPE scaling
if model_args.rope_scaling is not None: