diff --git a/README.md b/README.md index 02466c6..f4b57bd 100755 --- a/README.md +++ b/README.md @@ -26,7 +26,7 @@ python set_up.py bdist_wheel 执行以下命令安装whl包: ```shell -pip install dist/mindpet-1.0.0-py3-none-any.whl +pip install dist/mindpet-1.0.4-py3-none-any.whl ``` diff --git a/mindpet/delta/lora.py b/mindpet/delta/lora.py index 2dd6ddc..4d96c83 100755 --- a/mindpet/delta/lora.py +++ b/mindpet/delta/lora.py @@ -21,6 +21,12 @@ from mindpet.utils.version_control import get_dropout +def check_dense_input_shape(x, prim_name=None): + msg_prefix = f"For '{prim_name}', the" if prim_name else "The" + if len(x) < 2: + raise ValueError(f"{msg_prefix} dimension of 'x' should not be less than 2, but got {len(x)}.") + + class LoRADense(nn.Dense): """Define a dense layer with LoRA structure. @@ -86,7 +92,7 @@ def construct(self, input_tensor): # Shape operations x_shape = self.shape_op(input_tensor) - nn.layer.basic.check_dense_input_shape(x_shape, self.cls_name) + check_dense_input_shape(x_shape, self.cls_name) input_tensor = self.reshape(input_tensor, (-1, x_shape[-1])) # Dense result diff --git a/set_up.py b/set_up.py index ea1d1b0..255b207 100755 --- a/set_up.py +++ b/set_up.py @@ -12,7 +12,7 @@ def get_version(): - version = '1.0.3' + version = '1.0.4' return version