Skip to content

Commit

Permalink
Telemetry for keras3. (#28631)
Browse files Browse the repository at this point in the history
### Details:
 - Port of PR: #28613

### Tickets:
 - CVS-160667
  • Loading branch information
popovaan authored Jan 23, 2025
1 parent 53d698f commit f2117ea
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 1 deletion.
7 changes: 6 additions & 1 deletion tools/ovc/openvino/tools/ovc/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@

import sys
from openvino.tools.ovc.convert import convert_model
from openvino.tools.ovc.telemetry_utils import is_optimum, init_ovc_telemetry, is_torch_compile
from openvino.tools.ovc.telemetry_utils import is_optimum, init_ovc_telemetry, is_torch_compile, is_keras3

import importlib.metadata as importlib_metadata

Expand All @@ -24,3 +24,8 @@
torch_version = importlib_metadata.version("torch")
telemetry = init_ovc_telemetry("torch.compile", torch_version)
telemetry.send_event("torch.compile", "import", "Import from torch.compile(), ov_version: {}".format(get_rt_version()))

if is_keras3() and 'keras' in sys.modules:
keras_version = importlib_metadata.version("keras")
telemetry = init_ovc_telemetry("keras3", keras_version)
telemetry.send_event("keras3", "import", "Import from keras3, ov_version: {}".format(get_rt_version()))
7 changes: 7 additions & 0 deletions tools/ovc/openvino/tools/ovc/telemetry_utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,13 @@ def is_torch_compile():
return True
return False

def is_keras3():
import traceback
for line in traceback.format_stack():
if os.path.join("keras", "src", "backend", "openvino") in line:
return True
return False

def init_ovc_telemetry(app_name='OVC', app_version=None):
app_version = app_version if app_version is not None else get_rt_version()
return init_telemetry_class(tid=get_tid(),
Expand Down

0 comments on commit f2117ea

Please sign in to comment.