Skip to content
This repository was archived by the owner on Jun 3, 2025. It is now read-only.

Commit 7abe53e

Browse files
authored
add deprecation warnings for keras and tfv1 support (#1607)
1 parent c21fe6d commit 7abe53e

File tree

3 files changed

+25
-0
lines changed

3 files changed

+25
-0
lines changed

src/sparseml/keras/__init__.py

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,13 @@
1818

1919
# flake8: noqa
2020

21+
from sparseml.utils import deprecation_warning as _deprecation_warning
22+
23+
24+
_deprecation_warning(
25+
"sparseml.keras is deprecated and will be removed in a future version",
26+
)
27+
2128
from sparseml.analytics import sparseml_analytics as _analytics
2229

2330
from .base import *

src/sparseml/tensorflow_v1/__init__.py

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,13 @@
1818

1919
# flake8: noqa
2020

21+
from sparseml.utils import deprecation_warning as _deprecation_warning
22+
23+
24+
_deprecation_warning(
25+
"sparseml.tensorflow_v1 is deprecated and will be removed in a future version",
26+
)
27+
2128
from sparseml.analytics import sparseml_analytics as _analytics
2229

2330
from .base import *

src/sparseml/utils/helpers.py

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,7 @@
2323
import logging
2424
import os
2525
import sys
26+
import warnings
2627
from collections import OrderedDict
2728
from pathlib import Path
2829
from typing import Any, Callable, Dict, Iterable, List, Tuple, Union
@@ -64,6 +65,7 @@
6465
"tensors_export",
6566
"parse_optimization_str",
6667
"json_to_jsonl",
68+
"deprecation_warning",
6769
]
6870

6971

@@ -820,3 +822,12 @@ def json_to_jsonl(json_file_path: str, overwrite: bool = True):
820822
for json_line in json_data:
821823
json.dump(json_line, jsonl_file) # append json line
822824
jsonl_file.write("\n") # newline
825+
826+
827+
def deprecation_warning(message: str):
828+
warnings.simplefilter("always", DeprecationWarning)
829+
warnings.warn(
830+
message,
831+
category=DeprecationWarning,
832+
stacklevel=2,
833+
)

0 commit comments

Comments
 (0)