Skip to content

Commit

Permalink
[tools/model_explorer_circle] Introduce circle adapter for model expl… (
Browse files Browse the repository at this point in the history
#14320)

It adds the initial version of circle adapter for model explorer.
It'll simply show a empty main graph when circle file is loaded.

ONE-DCO-1.0-Signed-off-by: Jonghwa Lee <jonghwa3.lee@samsung.com>
  • Loading branch information
batcheu authored Nov 20, 2024
1 parent 6525628 commit a4e489e
Show file tree
Hide file tree
Showing 3 changed files with 43 additions and 0 deletions.
2 changes: 2 additions & 0 deletions tools/model_explorer_circle/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
venv
src/*.egg-info/
7 changes: 7 additions & 0 deletions tools/model_explorer_circle/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
# Circle adapter for Model Explorer

Circle adapter is an extension adapter for displaying a Circle model in Model Explorer.

* [Model Explorer](https://github.com/google-ai-edge/model-explorer)
* Visulization tool for various type of model graphs such as onnx, tflite, pt2 and mlir.

34 changes: 34 additions & 0 deletions tools/model_explorer_circle/src/circle_adapter/main.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
#!/usr/bin/env python3

# Copyright (c) 2024 Samsung Electronics Co., Ltd. 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.
"""Model Explorer adapter for Circle models."""

from typing import Dict
from model_explorer import Adapter, AdapterMetadata, ModelExplorerGraphs, graph_builder


class CircleAdapter(Adapter):
"""Adapter class for Circle models."""
metadata = AdapterMetadata(id='circle-adapter',
name='Circle adapter',
description='Circle adapter!',
fileExts=['circle'])

def __init__(self):
super().__init__()

def convert(self, model_path: str, settings: Dict) -> ModelExplorerGraphs:
graph = graph_builder.Graph(id='main')
return {'graphs': [graph]}

0 comments on commit a4e489e

Please sign in to comment.