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

add deprecation warnings for keras and tfv1 support #1607

Merged
merged 1 commit into from
Jun 5, 2023
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
7 changes: 7 additions & 0 deletions src/sparseml/keras/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,13 @@

# flake8: noqa

from sparseml.utils import deprecation_warning as _deprecation_warning


_deprecation_warning(
"sparseml.keras is deprecated and will be removed in a future version",
)

from sparseml.analytics import sparseml_analytics as _analytics

from .base import *
Expand Down
7 changes: 7 additions & 0 deletions src/sparseml/tensorflow_v1/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,13 @@

# flake8: noqa

from sparseml.utils import deprecation_warning as _deprecation_warning


_deprecation_warning(
"sparseml.tensorflow_v1 is deprecated and will be removed in a future version",
)

from sparseml.analytics import sparseml_analytics as _analytics

from .base import *
Expand Down
11 changes: 11 additions & 0 deletions src/sparseml/utils/helpers.py
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@
import logging
import os
import sys
import warnings
from collections import OrderedDict
from pathlib import Path
from typing import Any, Callable, Dict, Iterable, List, Tuple, Union
Expand Down Expand Up @@ -64,6 +65,7 @@
"tensors_export",
"parse_optimization_str",
"json_to_jsonl",
"deprecation_warning",
]


Expand Down Expand Up @@ -820,3 +822,12 @@ def json_to_jsonl(json_file_path: str, overwrite: bool = True):
for json_line in json_data:
json.dump(json_line, jsonl_file) # append json line
jsonl_file.write("\n") # newline


def deprecation_warning(message: str):
warnings.simplefilter("always", DeprecationWarning)
warnings.warn(
message,
category=DeprecationWarning,
stacklevel=2,
)
Loading