Skip to content
Snippets Groups Projects

Add __init__ in datasets/

Closed Vlad-Andrei BĂDOIU (78692) requested to merge vladb/fix_module into main

Merge request reports

Loading
Loading

Activity

Filter activity
  • Approvals
  • Assignees & reviewers
  • Comments (from bots)
  • Comments (from users)
  • Commits & branches
  • Edits
  • Labels
  • Lock status
  • Mentions
  • Merge request status
  • Tracking
  • Not sure what the change does?

    There is indeed the problem that you cannot run the datasets/ files directly (i.e. running python datasets/wikitext103.py will give you a ModuleNotFoundError: No module named 'datasets'), at least on my side. Is that a problem for you too? Adding the __init__ file also doesn't seem to solve anything, as I still get the error. My (very hacky) fix is to change:

    from datasets.dataset_utils import *

    to

    try:
      from datasets.dataset_utils import *
    except ImportError:
      from dataset_utils import *

    Would really love to avoid this type of nonsense, but this might be needed if we can't manage to get __init__.py to work. Any ideas?

  • Weird, without it I cannot run example_training.py

    vladb@gaina1:~/optimus-prime/optimus$ python3 example_training.py 
    Traceback (most recent call last):
      File "/home/vladb/optimus-prime/optimus/example_training.py", line 11, in <module>
        from datasets.wikitext103 import WikiText103Dataset
    ModuleNotFoundError: No module named 'datasets.wikitext103'
  • Ah, that's indeed very weird. Could you post the python version? I have no idea why my stuff works without an __init__ file.

    I might as well just merge this, because it's supposed to be the correct way to do modules in python anyway.

  • In a funny way, I tested this now on 3 PC's (my laptop, my desk computer and zoo cluster), and none of them need __init__.py. Are you sure the problem comes from this file? Is there any way you renamed the folder or wikitext file?

Please register or sign in to reply
Loading