generated from caikit/caikit-template
-
Notifications
You must be signed in to change notification settings - Fork 4
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* Add Torch to setup reqs Signed-off-by: Alex-Brooks <Alex.Brooks@ibm.com> * Disable vit segmentation Signed-off-by: Alex-Brooks <Alex.Brooks@ibm.com> --------- Signed-off-by: Alex-Brooks <Alex.Brooks@ibm.com>
- Loading branch information
1 parent
abd7b51
commit 77cfede
Showing
5 changed files
with
51 additions
and
50 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -15,4 +15,4 @@ | |
""" | ||
|
||
# Local | ||
from .models import ViTSegmenter | ||
# from .models import ViTSegmenter |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,2 +1,2 @@ | ||
tox>=4.4.2,<5 | ||
build>=0.10.0,<2.0 | ||
build>=0.10.0,<2.0 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,43 +1,43 @@ | ||
# Copyright The Caikit Authors | ||
# | ||
# 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. | ||
# # Copyright The Caikit Authors | ||
# # | ||
# # 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. | ||
|
||
# Standard | ||
import tempfile | ||
# # Standard | ||
# import tempfile | ||
|
||
# Third Party | ||
import numpy as np | ||
# # Third Party | ||
# import numpy as np | ||
|
||
# Local | ||
from caikit_computer_vision.data_model import ImageSegmentationResult | ||
from caikit_computer_vision.modules.segmentation import ViTSegmenter | ||
from tests.fixtures import SEGMENTATION_MODEL_CKPT | ||
# # Local | ||
# from caikit_computer_vision.data_model import ImageSegmentationResult | ||
# from caikit_computer_vision.modules.segmentation import ViTSegmenter | ||
# from tests.fixtures import SEGMENTATION_MODEL_CKPT | ||
|
||
|
||
## Tests ####################################################################### | ||
def test_bootstrap_and_run(): | ||
"""Ensure that we can bootstrap a model & run inference on it.""" | ||
model = ViTSegmenter.bootstrap(SEGMENTATION_MODEL_CKPT) | ||
assert isinstance(model, ViTSegmenter) | ||
preds = model.run(np.ones((800, 800, 3), dtype=np.uint8)) | ||
assert isinstance(preds, ImageSegmentationResult) | ||
# ## Tests ####################################################################### | ||
# def test_bootstrap_and_run(): | ||
# """Ensure that we can bootstrap a model & run inference on it.""" | ||
# model = ViTSegmenter.bootstrap(SEGMENTATION_MODEL_CKPT) | ||
# assert isinstance(model, ViTSegmenter) | ||
# preds = model.run(np.ones((800, 800, 3), dtype=np.uint8)) | ||
# assert isinstance(preds, ImageSegmentationResult) | ||
|
||
|
||
def test_save_model_and_bootstrap(): | ||
"""Ensure that we can save a model and reload it.""" | ||
model = ViTSegmenter.bootstrap(SEGMENTATION_MODEL_CKPT) | ||
with tempfile.TemporaryDirectory() as model_dir: | ||
model.save(model_dir) | ||
new_model = ViTSegmenter.load(model_dir) | ||
preds = new_model.run(np.ones((800, 800, 3), dtype=np.uint8)) | ||
assert isinstance(preds, ImageSegmentationResult) | ||
# def test_save_model_and_bootstrap(): | ||
# """Ensure that we can save a model and reload it.""" | ||
# model = ViTSegmenter.bootstrap(SEGMENTATION_MODEL_CKPT) | ||
# with tempfile.TemporaryDirectory() as model_dir: | ||
# model.save(model_dir) | ||
# new_model = ViTSegmenter.load(model_dir) | ||
# preds = new_model.run(np.ones((800, 800, 3), dtype=np.uint8)) | ||
# assert isinstance(preds, ImageSegmentationResult) |