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 GA for the SparseML #1487

Merged
merged 3 commits into from
Apr 3, 2023
Merged
Show file tree
Hide file tree
Changes from 2 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
4 changes: 4 additions & 0 deletions src/sparseml/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,10 @@
save_sparsification_info,
load_sparsification_info,
)
from .analytics import sparseml_analytics as _analytics


_analytics.send_event("python.import")

try:
from sparsezoo.package import check_package_version as _check_package_version
Expand Down
23 changes: 23 additions & 0 deletions src/sparseml/analytics.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
# Copyright (c) 2021 - present / Neuralmagic, Inc. All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing,
# software distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.

from sparseml.version import version as sparseml_version
from sparsezoo.analytics import GoogleAnalytics


__all__ = ["sparseml_analytics"]


# analytics client for sparseml, to disable set NM_DISABLE_ANALYTICS=1
sparseml_analytics = GoogleAnalytics("sparseml", sparseml_version)
5 changes: 5 additions & 0 deletions src/sparseml/keras/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,11 @@

# flake8: noqa

from sparseml.analytics import sparseml_analytics as _analytics

from .base import *
from .framework import detect_framework, framework_info, is_supported
from .sparsification import sparsification_info


_analytics.send_event("keras.init")
5 changes: 5 additions & 0 deletions src/sparseml/onnx/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,12 @@

# flake8: noqa

from sparseml.analytics import sparseml_analytics as _analytics

from .base import *
from .benchmark import *
from .framework import detect_framework, framework_info, is_supported
from .sparsification import ModelInfo, get_analyzer_impls, sparsification_info


_analytics.send_event("onnx.init")
5 changes: 5 additions & 0 deletions src/sparseml/openpifpaf/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,3 +11,8 @@
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.

from sparseml.analytics import sparseml_analytics as _analytics


_analytics.send_event("openpifpaf.init")
5 changes: 5 additions & 0 deletions src/sparseml/pytorch/image_classification/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,3 +11,8 @@
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.

from sparseml.analytics import sparseml_analytics as _analytics


_analytics.send_event("python.pytorch.image_classification.init")
2 changes: 2 additions & 0 deletions src/sparseml/pytorch/optim/manager.py
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@
from torch.nn import Module
from torch.optim.optimizer import Optimizer

from sparseml.analytics import sparseml_analytics
from sparseml.optim import (
BaseManager,
add_framework_metadata,
Expand Down Expand Up @@ -303,6 +304,7 @@ def __init__(
modifiers: List[ScheduledModifier],
metadata: Optional[Dict[str, Any]] = None,
):
sparseml_analytics.send_event("python.pytorch.manager")
super().__init__(modifiers=modifiers, metadata=metadata)
self._initialize_epoch = 0

Expand Down
5 changes: 5 additions & 0 deletions src/sparseml/pytorch/torchvision/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,3 +11,8 @@
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.

from sparseml.analytics import sparseml_analytics as _analytics


_analytics.send_event("python.pytorch.torchvision.init")
5 changes: 5 additions & 0 deletions src/sparseml/tensorflow_v1/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,11 @@

# flake8: noqa

from sparseml.analytics import sparseml_analytics as _analytics

from .base import *
from .framework import detect_framework, framework_info, is_supported
from .sparsification import sparsification_info


_analytics.send_event("python.tensorflow_v1.init")
3 changes: 3 additions & 0 deletions src/sparseml/transformers/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,8 +21,11 @@
import logging as _logging

import pkg_resources
from sparseml.analytics import sparseml_analytics as _analytics


_analytics.send_event("python.transformers.init")

_EXPECTED_VERSION = "4.23.1"


Expand Down
4 changes: 4 additions & 0 deletions src/sparseml/yolact/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,10 @@
import logging as _logging
from collections import namedtuple

from sparseml.analytics import sparseml_analytics as _analytics


_analytics.send_event("python.yolact.init")

_LOGGER = _logging.getLogger(__name__)
_NM_YOLACT_LINK_TEMPLATE = (
Expand Down
4 changes: 4 additions & 0 deletions src/sparseml/yolov5/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,9 +19,13 @@

import logging as _logging

from sparseml.analytics import sparseml_analytics as _analytics

from .helpers import *


_analytics.send_event("python.yolov5.init")

try:
import yolov5 as _yolov5

Expand Down
3 changes: 3 additions & 0 deletions src/sparseml/yolov8/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,11 @@
# limitations under the License.

import ultralytics
from sparseml.analytics import sparseml_analytics as _analytics


_analytics.send_event("python.yolov8.init")

if "8.0.30" not in ultralytics.__version__:
raise ValueError(
f"ultralytics==8.0.30 is required, found {ultralytics.__version__}. "
Expand Down