Skip to content

Commit

Permalink
add deprecation warnings for keras and tfv1 support (#1607)
Browse files Browse the repository at this point in the history
  • Loading branch information
bfineran committed Jun 5, 2023
1 parent c21fe6d commit 7abe53e
Show file tree
Hide file tree
Showing 3 changed files with 25 additions and 0 deletions.
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,
)

0 comments on commit 7abe53e

Please sign in to comment.