Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

deprecate APIs under paddle.dataset #28423

Merged
merged 1 commit into from
Nov 11, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 0 additions & 2 deletions python/paddle/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -27,8 +27,6 @@
import paddle from the source directory; please install paddlepaddle*.whl firstly.'''
)

import paddle.reader
import paddle.dataset
import paddle.batch
batch = batch.batch
from .fluid import monkey_patch_variable
Expand Down
17 changes: 2 additions & 15 deletions python/paddle/dataset/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -29,18 +29,5 @@
import paddle.dataset.voc2012
import paddle.dataset.image

__all__ = [
'mnist',
'imikolov',
'imdb',
'cifar',
'movielens',
'conll05',
'uci_housing',
'wmt14',
'wmt16',
'mq2007',
'flowers',
'voc2012',
'image',
]
# set __all__ as empty for not showing APIs under paddle.dataset
__all__ = []
21 changes: 21 additions & 0 deletions python/paddle/dataset/cifar.py
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@
import itertools
import numpy
import paddle.dataset.common
import paddle.utils.deprecated as deprecated
import tarfile
import six
from six.moves import cPickle as pickle
Expand Down Expand Up @@ -75,6 +76,10 @@ def reader():
return reader


@deprecated(
since="2.0.0",
update_to="paddle.vision.datasets.Cifar100",
reason="Please use new dataset API which supports paddle.io.DataLoader")
def train100():
"""
CIFAR-100 training set creator.
Expand All @@ -90,6 +95,10 @@ def train100():
'train')


@deprecated(
since="2.0.0",
update_to="paddle.vision.datasets.Cifar100",
reason="Please use new dataset API which supports paddle.io.DataLoader")
def test100():
"""
CIFAR-100 test set creator.
Expand All @@ -105,6 +114,10 @@ def test100():
'test')


@deprecated(
since="2.0.0",
update_to="paddle.vision.datasets.Cifar10",
reason="Please use new dataset API which supports paddle.io.DataLoader")
def train10(cycle=False):
"""
CIFAR-10 training set creator.
Expand All @@ -123,6 +136,10 @@ def train10(cycle=False):
cycle=cycle)


@deprecated(
since="2.0.0",
update_to="paddle.vision.datasets.Cifar10",
reason="Please use new dataset API which supports paddle.io.DataLoader")
def test10(cycle=False):
"""
CIFAR-10 test set creator.
Expand All @@ -141,6 +158,10 @@ def test10(cycle=False):
cycle=cycle)


@deprecated(
since="2.0.0",
update_to="paddle.vision.datasets.Cifar10",
reason="Please use new dataset API which supports paddle.io.DataLoader")
def fetch():
paddle.dataset.common.download(CIFAR10_URL, 'cifar', CIFAR10_MD5)
paddle.dataset.common.download(CIFAR100_URL, 'cifar', CIFAR100_MD5)
17 changes: 17 additions & 0 deletions python/paddle/dataset/conll05.py
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@
import itertools
import paddle.dataset.common
import paddle.compat as cpt
import paddle.utils.deprecated as deprecated
from six.moves import zip, range

__all__ = ['test, get_dict', 'get_embedding']
Expand Down Expand Up @@ -202,6 +203,10 @@ def reader():
return reader


@deprecated(
since="2.0.0",
update_to="paddle.text.datasets.Conll05st",
reason="Please use new dataset API which supports paddle.io.DataLoader")
def get_dict():
"""
Get the word, verb and label dictionary of Wikipedia corpus.
Expand All @@ -215,13 +220,21 @@ def get_dict():
return word_dict, verb_dict, label_dict


@deprecated(
since="2.0.0",
update_to="paddle.text.datasets.Conll05st",
reason="Please use new dataset API which supports paddle.io.DataLoader")
def get_embedding():
"""
Get the trained word vector based on Wikipedia corpus.
"""
return paddle.dataset.common.download(EMB_URL, 'conll05st', EMB_MD5)


@deprecated(
since="2.0.0",
update_to="paddle.text.datasets.Conll05st",
reason="Please use new dataset API which supports paddle.io.DataLoader")
def test():
"""
Conll05 test set creator.
Expand All @@ -242,6 +255,10 @@ def test():
return reader_creator(reader, word_dict, verb_dict, label_dict)


@deprecated(
since="2.0.0",
update_to="paddle.text.datasets.Conll05st",
reason="Please use new dataset API which supports paddle.io.DataLoader")
def fetch():
paddle.dataset.common.download(WORDDICT_URL, 'conll05st', WORDDICT_MD5)
paddle.dataset.common.download(VERBDICT_URL, 'conll05st', VERBDICT_MD5)
Expand Down
13 changes: 13 additions & 0 deletions python/paddle/dataset/flowers.py
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,7 @@
from paddle.dataset.image import *
from paddle.reader import map_readers, xmap_readers
from paddle import compat as cpt
import paddle.utils.deprecated as deprecated
import os
import numpy as np
from multiprocessing import cpu_count
Expand Down Expand Up @@ -143,6 +144,10 @@ def reader():
return map_readers(mapper, reader)


@deprecated(
since="2.0.0",
update_to="paddle.vision.datasets.Flowers",
reason="Please use new dataset API which supports paddle.io.DataLoader")
def train(mapper=train_mapper, buffered_size=1024, use_xmap=True, cycle=False):
'''
Create flowers training set reader.
Expand Down Expand Up @@ -172,6 +177,10 @@ def train(mapper=train_mapper, buffered_size=1024, use_xmap=True, cycle=False):
cycle=cycle)


