Closed GbrlOl closed 1 year ago
If you are working from Google Colab and you have this same problem, you should edit the following path: /content/super-gradients/src/super_gradients/training/utils/utils.py
You can edit the file directly from google colab (I had to clone the repository)
%cd /content/super-gradients !pip install .
Now, that you are inside the utils.py file, enter it:
import collections.abc ... def ensure_is_tuple_of_two(inputs): if inputs is None: return None
if isinstance(inputs, collections.abc.Iterable) and not isinstance(inputs, str):
a, b = inputs
return a, b
... Comment the lines or delete them, in my case I commented them.
A few lines of code were missing:
def ensure_is_tuple_of_two(inputs): if inputs is None: return None if isinstance(inputs, collections.abc.Iterable) and not isinstance(inputs, str): a, b = inputs return a, b
This issue was already fixed and fix merged in master branch. In the next release it will be available to install through pip. As of now you can install SG from master branch.
вт, 27 черв. 2023 р. о 01:32 GbrlOl @.***> пише:
I leave the edited file
utils.zip https://github.com/Deci-AI/super-gradients/files/11875198/utils.zip
— Reply to this email directly, view it on GitHub https://github.com/Deci-AI/super-gradients/issues/1208#issuecomment-1608409833, or unsubscribe https://github.com/notifications/unsubscribe-auth/AAEB6YFKDLOTYBFXR5L5HJDXNIEXXANCNFSM6AAAAAAZSYGFSQ . You are receiving this because you are subscribed to this thread.Message ID: @.***>
Or you could just run this before running the code giving you the error
import collections
collections.Iterable = collections.abc.Iterable
Worked for me
Im closing this issue down. If problem persists after the upcoming release feel free to open another issue.
Hey @harrietfiagbor @GbrlOl
Thanks for opening an issue for SG. I'm gathering some feedback on SuperGradients and YOLO-NAS.
Would you be down for a quick call to chat about your experience?
If a call doesn't work for you, no worries. I've got a short survey you could fill out: https://bit.ly/sgyn-feedback.
I know you’re super busy, but your input will help us shape the direction of SuperGradients and make it as useful as possible for you.
I appreciate your time and feedback. Let me know what works for you.
Cheers,
Harpreet
🐛 Describe the bug
AttributeError Traceback (most recent call last) in <cell line: 4>()
2 coco_detection_yolo_format_train, coco_detection_yolo_format_val)
3
----> 4 train_data = coco_detection_yolo_format_train(
5 dataset_params={
6 'data_dir': dataset_params['data_dir'],
8 frames /usr/local/lib/python3.10/dist-packages/super_gradients/training/utils/utils.py in ensure_is_tuple_of_two(inputs) 593 return None 594 --> 595 if isinstance(inputs, collections.Iterable) and not isinstance(inputs, str): 596 a, b = inputs 597 return a, b
AttributeError: module 'collections' has no attribute 'Iterable'
Versions
In the part where I change the paths where I have my train, val and test data, when I execute those lines I get 'AttributeError: module 'collections' has no attribute 'Iterable''.
dataset_params = { 'data_dir': ROOT_DIR, 'train_imgs_dir': train_imgs_dir, 'train_labels_dir': train_labels_dir, 'val_imgs_dir': val_imgs_dir, 'val_labels_dir': val_labels_dir, 'test_imgs_dir': test_imgs_dir, 'test_labels_dir': test_labels_dir, 'classes': classes, }
Possible solution? GPT-4 tells me that:
The error you're seeing must be changed in the Python standard library. Before Python 3.3, collection types like Iterable were available directly in the collections module. However, starting with Python 3.3, these types were moved to the collections.abc module, although they were still available in collections for compatibility reasons. As of Python 3.8, a warning will be thrown if you try to access these types from collections instead of collections.abc, and in Python 3.10, this will throw an error, which is what you're seeing.
I'm using Google Colab