NotImplementedError
Hello, I encountered an issue while using your code to train on a custom dataset in the COCO format. When the program reached the "start train" phase, a NotImplementedError was raised. According to the error traceback, the issue occurs in the transform method of the torchvision.transforms.v2_transform.py file, where it raises a NotImplementedError, indicating that the method is not implemented. I have tried adjusting the version of torchvision (both upgrading and downgrading), but the problem persists. The dataset follows the standard COCO format. I hope you can help analyze the possible causes and provide a solution. Thank you!
Error log:
Traceback (most recent call last):
File "D:\code\ViT\D-FINE\D-FINE-master2\train.py", line 106, in
File "D:\code\ViT\D-FINE\D-FINE-master2\src\data\dataset\coco_dataset.py", line 47, in getitem
img, target, _ = self._transforms(img, target, self)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "E:\Anaconda3\envs\dfine\Lib\site-packages\torch\nn\modules\module.py", line 1739, in _wrapped_call_impl
return self._call_impl(*args, **kwargs)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "E:\Anaconda3\envs\dfine\Lib\site-packages\torch\nn\modules\module.py", line 1750, in _call_impl
return forward_call(*args, **kwargs)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "D:\code\ViT\D-FINE\D-FINE-master2\src\data\transforms\container.py", line 52, in forward
return self.get_forward(self.policy["name"])(*inputs)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "D:\code\ViT\D-FINE\D-FINE-master2\src\data\transforms\container.py", line 79, in stop_epoch_forward
sample = transform(sample)
^^^^^^^^^^^^^^^^^
File "E:\Anaconda3\envs\dfine\Lib\site-packages\torch\nn\modules\module.py", line 1739, in _wrapped_call_impl
return self._call_impl(*args, **kwargs)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "E:\Anaconda3\envs\dfine\Lib\site-packages\torch\nn\modules\module.py", line 1750, in _call_impl
return forward_call(*args, **kwargs)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "E:\Anaconda3\envs\dfine\Lib\site-packages\torchvision\transforms\v2_transform.py", line 68, in forward
flat_outputs = [
^
File "E:\Anaconda3\envs\dfine\Lib\site-packages\torchvision\transforms\v2_transform.py", line 69, in <listcomp>
self.transform(inpt, params) if needs_transform else inpt
^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "E:\Anaconda3\envs\dfine\Lib\site-packages\torchvision\transforms\v2_transform.py", line 55, in transform
raise NotImplementedError
NotImplementedError
Hi, I had the same problem, downgrading version torch and torchvision helped me.
python=3.11.9 torch=2.5.0 torchvision=0.20.0
Hi, I had the same problem, downgrading version torch and torchvision helped me.
python=3.11.9 torch=2.5.0 torchvision=0.20.0
This is helpful, thank you!
I got it working on torch 2.6.0. The new transformers API just requires a method overload missing in DFINE. In _transforms.py, just add this to any class inheriting Transformer:
def transform(self, inpt, params):
return self._transform(inpt, params)
I got it working on torch 2.6.0. The new transformers API just requires a method overload missing in DFINE. In _transforms.py, just this to any class inheriting Transformer:
def transform(self, inpt, params): return self._transform(inpt, params)
Work for me! thanks!
Thanks for you