[shardformer] added embedding gradient check (#4124)

This commit is contained in:
Frank Lee
2023-06-30 16:16:44 +08:00
parent 44a190e6ac
commit ae035d305d
14 changed files with 255 additions and 74 deletions

View File

@@ -55,7 +55,7 @@ def setattr_(obj, attr: str, value, ignore: bool = False):
except AttributeError:
if ignore:
return
raise AttributeError(f"Object {obj} has no attribute {attr}")
raise AttributeError(f"Object {obj.__class__.__name__} has no attribute {attr}")
setattr(obj, attrs[-1], value)
@@ -76,5 +76,5 @@ def getattr_(obj, attr: str, ignore: bool = False):
except AttributeError:
if ignore:
return None
raise AttributeError(f"Object {obj} has no attribute {attr}")
raise AttributeError(f"Object {obj.__class__.__name__} has no attribute {attr}")
return obj