Skip to content

Add deprecation warning for the functional API. #480

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

Closed
ejguan opened this issue May 31, 2022 · 6 comments
Closed

Add deprecation warning for the functional API. #480

ejguan opened this issue May 31, 2022 · 6 comments
Assignees

Comments

@ejguan
Copy link
Contributor

ejguan commented May 31, 2022

As a follow-up task, add deprecation warning for the functional API.

Originally posted by @ejguan in #479 (comment)

@ejguan ejguan self-assigned this May 31, 2022
@ejguan
Copy link
Contributor Author

ejguan commented May 31, 2022

Add a flag to indicate deprecation and add a wrapper function to the DataPipe cls constructor in https://github.com/pytorch/pytorch/blob/235f8db3d896e1c4810a2adc3c8a0996292793db/torch/utils/data/datapipes/_decorator.py#L14-L21

@NivekT
Copy link
Contributor

NivekT commented May 31, 2022

I am thinking we can add a class attribute _deprecated_functions: Set[str] and a check here to see if the method name is deprecated, and raise a warning if it is.

https://github.com/pytorch/pytorch/blob/fe67dff82abf883dfb3623757dda6dab4dd848b7/torch/utils/data/datapipes/datapipe.py#L111-L112

@ejguan
Copy link
Contributor Author

ejguan commented May 31, 2022

I am thinking we can add a class attribute _deprecated_functions: Set[str] and a check here to see if the method name is deprecated, and raise a warning if it is.

https://github.com/pytorch/pytorch/blob/fe67dff82abf883dfb3623757dda6dab4dd848b7/torch/utils/data/datapipes/datapipe.py#L111-L112

Doable, we still need to let functional_datapipe know this API is deprecating. Or, we can add a deprecating_functional_datapipe to achieve the similar functionality.

NivekT added a commit to pytorch/pytorch that referenced this issue Jun 6, 2022
…Pipe names"


Fixes pytorch/data#480.

For the list of deprecated DataPipes (or functional names), see pytorch/data#163

Testing:
```python
IterableWrapper(range(10)).open_file_by_iopath()
```
Returns:
```
/Users/.../pytorch/torch/utils/data/datapipes/utils/common.py:171: FutureWarning: `IoPathFileOpener()`'s functional API `.open_file_by_iopath()` is deprecated since 1.12 and will be removed in 1.14.
See pytorch/data#163 for details.
Please use `.open_files_by_iopath()` instead.
  warnings.warn(msg, FutureWarning)
  ```

[ghstack-poisoned]
NivekT added a commit to pytorch/pytorch that referenced this issue Jun 6, 2022
…Pipe names"


Fixes pytorch/data#480.

For the list of deprecated DataPipes (or functional names), see pytorch/data#163

Testing:
```python
IterableWrapper(range(10)).open_file_by_iopath()
```
Returns:
```
/Users/.../pytorch/torch/utils/data/datapipes/utils/common.py:171: FutureWarning: `IoPathFileOpener()`'s functional API `.open_file_by_iopath()` is deprecated since 1.12 and will be removed in 1.14.
See pytorch/data#163 for details.
Please use `.open_files_by_iopath()` instead.
  warnings.warn(msg, FutureWarning)
  ```

[ghstack-poisoned]
NivekT added a commit to pytorch/pytorch that referenced this issue Jun 6, 2022
…Pipe names"


Fixes pytorch/data#480.

For the list of deprecated DataPipes (or functional names), see pytorch/data#163

Testing:
```python
IterableWrapper(range(10)).open_file_by_iopath()
```
Returns:
```
/Users/.../pytorch/torch/utils/data/datapipes/utils/common.py:171: FutureWarning: `IoPathFileOpener()`'s functional API `.open_file_by_iopath()` is deprecated since 1.12 and will be removed in 1.14.
See pytorch/data#163 for details.
Please use `.open_files_by_iopath()` instead.
  warnings.warn(msg, FutureWarning)
  ```

[ghstack-poisoned]
@linminhtoo
Copy link

linminhtoo commented Jun 8, 2022

just to clarify, does this mean we should use the DataPipe class directly? the documentations seemed to suggest that functional form is recommended

i.e.

from my_custom_datapipes import MyDataPipe
dp = FileLister(...).filter(...)
dp = MyDataPipe(dp, **my_args)
# instead of
dp = dp.call_my_datapipe(**my_args)

@ejguan
Copy link
Contributor Author

ejguan commented Jun 8, 2022

just to clarify, does this mean we should use the DataPipe class directly? the documentations seemed to suggest that functional form is recommended

Nope. We still recommend to use functional api.

Currently, FSSpecFileOpenerIterDataPipe support two different functional apis: open_file_by_fsspec and open_files_by_fsspec. And, we are deprecating one of these apis open_file_by_fsspec

@ejguan
Copy link
Contributor Author

ejguan commented Jun 8, 2022

Closing this issue as pytorch/pytorch#78970 has landed

@ejguan ejguan closed this as completed Jun 8, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants