From 600a79995d94a4ec5662da1a7f82b398026cc45e Mon Sep 17 00:00:00 2001 From: LielinJiang <50691816+LielinJiang@users.noreply.github.com> Date: Thu, 27 May 2021 11:46:25 +0800 Subject: [PATCH] cherrypick from develop --- docs/en_US/install.md | 6 +++--- docs/zh_CN/install.md | 19 ++++++++++++++++++- ppgan/__init__.py | 2 ++ ppgan/datasets/builder.py | 4 ---- ppgan/models/edvr_model.py | 2 +- ppgan/version.py | 15 +++++++++++++++ setup.py | 4 +++- 7 files changed, 42 insertions(+), 10 deletions(-) create mode 100644 ppgan/version.py diff --git a/docs/en_US/install.md b/docs/en_US/install.md index 8cdac5f..91ca764 100644 --- a/docs/en_US/install.md +++ b/docs/en_US/install.md @@ -2,13 +2,13 @@ ### requirements -* PaddlePaddle >= 2.0.0 +* PaddlePaddle >= 2.1.0 * Python >= 3.6 -* CUDA >= 9.0 +* CUDA >= 10.1 ### 1. Install PaddlePaddle ``` -pip install -U paddlepaddle-gpu==2.0.0 +pip install -U paddlepaddle-gpu ``` Note: command above will install paddle with cuda10.2, if your installed cuda is different, please visit home page of [paddlepaddle](https://www.paddlepaddle.org.cn/install/quick) for more help. diff --git a/docs/zh_CN/install.md b/docs/zh_CN/install.md index 078f702..1023403 100644 --- a/docs/zh_CN/install.md +++ b/docs/zh_CN/install.md @@ -1,4 +1,21 @@ -## 安装PaddleGAN +# 安装文档 +本文档包含了如何安装PaddleGAN以及相关依赖,更多产品简介请参考[README](https://github.com/PaddlePaddle/PaddleGAN/blob/develop/README_cn.md)。 + +## 环境依赖 +- PaddlePaddle >= 2.1.0 +- Python >= 3.6 +- CUDA >= 10.1 + +## 安装PaddlePaddle + +``` +# CUDA10.1 +python -m pip install paddlepaddle-gpu==2.1.0.post101 -f https://mirror.baidu.com/pypi/simple + +# CPU +python -m pip install paddlepaddle -i https://mirror.baidu.com/pypi/simple + +``` ### 要求 diff --git a/ppgan/__init__.py b/ppgan/__init__.py index 9e83ec4..0f460a9 100644 --- a/ppgan/__init__.py +++ b/ppgan/__init__.py @@ -11,3 +11,5 @@ # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. # See the License for the specific language governing permissions and # limitations under the License. + +from .version import ppgan_version as __version__ diff --git a/ppgan/datasets/builder.py b/ppgan/datasets/builder.py index ae2369a..a192f3f 100644 --- a/ppgan/datasets/builder.py +++ b/ppgan/datasets/builder.py @@ -34,8 +34,6 @@ def build_dataloader(cfg, is_train=True, distributed=True): name = cfg_.pop('name') dataset = DATASETS.get(name)(**cfg_) - place = paddle.CUDAPlace(ParallelEnv().dev_id) \ - if ParallelEnv().nranks > 1 else paddle.CUDAPlace(0) if distributed: sampler = DistributedBatchSampler(dataset, @@ -45,7 +43,6 @@ def build_dataloader(cfg, is_train=True, distributed=True): dataloader = paddle.io.DataLoader(dataset, batch_sampler=sampler, - places=place, num_workers=num_workers, use_shared_memory=use_shared_memory) else: @@ -53,7 +50,6 @@ def build_dataloader(cfg, is_train=True, distributed=True): batch_size=batch_size, shuffle=True if is_train else False, drop_last=True if is_train else False, - places=place, use_shared_memory=False, num_workers=num_workers) diff --git a/ppgan/models/edvr_model.py b/ppgan/models/edvr_model.py index 3a3330e..86f269a 100644 --- a/ppgan/models/edvr_model.py +++ b/ppgan/models/edvr_model.py @@ -41,7 +41,7 @@ class EDVRModel(BaseSRModel): init_edvr_weight(self.nets['generator']) def setup_input(self, input): - self.lq = paddle.to_tensor(input['lq']) + self.lq = input['lq'] self.visual_items['lq'] = self.lq[:, 2, :, :, :] self.visual_items['lq-2'] = self.lq[:, 0, :, :, :] self.visual_items['lq-1'] = self.lq[:, 1, :, :, :] diff --git a/ppgan/version.py b/ppgan/version.py new file mode 100644 index 0000000..7ec66af --- /dev/null +++ b/ppgan/version.py @@ -0,0 +1,15 @@ +# Copyright (c) 2021 PaddlePaddle Authors. All Rights Reserve. +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +ppgan_version = '2.0.0' diff --git a/setup.py b/setup.py index 44c31d1..50bdb31 100644 --- a/setup.py +++ b/setup.py @@ -16,6 +16,8 @@ from setuptools import setup from setuptools import find_packages from io import open +from ppgan import __version__ + with open('requirements.txt', encoding="utf-8-sig") as f: requirements = f.readlines() @@ -32,7 +34,7 @@ setup( include_package_data=True, entry_points={"console_scripts": ["paddlegan= paddlegan.paddlegan:main"]}, author='PaddlePaddle Author', - version='2.0.0-beta', + version=__version__, install_requires=requirements, license='Apache License 2.0', description='Awesome GAN toolkits based on PaddlePaddle', -- GitLab