@deprecated(
since="2.0.0",
update_to="paddle.vision.datasets.Flowers",
reason="Please use new dataset API which supports paddle.io.DataLoader")
def test(mapper=test_mapper, buffered_size=1024, use_xmap=True, cycle=False):
'''
Create flowers test set reader.
Expand Down Expand Up @@ -201,6 +210,10 @@ def test(mapper=test_mapper, buffered_size=1024, use_xmap=True, cycle=False):
cycle=cycle)


@deprecated(
since="2.0.0",
update_to="paddle.vision.datasets.Flowers",
reason="Please use new dataset API which supports paddle.io.DataLoader")
def valid(mapper=test_mapper, buffered_size=1024, use_xmap=True):
'''
Create flowers validation set reader.
Expand Down
21 changes: 21 additions & 0 deletions python/paddle/dataset/imdb.py
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@
from __future__ import print_function

import paddle.dataset.common
import paddle.utils.deprecated as deprecated
import collections
import tarfile
import re
Expand Down Expand Up @@ -76,6 +77,10 @@ def build_dict(pattern, cutoff):
return word_idx


@deprecated(
since="2.0.0",
update_to="paddle.text.datasets.Imdb",
reason="Please use new dataset API which supports paddle.io.DataLoader")
def reader_creator(pos_pattern, neg_pattern, word_idx):
UNK = word_idx['<unk>']
INS = []
Expand All @@ -94,6 +99,10 @@ def reader():
return reader


@deprecated(
since="2.0.0",
update_to="paddle.text.datasets.Imdb",
reason="Please use new dataset API which supports paddle.io.DataLoader")
def train(word_idx):
"""
IMDB training set creator.
Expand All @@ -111,6 +120,10 @@ def train(word_idx):
re.compile("aclImdb/train/neg/.*\.txt$"), word_idx)


@deprecated(
since="2.0.0",
update_to="paddle.text.datasets.Imdb",
reason="Please use new dataset API which supports paddle.io.DataLoader")
def test(word_idx):
"""
IMDB test set creator.
Expand All @@ -128,6 +141,10 @@ def test(word_idx):
re.compile("aclImdb/test/neg/.*\.txt$"), word_idx)


@deprecated(
since="2.0.0",
update_to="paddle.text.datasets.Imdb",
reason="Please use new dataset API which supports paddle.io.DataLoader")
def word_dict():
"""
Build a word dictionary from the corpus.
Expand All @@ -139,5 +156,9 @@ def word_dict():
re.compile("aclImdb/((train)|(test))/((pos)|(neg))/.*\.txt$"), 150)


@deprecated(
since="2.0.0",
update_to="paddle.text.datasets.Imdb",
reason="Please use new dataset API which supports paddle.io.DataLoader")
def fetch():
paddle.dataset.common.download(URL, 'imdb', MD5)
13 changes: 13 additions & 0 deletions python/paddle/dataset/imikolov.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@
from __future__ import print_function

import paddle.dataset.common
import paddle.utils.deprecated as deprecated
import collections
import tarfile
import six
Expand Down Expand Up @@ -111,6 +112,10 @@ def reader():
return reader


@deprecated(
since="2.0.0",
update_to="paddle.text.datasets.Imikolov",
reason="Please use new dataset API which supports paddle.io.DataLoader")
def train(word_idx, n, data_type=DataType.NGRAM):
"""
imikolov training set creator.
Expand All @@ -131,6 +136,10 @@ def train(word_idx, n, data_type=DataType.NGRAM):
data_type)


@deprecated(
since="2.0.0",
update_to="paddle.text.datasets.Imikolov",
reason="Please use new dataset API which supports paddle.io.DataLoader")
def test(word_idx, n, data_type=DataType.NGRAM):
"""
imikolov test set creator.
Expand All @@ -151,5 +160,9 @@ def test(word_idx, n, data_type=DataType.NGRAM):
data_type)


@deprecated(
since="2.0.0",
update_to="paddle.text.datasets.Imikolov",
reason="Please use new dataset API which supports paddle.io.DataLoader")
def fetch():
paddle.dataset.common.download(URL, "imikolov", MD5)
13 changes: 13 additions & 0 deletions python/paddle/dataset/mnist.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@
from __future__ import print_function

import paddle.dataset.common
import paddle.utils.deprecated as deprecated
import gzip
import numpy
import struct
Expand Down Expand Up @@ -88,6 +89,10 @@ def reader():
return reader


@deprecated(
since="2.0.0",
update_to="paddle.vision.datasets.MNIST",
reason="Please use new dataset API which supports paddle.io.DataLoader")
def train():
"""
MNIST training set creator.
Expand All @@ -105,6 +110,10 @@ def train():
TRAIN_LABEL_MD5), 100)


@deprecated(
since="2.0.0",
update_to="paddle.vision.datasets.MNIST",
reason="Please use new dataset API which supports paddle.io.DataLoader")
def test():
"""
MNIST test set creator.
Expand All @@ -121,6 +130,10 @@ def test():
100)


@deprecated(
since="2.0.0",
update_to="paddle.vision.datasets.MNIST",
reason="Please use new dataset API which supports paddle.io.DataLoader")
def fetch():
paddle.dataset.common.download(TRAIN_IMAGE_URL, 'mnist', TRAIN_IMAGE_MD5)
paddle.dataset.common.download(TRAIN_LABEL_URL, 'mnist', TRAIN_LABEL_MD5)
Expand Down
Loading