Skip to content

Commit

Permalink
🚧 Start removing blocks
Browse files Browse the repository at this point in the history
Signed-off-by: Evaline Ju <[email protected]>
  • Loading branch information
evaline-ju committed May 16, 2023
1 parent db0b203 commit da827e9
Show file tree
Hide file tree
Showing 47 changed files with 225 additions and 620 deletions.
3 changes: 1 addition & 2 deletions caikit/core/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -30,8 +30,7 @@
_warnings.filterwarnings("ignore")

# Local
from . import blocks, data_model, module, module_config, resources, toolkit, workflows
from .blocks.base import BlockBase, block
from . import data_model, module, module_config, resources, toolkit, workflows
from .data_model import DataObjectBase, dataobject
from .model_manager import *
from .module import *
Expand Down
27 changes: 0 additions & 27 deletions caikit/core/blocks/__init__.py

This file was deleted.

51 changes: 0 additions & 51 deletions caikit/core/blocks/base.py

This file was deleted.

4 changes: 2 additions & 2 deletions caikit/runtime/service_generation/rpcs.py
Original file line number Diff line number Diff line change
Expand Up @@ -168,9 +168,9 @@ def _module_class_to_req_name(self) -> str:
"""Helper function to convert from the name of a module to the name of the
request RPC message
Example: self.clz._module__ = sample_lib.blocks.sample_task.sample_implementation
Example: self.clz._module__ = sample_lib.modules.sample_task.sample_implementation
return: BlocksSampleTaskSampleBlockTrainRequest
return: BlocksSampleTaskSampleModuleTrainRequest
"""
module_split = self.clz.__module__.split(".")
Expand Down
4 changes: 2 additions & 2 deletions caikit/runtime/servicers/global_train_servicer.py
Original file line number Diff line number Diff line change
Expand Up @@ -114,8 +114,8 @@ def Train(self, request, *_, **__) -> TrainingJob:

try:
with alog.ContextLog(log.debug, outer_scope_name):
# BlocksSampleTaskSampleBlockTrainRequest
# getattr(importlib.import_module("sample_lib.blocks.sample_task"), "SampleBlock")
# BlocksSampleTaskSampleModuleTrainRequest
# getattr(importlib.import_module("sample_lib.modules.sample_task"), "SampleModule")
# TODO: fixme - temporary workaround for now
desc_name = desc_name.replace("TrainRequest", "")
split = re.split("(?<=.)(?=[A-Z])", desc_name)
Expand Down
2 changes: 1 addition & 1 deletion examples/text-sentiment/models/text_sentiment/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,5 +13,5 @@
# limitations under the License.

block_id: 8f72161-c0e4-49b0-8fd0-7587b3017a35
name: HuggingFaceSentimentBlock
name: HuggingFaceSentimentModule
version: 0.0.1
Original file line number Diff line number Diff line change
Expand Up @@ -13,4 +13,4 @@
# limitations under the License.
# # Local
# Local
from .hf_block import HuggingFaceSentimentBlock
from .hf_module import HuggingFaceSentimentModule
Original file line number Diff line number Diff line change
Expand Up @@ -19,16 +19,16 @@
from transformers import pipeline

# Local
from caikit.core import BlockBase, ModuleLoader, ModuleSaver, block
from caikit.core import ModuleBase, ModuleLoader, ModuleSaver, module
from text_sentiment.data_model.classification import (
ClassificationPrediction,
ClassInfo,
TextInput,
)


@block("8f72161-c0e4-49b0-8fd0-7587b3017a35", "HuggingFaceSentimentBlock", "0.0.1")
class HuggingFaceSentimentBlock(BlockBase):
@module("8f72161-c0e4-49b0-8fd0-7587b3017a35", "HuggingFaceSentimentModule", "0.0.1")
class HuggingFaceSentimentModule(ModuleBase):
"""Class to wrap sentiment analysis pipeline from HuggingFace"""

def __init__(self, model_path) -> None:
Expand Down
13 changes: 0 additions & 13 deletions tests/core/blocks/__init__.py

This file was deleted.

Loading

0 comments on commit da827e9

Please sign in to comment.