linzhiqiu / t2v_metrics

Evaluating text-to-image/video/3D models with VQAScore
https://linzhiqiu.github.io/papers/vqascore/
Apache License 2.0
209 stars 20 forks source link

Conflict with modules named dataset #13

Closed piyushnags closed 2 months ago

piyushnags commented 2 months ago

System Info:

Package Version(s): 1.1 and 1.2

Issue: Import error possibly due to friction between pyarrow and image reward package? (not sure)

Description: I've tried installing t2v-metrics through pip and building from source, but I still get the same error:

/opt/conda/envs/t2v/lib/python3.10/site-packages/transformers/utils/generic.py:441: FutureWarning: `torch.utils._pytree._register_pytree_node` is deprecated. Please use `torch.utils._pytree.register_pytree_node` instead.
  _torch_pytree._register_pytree_node(
/opt/conda/envs/t2v/lib/python3.10/site-packages/transformers/utils/generic.py:309: FutureWarning: `torch.utils._pytree._register_pytree_node` is deprecated. Please use `torch.utils._pytree.register_pytree_node` instead.
  _torch_pytree._register_pytree_node(
/opt/conda/envs/t2v/lib/python3.10/site-packages/transformers/utils/generic.py:309: FutureWarning: `torch.utils._pytree._register_pytree_node` is deprecated. Please use `torch.utils._pytree.register_pytree_node` instead.
  _torch_pytree._register_pytree_node(
/opt/conda/envs/t2v/lib/python3.10/site-packages/transformers/utils/generic.py:309: FutureWarning: `torch.utils._pytree._register_pytree_node` is deprecated. Please use `torch.utils._pytree.register_pytree_node` instead.
  _torch_pytree._register_pytree_node(
Traceback (most recent call last):
  File "/home/ubuntu/gan-unlearning/evaluate.py", line 8, in <module>
    import t2v_metrics
  File "/opt/conda/envs/t2v/lib/python3.10/site-packages/t2v_metrics/__init__.py", line 9, in <module>
    from .itmscore import ITMScore, list_all_itmscore_models
  File "/opt/conda/envs/t2v/lib/python3.10/site-packages/t2v_metrics/itmscore.py", line 7, in <module>
    from .models.itmscore_models import list_all_itmscore_models, get_itmscore_model
  File "/opt/conda/envs/t2v/lib/python3.10/site-packages/t2v_metrics/models/itmscore_models/__init__.py", line 2, in <module>
    from .image_reward_model import IMAGE_REWARD_MODELS, ImageRewardScoreModel
  File "/opt/conda/envs/t2v/lib/python3.10/site-packages/t2v_metrics/models/itmscore_models/image_reward_model.py", line 6, in <module>
    import ImageReward as reward
  File "/opt/conda/envs/t2v/lib/python3.10/site-packages/ImageReward/__init__.py", line 3, in <module>
    from .ReFL import *
  File "/opt/conda/envs/t2v/lib/python3.10/site-packages/ImageReward/ReFL.py", line 27, in <module>
    from datasets import load_dataset
ImportError: cannot import name 'load_dataset' from 'datasets' (/home/ubuntu/gan-unlearning/datasets/__init__.py)

Trigger: When running import t2v_metrics When building from source, I don't get the Future warnings but the import error persists. I've tried looking through the source code and image reward issues but couldn't figure anything out. Perhaps I'm missing something really obvious (torch version, etc.), any help is very much appreciated.

piyushnags commented 2 months ago

Oh, I seem to have found the cause. This error only occurs if I have a module called datasets in my current working directory. Thanks for sharing your work, this is really cool!

Edit: I will update the Issue title. Also, probably a bad idea on my part to choose datasets as a module name when there's a lib called datasets

linzhiqiu commented 2 months ago

Ah thanks for your kind words and glad you found the cause!