PaddleGAN icon indicating copy to clipboard operation
PaddleGAN copied to clipboard

import ppgan.datasets.transforms.functional as custom_F AttributeError: module 'ppgan' has no attribute 'datasets'

Open majintao1994 opened this issue 5 years ago • 13 comments

python tools/video-enhance.py --input /home/hust/PaddleGAN/applications/video/1.mp4 --process_order DAIN DeOldify EDVR --output /home/hust/output/ Traceback (most recent call last): File "tools/video-enhance.py", line 18, in from ppgan.apps import DAINPredictor File "/home/hust/PaddleGAN/ppgan/apps/init.py", line 16, in from .deepremaster_predictor import DeepRemasterPredictor File "/home/hust/PaddleGAN/ppgan/apps/deepremaster_predictor.py", line 24, in from ppgan.models.generators.remaster import NetworkR, NetworkC File "/home/hust/PaddleGAN/ppgan/models/init.py", line 20, in from .makeup_model import MakeupModel File "/home/hust/PaddleGAN/ppgan/models/makeup_model.py", line 32, in from ..datasets.makeup_dataset import MakeupDataset

File "/home/hust/PaddleGAN/ppgan/datasets/init.py", line 15, in from .unpaired_dataset import UnpairedDataset File "/home/hust/PaddleGAN/ppgan/datasets/unpaired_dataset.py", line 18, in from .base_dataset import BaseDataset, get_transform File "/home/hust/PaddleGAN/ppgan/datasets/base_dataset.py", line 24, in from .transforms import transforms as T File "/home/hust/PaddleGAN/ppgan/datasets/transforms/init.py", line 15, in from .transforms import PairedRandomCrop, PairedRandomHorizontalFlip, Add, ResizeToScale File "/home/hust/PaddleGAN/ppgan/datasets/transforms/transforms.py", line 22, in import ppgan.datasets.transforms.functional as custom_F AttributeError: module 'ppgan' has no attribute 'datasets'

can you help me? what is wrong?thinks

majintao1994 avatar Dec 09 '20 07:12 majintao1994

update your code and try again? I can not reproduce your error

LielinJiang avatar Dec 09 '20 10:12 LielinJiang

@majintao1994 If you use code in master branch, not release/0.1.0 branch. Maybe you need to install PaddleGAN from source. Or export PYTHONPATH to the PaddleGAN root dir. Since master branch add new models.

qingqing01 avatar Dec 10 '20 02:12 qingqing01

I re installed the environment, but there are new problems. Is it my environment problem,The error is as follows: 微信图片_20201210142450 微信图片_20201210142459

majintao1994 avatar Dec 10 '20 06:12 majintao1994

need python version >= 3.6

LielinJiang avatar Dec 10 '20 06:12 LielinJiang

However, there may be something wrong with your documen 微信图片_20201210143602 tation

majintao1994 avatar Dec 10 '20 06:12 majintao1994

sorry, we will update this doc immediately.

LielinJiang avatar Dec 10 '20 06:12 LielinJiang

import ppgan.datasets.transforms.functional as custom_F AttributeError: module 'ppgan' has no attribute 'datasets' can you help me? what is wrong?thinks

FahsaRwatit avatar Dec 11 '20 10:12 FahsaRwatit

import ppgan.datasets.transforms.functional as custom_F AttributeError: module 'ppgan' has no attribute 'datasets' can you help me? what is wrong?thinks

update your code

LielinJiang avatar Dec 11 '20 10:12 LielinJiang

I followed the intro and tried the codes below in google colab:

!pip install -U paddlepaddle-gpu==2.0.0rc0
!git clone https://github.com/paddlepaddle/PaddleGAN.git
%cd PaddleGAN/
pip install -v -e . 
from ppgan.apps import RealSRPredictor
sr = RealSRPredictor()
sr.run("docs/imgs/monarch.png")

and get:

FileNotFoundError: [Errno 2] No such file or directory: 'README_en.md'

After I edited 'README_en.md' to 'README.md' I got the same message as below when running from ppgan.apps import RealSRPredictor

AttributeError: module 'ppgan' has no attribute 'datasets'

Edited: I also tried to clone from gitee and using ai studio (without pip install paddlepaddle):

gitee + aistudio: √ github + aistudio: √ gitee + colab: AttributeError: module 'ppgan' has no attribute 'datasets' github + colab: AttributeError: module 'ppgan' has no attribute 'datasets'

My notebook: google colab: https://colab.research.google.com/drive/1fkUsgxeRvewJOJYSOf3b21egbwa_JCSy?usp=sharing aistudio: https://aistudio.baidu.com/aistudio/projectdetail/1330972?shared=1

konatasick avatar Dec 15 '20 03:12 konatasick

Thanks for the feedback, the difference between aistudio and colab is due to the different python version. This error occurs in python3.6. We will fix it as soon as possible.

LielinJiang avatar Dec 16 '20 02:12 LielinJiang

Thanks for the feedback, the difference between aistudio and colab is due to the different python version. This error occurs in python3.6. We will fix it as soon as possible.

Now the error becomes:

     19 import paddle
     20 from .base_predictor import BasePredictor
---> 21 from ppgan.datasets.transforms import ResizeToScale
     22 import paddle.vision.transforms as T
     23 from ppgan.models.generators import AnimeGenerator

ImportError: cannot import name 'ResizeToScale'

Also, I have set the colab notebook using GPU but I still receive the massage:

/usr/local/lib/python3.6/dist-packages/paddle/fluid/framework.py:295: UserWarning: You are using GPU version Paddle, but your CUDA device is not set properly. CPU device will be used by default.
  "You are using GPU version Paddle, but your CUDA device is not set properly. CPU device will be used by default."

How can I use GPU in google colab?

konatasick avatar Dec 17 '20 08:12 konatasick

Thanks for the feedback, the difference between aistudio and colab is due to the different python version. This error occurs in python3.6. We will fix it as soon as possible.

Now the error becomes:

     19 import paddle
     20 from .base_predictor import BasePredictor
---> 21 from ppgan.datasets.transforms import ResizeToScale
     22 import paddle.vision.transforms as T
     23 from ppgan.models.generators import AnimeGenerator

ImportError: cannot import name 'ResizeToScale'

Also, I have set the colab notebook using GPU but I still receive the massage:

/usr/local/lib/python3.6/dist-packages/paddle/fluid/framework.py:295: UserWarning: You are using GPU version Paddle, but your CUDA device is not set properly. CPU device will be used by default.
  "You are using GPU version Paddle, but your CUDA device is not set properly. CPU device will be used by default."

How can I use GPU in google colab?

colab cuda version is 10.1 you can try following command to intall correspond paddlepaddle: !python -m pip install paddlepaddle-gpu==2.0.0rc0.post101 -f https://paddlepaddle.org.cn/whl/stable.html

LielinJiang avatar Dec 17 '20 09:12 LielinJiang

image

LielinJiang avatar Dec 17 '20 09:12 LielinJiang

问题过于久远,如果有图像和视频生成的需求,可以使用新的跨模态工具: https://github.com/PaddlePaddle/PaddleMIX/tree/develop

JunnYu avatar Feb 29 '24 03:02 JunnYu