I tried to implement the DocuNet model in colab. while running the model, I got the following error:
The following command I ran with DocRED dataset:
!bash scripts/run_docred.sh --transformer-type roberta
!bash scripts/run_docred.sh --transformer-type bert
Both the commands, throws same error.
The error was follows:
Traceback (most recent call last):
File "./train_balanceloss.py", line 12, in
from model_balanceloss import DocREModel
File "/content/DocuNet/model_balanceloss.py", line 8, in
from element_wise import ElementWiseMatrixAttention
File "/content/DocuNet/element_wise.py", line 8, in
class ElementWiseMatrixAttention(MatrixAttention):
File "/content/DocuNet/element_wise.py", line 22, in ElementWiseMatrixAttention
def forward(self, tensor_1: torch.Tensor, tensor_2: torch.Tensor) -> torch.Tensor:
File "/usr/local/lib/python3.7/site-packages/overrides/overrides.py", line 88, in overrides
return _overrides(method, check_signature, check_at_runtime)
File "/usr/local/lib/python3.7/site-packages/overrides/overrides.py", line 114, in _overrides
_validate_method(method, super_class, check_signature)
File "/usr/local/lib/python3.7/site-packages/overrides/overrides.py", line 135, in _validate_method
ensure_signature_is_compatible(super_method, method, is_static)
File "/usr/local/lib/python3.7/site-packages/overrides/signature.py", line 95, in ensure_signature_is_compatible
super_sig, sub_sig, super_type_hints, sub_type_hints, is_static, method_name
File "/usr/local/lib/python3.7/site-packages/overrides/signature.py", line 136, in ensure_all_kwargs_defined_in_sub
raise TypeError(f"{method_name}: {name} is not present.")
TypeError: ElementWiseMatrixAttention.forward: matrix_1 is not present.
Traceback (most recent call last):
File "./train_balanceloss.py", line 12, in
from model_balanceloss import DocREModel
File "/content/DocuNet/model_balanceloss.py", line 8, in
from element_wise import ElementWiseMatrixAttention
File "/content/DocuNet/element_wise.py", line 8, in
class ElementWiseMatrixAttention(MatrixAttention):
File "/content/DocuNet/element_wise.py", line 22, in ElementWiseMatrixAttention
def forward(self, tensor_1: torch.Tensor, tensor_2: torch.Tensor) -> torch.Tensor:
File "/usr/local/lib/python3.7/site-packages/overrides/overrides.py", line 88, in overrides
return _overrides(method, check_signature, check_at_runtime)
File "/usr/local/lib/python3.7/site-packages/overrides/overrides.py", line 114, in _overrides
_validate_method(method, super_class, check_signature)
File "/usr/local/lib/python3.7/site-packages/overrides/overrides.py", line 135, in _validate_method
ensure_signature_is_compatible(super_method, method, is_static)
File "/usr/local/lib/python3.7/site-packages/overrides/signature.py", line 95, in ensure_signature_is_compatible
super_sig, sub_sig, super_type_hints, sub_type_hints, is_static, method_name
File "/usr/local/lib/python3.7/site-packages/overrides/signature.py", line 136, in ensure_all_kwargs_defined_in_sub
raise TypeError(f"{method_name}: {name} is not present.")
TypeError: ElementWiseMatrixAttention.forward: matrix_1 is not present.
Traceback (most recent call last):
File "./train_balanceloss.py", line 12, in
from model_balanceloss import DocREModel
File "/content/DocuNet/model_balanceloss.py", line 8, in
from element_wise import ElementWiseMatrixAttention
File "/content/DocuNet/element_wise.py", line 8, in
class ElementWiseMatrixAttention(MatrixAttention):
File "/content/DocuNet/element_wise.py", line 22, in ElementWiseMatrixAttention
def forward(self, tensor_1: torch.Tensor, tensor_2: torch.Tensor) -> torch.Tensor:
File "/usr/local/lib/python3.7/site-packages/overrides/overrides.py", line 88, in overrides
return _overrides(method, check_signature, check_at_runtime)
File "/usr/local/lib/python3.7/site-packages/overrides/overrides.py", line 114, in _overrides
_validate_method(method, super_class, check_signature)
File "/usr/local/lib/python3.7/site-packages/overrides/overrides.py", line 135, in _validate_method
ensure_signature_is_compatible(super_method, method, is_static)
File "/usr/local/lib/python3.7/site-packages/overrides/signature.py", line 95, in ensure_signature_is_compatible
super_sig, sub_sig, super_type_hints, sub_type_hints, is_static, method_name
File "/usr/local/lib/python3.7/site-packages/overrides/signature.py", line 136, in ensure_all_kwargs_defined_in_sub
raise TypeError(f"{method_name}: {name} is not present.")
TypeError: ElementWiseMatrixAttention.forward: matrix_1 is not present.
I couldn't able to find the error. How to solve this error? can you help me out from this error?
Thank you!
Hi there!
I think this error may related to the environment offered by the Colab. To solve this problem, you can simply remove the following code in model_balanceloss.py and try again.
I tried to implement the DocuNet model in colab. while running the model, I got the following error:
The following command I ran with DocRED dataset: !bash scripts/run_docred.sh --transformer-type roberta !bash scripts/run_docred.sh --transformer-type bert
Both the commands, throws same error. The error was follows: Traceback (most recent call last): File "./train_balanceloss.py", line 12, in
from model_balanceloss import DocREModel
File "/content/DocuNet/model_balanceloss.py", line 8, in
from element_wise import ElementWiseMatrixAttention
File "/content/DocuNet/element_wise.py", line 8, in
class ElementWiseMatrixAttention(MatrixAttention):
File "/content/DocuNet/element_wise.py", line 22, in ElementWiseMatrixAttention
def forward(self, tensor_1: torch.Tensor, tensor_2: torch.Tensor) -> torch.Tensor:
File "/usr/local/lib/python3.7/site-packages/overrides/overrides.py", line 88, in overrides
return _overrides(method, check_signature, check_at_runtime)
File "/usr/local/lib/python3.7/site-packages/overrides/overrides.py", line 114, in _overrides
_validate_method(method, super_class, check_signature)
File "/usr/local/lib/python3.7/site-packages/overrides/overrides.py", line 135, in _validate_method
ensure_signature_is_compatible(super_method, method, is_static)
File "/usr/local/lib/python3.7/site-packages/overrides/signature.py", line 95, in ensure_signature_is_compatible
super_sig, sub_sig, super_type_hints, sub_type_hints, is_static, method_name
File "/usr/local/lib/python3.7/site-packages/overrides/signature.py", line 136, in ensure_all_kwargs_defined_in_sub
raise TypeError(f"{method_name}:
from model_balanceloss import DocREModel
File "/content/DocuNet/model_balanceloss.py", line 8, in
from element_wise import ElementWiseMatrixAttention
File "/content/DocuNet/element_wise.py", line 8, in
class ElementWiseMatrixAttention(MatrixAttention):
File "/content/DocuNet/element_wise.py", line 22, in ElementWiseMatrixAttention
def forward(self, tensor_1: torch.Tensor, tensor_2: torch.Tensor) -> torch.Tensor:
File "/usr/local/lib/python3.7/site-packages/overrides/overrides.py", line 88, in overrides
return _overrides(method, check_signature, check_at_runtime)
File "/usr/local/lib/python3.7/site-packages/overrides/overrides.py", line 114, in _overrides
_validate_method(method, super_class, check_signature)
File "/usr/local/lib/python3.7/site-packages/overrides/overrides.py", line 135, in _validate_method
ensure_signature_is_compatible(super_method, method, is_static)
File "/usr/local/lib/python3.7/site-packages/overrides/signature.py", line 95, in ensure_signature_is_compatible
super_sig, sub_sig, super_type_hints, sub_type_hints, is_static, method_name
File "/usr/local/lib/python3.7/site-packages/overrides/signature.py", line 136, in ensure_all_kwargs_defined_in_sub
raise TypeError(f"{method_name}:
from model_balanceloss import DocREModel
File "/content/DocuNet/model_balanceloss.py", line 8, in
from element_wise import ElementWiseMatrixAttention
File "/content/DocuNet/element_wise.py", line 8, in
class ElementWiseMatrixAttention(MatrixAttention):
File "/content/DocuNet/element_wise.py", line 22, in ElementWiseMatrixAttention
def forward(self, tensor_1: torch.Tensor, tensor_2: torch.Tensor) -> torch.Tensor:
File "/usr/local/lib/python3.7/site-packages/overrides/overrides.py", line 88, in overrides
return _overrides(method, check_signature, check_at_runtime)
File "/usr/local/lib/python3.7/site-packages/overrides/overrides.py", line 114, in _overrides
_validate_method(method, super_class, check_signature)
File "/usr/local/lib/python3.7/site-packages/overrides/overrides.py", line 135, in _validate_method
ensure_signature_is_compatible(super_method, method, is_static)
File "/usr/local/lib/python3.7/site-packages/overrides/signature.py", line 95, in ensure_signature_is_compatible
super_sig, sub_sig, super_type_hints, sub_type_hints, is_static, method_name
File "/usr/local/lib/python3.7/site-packages/overrides/signature.py", line 136, in ensure_all_kwargs_defined_in_sub
raise TypeError(f"{method_name}:
{name}
is not present.") TypeError: ElementWiseMatrixAttention.forward:matrix_1
is not present. Traceback (most recent call last): File "./train_balanceloss.py", line 12, in{name}
is not present.") TypeError: ElementWiseMatrixAttention.forward:matrix_1
is not present. Traceback (most recent call last): File "./train_balanceloss.py", line 12, in{name}
is not present.") TypeError: ElementWiseMatrixAttention.forward:matrix_1
is not present.I couldn't able to find the error. How to solve this error? can you help me out from this error? Thank you!