mirror of
https://github.com/hiyouga/LLaMA-Factory.git
synced 2025-12-18 12:50:38 +08:00
[test] add npu test yaml and add ascend a3 docker file (#9547)
Co-authored-by: jiaqiw09 <jiaqiw960714@gmail.com>
This commit is contained in:
@@ -14,6 +14,7 @@
|
||||
|
||||
import os
|
||||
|
||||
import pytest
|
||||
import torch
|
||||
|
||||
from llamafactory.train.test_utils import load_infer_model, load_train_model
|
||||
@@ -43,6 +44,7 @@ INFER_ARGS = {
|
||||
}
|
||||
|
||||
|
||||
@pytest.mark.runs_on(["cpu","npu"])
|
||||
def test_freeze_train_all_modules():
|
||||
model = load_train_model(freeze_trainable_layers=1, **TRAIN_ARGS)
|
||||
for name, param in model.named_parameters():
|
||||
@@ -54,6 +56,7 @@ def test_freeze_train_all_modules():
|
||||
assert param.dtype == torch.float16
|
||||
|
||||
|
||||
@pytest.mark.runs_on(["cpu","npu"])
|
||||
def test_freeze_train_extra_modules():
|
||||
model = load_train_model(freeze_trainable_layers=1, freeze_extra_modules="embed_tokens,lm_head", **TRAIN_ARGS)
|
||||
for name, param in model.named_parameters():
|
||||
@@ -65,6 +68,7 @@ def test_freeze_train_extra_modules():
|
||||
assert param.dtype == torch.float16
|
||||
|
||||
|
||||
@pytest.mark.runs_on(["cpu","npu"])
|
||||
def test_freeze_inference():
|
||||
model = load_infer_model(**INFER_ARGS)
|
||||
for param in model.parameters():
|
||||
|
||||
Reference in New Issue
Block a user