From 2ae1fbc13e34c9f085edbe23891489053072ca06 Mon Sep 17 00:00:00 2001
From: Aisuko <urakiny@gmail.com>
Date: Thu, 18 Jul 2024 05:40:54 +0000
Subject: [PATCH] remove no useful

Signed-off-by: Aisuko <urakiny@gmail.com>
---
 .vscode/settings.json                         |  13 +-
 Makefile                                      |   2 +-
 pyproject.toml                                |   2 +
 src/kimchima/__init__.py                      |  42 ---
 src/kimchima/cmds/auto_cli.py                 |  85 -----
 src/kimchima/cmds/kimchima_cli.py             |  41 ---
 src/kimchima/models/resnet18.py               |  58 ----
 src/kimchima/pkg/__init__.py                  |  38 ---
 src/kimchima/pkg/chat_template_factory.py     |  49 ---
 src/kimchima/pkg/cross_encoder_factory.py     | 301 ------------------
 src/kimchima/pkg/devices.py                   |  54 ----
 src/kimchima/pkg/embedding_factory.py         |  92 ------
 src/kimchima/pkg/logging.py                   | 190 -----------
 src/kimchima/pkg/model_factory.py             | 108 -------
 src/kimchima/pkg/pipelines_factory.py         |  90 ------
 src/kimchima/pkg/streamer_factory.py          |  87 -----
 src/kimchima/pkg/tokenizer_factory.py         |  49 ---
 .../tests/test_chat_template_factory.py       |  65 ----
 .../tests/test_cross_encoder_factory.py       |  64 ----
 src/kimchima/tests/test_devices.py            |  49 ---
 src/kimchima/tests/test_dialog.py             |  88 -----
 src/kimchima/tests/test_downloadr.py          | 102 ------
 src/kimchima/tests/test_embedding_factory.py  |  72 -----
 src/kimchima/tests/test_model_factory.py      |  54 ----
 src/kimchima/tests/test_pipelines_factory.py  | 108 -------
 src/kimchima/utils/__init__.py                |  19 --
 src/kimchima/utils/dialog.py                  | 111 -------
 src/kimchima/utils/downloader.py              | 152 ---------
 src/{kimchima/cmds => models}/__init__.py     |   0
 .../one_layer_nn.py => models/simple_nn.py}   |  29 +-
 src/{kimchima/models => tests}/__init__.py    |   0
 src/tests/test_simple_nn.py                   |   7 +
 src/{kimchima/tests => trainers}/__init__.py  |   0
 33 files changed, 35 insertions(+), 2186 deletions(-)
 delete mode 100644 src/kimchima/__init__.py
 delete mode 100644 src/kimchima/cmds/auto_cli.py
 delete mode 100644 src/kimchima/cmds/kimchima_cli.py
 delete mode 100644 src/kimchima/models/resnet18.py
 delete mode 100644 src/kimchima/pkg/__init__.py
 delete mode 100644 src/kimchima/pkg/chat_template_factory.py
 delete mode 100644 src/kimchima/pkg/cross_encoder_factory.py
 delete mode 100644 src/kimchima/pkg/devices.py
 delete mode 100644 src/kimchima/pkg/embedding_factory.py
 delete mode 100644 src/kimchima/pkg/logging.py
 delete mode 100644 src/kimchima/pkg/model_factory.py
 delete mode 100644 src/kimchima/pkg/pipelines_factory.py
 delete mode 100644 src/kimchima/pkg/streamer_factory.py
 delete mode 100644 src/kimchima/pkg/tokenizer_factory.py
 delete mode 100644 src/kimchima/tests/test_chat_template_factory.py
 delete mode 100644 src/kimchima/tests/test_cross_encoder_factory.py
 delete mode 100644 src/kimchima/tests/test_devices.py
 delete mode 100644 src/kimchima/tests/test_dialog.py
 delete mode 100644 src/kimchima/tests/test_downloadr.py
 delete mode 100644 src/kimchima/tests/test_embedding_factory.py
 delete mode 100644 src/kimchima/tests/test_model_factory.py
 delete mode 100644 src/kimchima/tests/test_pipelines_factory.py
 delete mode 100644 src/kimchima/utils/__init__.py
 delete mode 100644 src/kimchima/utils/dialog.py
 delete mode 100644 src/kimchima/utils/downloader.py
 rename src/{kimchima/cmds => models}/__init__.py (100%)
 rename src/{kimchima/models/one_layer_nn.py => models/simple_nn.py} (58%)
 rename src/{kimchima/models => tests}/__init__.py (100%)
 create mode 100644 src/tests/test_simple_nn.py
 rename src/{kimchima/tests => trainers}/__init__.py (100%)

diff --git a/.vscode/settings.json b/.vscode/settings.json
index 7b23dcd..7a230e1 100644
--- a/.vscode/settings.json
+++ b/.vscode/settings.json
@@ -1,12 +1,7 @@
 {
-    "python.testing.unittestArgs": [
-        "-v",
-        "-s",
-        "./src",
-        "-p",
-        "test_*.py"
+    "python.testing.pytestArgs": [
+        "src"
     ],
-    "python.testing.pytestEnabled": false,
-    "python.testing.unittestEnabled": true,
-    "python.analysis.typeCheckingMode": "basic"
+    "python.testing.unittestEnabled": false,
+    "python.testing.pytestEnabled": true
 }
\ No newline at end of file
diff --git a/Makefile b/Makefile
index d88015a..b20cfaf 100644
--- a/Makefile
+++ b/Makefile
@@ -43,7 +43,7 @@ lint:
 
 .PHONY: test
 test:
-	@poetry run python -m unittest discover ${TESTDIR} -v
+	@poetry run python -m pytest -v
 
 
 # build and publish
diff --git a/pyproject.toml b/pyproject.toml
index ac67d7a..7ec5f87 100644
--- a/pyproject.toml
+++ b/pyproject.toml
@@ -25,6 +25,7 @@ torch = "2.3.0"
 torchvision = "0.18.0" # https://pypi.org/project/torchvision/0.18.0/
 tensorboard = "2.17.0"
 transformers = "4.39.2"
+ruff = "0.5.2"
 
 [tool.ruff]
 # Exclude a variety of commonly ignored directories.
@@ -106,6 +107,7 @@ docstring-code-format = true
 docstring-code-line-length = "dynamic"
 
 
+
 [build-system]
 requires = ["poetry-core"]
 build-backend = "poetry.core.masonry.api"
diff --git a/src/kimchima/__init__.py b/src/kimchima/__init__.py
deleted file mode 100644
index 1d76e89..0000000
--- a/src/kimchima/__init__.py
+++ /dev/null
@@ -1,42 +0,0 @@
-# coding=utf-8
-# Copyright [2024] [Aisuko]
-# 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 kimchima.pkg import (
-    ModelFactory,
-    TokenizerFactory,
-    EmbeddingsFactory,
-    StreamerFactory,
-    PipelinesFactory,
-    ChatTemplateFactory,
-    Devices
-    )
-
-from kimchima.utils import (
-    Dialog,
-    Downloader
-    )
-
-__all__ = [
-    'CrossEncoderFactory',
-    'ModelFactory', 
-    'TokenizerFactory', 
-    'EmbeddingsFactory',
-    'StreamerFactory',
-    'Devices',
-    'PipelinesFactory',
-    'ChatTemplateFactory',
-    'Dialog',
-    'Downloader'
-    ]
diff --git a/src/kimchima/cmds/auto_cli.py b/src/kimchima/cmds/auto_cli.py
deleted file mode 100644
index 83fa3c6..0000000
--- a/src/kimchima/cmds/auto_cli.py
+++ /dev/null
@@ -1,85 +0,0 @@
-# coding=utf-8
-# Copyright (c) 2023 Aisuko
-
-# Permission is hereby granted, free of charge, to any person obtaining a copy
-# of this software and associated documentation files (the "Software"), to deal
-# in the Software without restriction, including without limitation the rights
-# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
-# copies of the Software, and to permit persons to whom the Software is
-# furnished to do so, subject to the following conditions:
-
-# The above copyright notice and this permission notice shall be included in all
-# copies or substantial portions of the Software.
-
-# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
-# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
-# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
-# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
-# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
-# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
-# SOFTWARE.
-
-from kimchima.pkg import ModelFactory, CrossEncoderFactory
-
-
-class CommandAutoModel:
-    """
-    A class for loading models.
-    """
-
-    @staticmethod
-    def auto(args):
-        """
-        Get embeddings of text.
-
-        Args:
-            args (argparse.Namespace): The arguments.
-
-        Returns:
-            torch.tensor: The embeddings of text.
-        """
-        model = ModelFactory.auto_model(pretrained_model_name_or_path=args.model_name_or_path)
-        print(model.config)
-
-class CommandCrossEncoder:
-    """
-    A class for loading models.
-    """
-
-    @staticmethod
-    def auto(args):
-        """
-        Get embeddings of text.
-
-        Args:
-            args (argparse.Namespace): The arguments.
-
-        Returns:
-            torch.tensor: The embeddings of text.
-        """
-        query = "A man is eating pasta."
-
-        # With all sentences in the corpus
-        corpus = [
-            "A man is eating food.",
-            "A man is eating a piece of bread.",
-            "The girl is carrying a baby.",
-            "A man is riding a horse.",
-            "A woman is playing violin.",
-            "Two men pushed carts through the woods.",
-            "A man is riding a white horse on an enclosed ground.",
-            "A monkey is playing drums.",
-            "A cheetah is running behind its prey.",
-        ]
-        model = CrossEncoderFactory('cross-encoder/ms-marco-MiniLM-L-6-v2')
-        sentence_combinations = [[query, sentence] for sentence in corpus]
-        scores = model.predict(sentence_combinations)
-        print(scores)
-        ranks = model.rank(query, corpus)
-
-        # Print the scores
-        print("Query:", query)
-        for rank in ranks:
-            print(f"{rank['score']:.2f}\t{corpus[rank['corpus_id']]}")
-
-
diff --git a/src/kimchima/cmds/kimchima_cli.py b/src/kimchima/cmds/kimchima_cli.py
deleted file mode 100644
index a642568..0000000
--- a/src/kimchima/cmds/kimchima_cli.py
+++ /dev/null
@@ -1,41 +0,0 @@
-# coding=utf-8
-# Copyright [2024] [Aisuko]
-# 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.
-
-import argparse
-
-from kimchima.cmds.auto_cli import CommandAutoModel
-
-
-def main():
-    """
-    Main function for kimchima.
-    """
-    parser = argparse.ArgumentParser(
-        prog="kimchima",
-        description="A command line tool for natural language processing."
-    )
-    subparsers = parser.add_subparsers(help="sub-command help")
-
-
-    parser_auto=subparsers.add_parser("auto", help="auto help")
-    parser_auto.add_argument("model_name_or_path", default="sentence-transformers/all-MiniLM-L6-v2", help="model name or path")
-    parser_auto.add_argument("text", help="text str or list of text str")
-    parser_auto.set_defaults(func=CommandAutoModel.auto)
-
-    args = parser.parse_args()
-    args.func(args)
-
-
-if __name__ == '__main__':
-    main()
\ No newline at end of file
diff --git a/src/kimchima/models/resnet18.py b/src/kimchima/models/resnet18.py
deleted file mode 100644
index 7521eda..0000000
--- a/src/kimchima/models/resnet18.py
+++ /dev/null
@@ -1,58 +0,0 @@
-# coding=utf-8
-# Copyright [2024] [SkywardAI]
-# 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.
-
-import torch
-import torchvision.datasets
-import torchvision.transforms as T
-
-
-# https://pytorch.org/tutorials/intermediate/tensorboard_profiler_tutorial.html#steps
-
-transform = T.Compose(
-    [T.Resize(224),
-     T.ToTensor(),
-     T.Normalize((0.5, 0.5, 0.5), (0.5, 0.5, 0.5))])
-
-train_set = torchvision.datasets.CIFAR10(root='./data', train=True, download=True, transform=transform)
-train_loader = torch.utils.data.DataLoader(train_set, batch_size=32, shuffle=True)
-
-# Load a pretrained model and train it with CIFAR10 dataset
-# Note: must be run on a machine with GPU
-device = torch.device("cuda")
-model = torchvision.models.resnet18(weights='IMAGENET1K_V1').cuda(device)
-criterion = torch.nn.CrossEntropyLoss().cuda(device)
-optimizer = torch.optim.SGD(model.parameters(), lr=0.001, momentum=0.9)
-model.train()
-
-def train(data):
-    inputs, labels = data[0].to(device=device), data[1].to(device=device)
-    outputs = model(inputs)
-    loss = criterion(outputs, labels)
-    optimizer.zero_grad()
-    loss.backward()
-    optimizer.step()
-
-
-with torch.profiler.profile(
-        schedule=torch.profiler.schedule(wait=1, warmup=1, active=3, repeat=1),
-        on_trace_ready=torch.profiler.tensorboard_trace_handler('./log/resnet18'),
-        record_shapes=True,
-        profile_memory=True,
-        with_stack=True
-) as prof:
-    for step, batch_data in enumerate(train_loader):
-        prof.step()  # Need to call this at each step to notify profiler of steps' boundary.
-        if step >= 1 + 1 + 3:
-            break
-        train(batch_data)
\ No newline at end of file
diff --git a/src/kimchima/pkg/__init__.py b/src/kimchima/pkg/__init__.py
deleted file mode 100644
index 32afb83..0000000
--- a/src/kimchima/pkg/__init__.py
+++ /dev/null
@@ -1,38 +0,0 @@
-# coding=utf-8
-# Copyright [2024] [SkywardAI]
-# 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.
-
-
-# We want to import extra modules only in this module, let pkg module be a tool
-# module for the kimchima package.
-
-from .model_factory import ModelFactory
-from .cross_encoder_factory import CrossEncoderFactory
-from .tokenizer_factory import TokenizerFactory
-from .embedding_factory import EmbeddingsFactory
-from .streamer_factory import StreamerFactory
-from .pipelines_factory import PipelinesFactory
-from .chat_template_factory import ChatTemplateFactory
-from .devices import Devices
-
-
-__all__ = [
-    'CrossEncoderFactory',
-    'ModelFactory', 
-    'TokenizerFactory', 
-    'EmbeddingsFactory',
-    'StreamerFactory',
-    'PipelinesFactory',
-    'ChatTemplateFactory',
-    'Devices'
-    ]
diff --git a/src/kimchima/pkg/chat_template_factory.py b/src/kimchima/pkg/chat_template_factory.py
deleted file mode 100644
index d279750..0000000
--- a/src/kimchima/pkg/chat_template_factory.py
+++ /dev/null
@@ -1,49 +0,0 @@
-# coding=utf-8
-# Copyright [2024] [SkywardAI]
-# 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 __future__ import annotations
-
-from kimchima.pkg import logging
-
-
-logger=logging.get_logger(__name__)
-
-class ChatTemplateFactory:
-    r"""
-    A factory class for creating prompt from chat Template for different ML tasks.
-    """
-
-    def __init__(self):
-        raise EnvironmentError(
-            "Chat Template is designed to be instantiated "
-        )
-
-    @classmethod
-    def prompt_generation(cls, *args,**kwargs)-> list[int]:
-        r"""
-        Create prompt by using the Huggingface Transformers library.
-        """
-        messages=kwargs.pop("messages", None)
-        if messages is None:
-            raise ValueError("messages is required")
-        tokenizer=kwargs.pop("tokenizer", None)
-        if tokenizer is None:
-            raise ValueError("tokenizer is required")
-
-        tokenize=kwargs.pop("tokenize", False)
-        add_generation_prompt=kwargs.pop("add_generation_prompt", False)
-
-        tokenized_chat  = tokenizer.apply_chat_template(messages, tokenize=tokenize, add_generation_prompt=add_generation_prompt)
-
-        return tokenized_chat
diff --git a/src/kimchima/pkg/cross_encoder_factory.py b/src/kimchima/pkg/cross_encoder_factory.py
deleted file mode 100644
index 6162c71..0000000
--- a/src/kimchima/pkg/cross_encoder_factory.py
+++ /dev/null
@@ -1,301 +0,0 @@
-# coding=utf-8
-# Copyright [2024] [SkywardAI]
-# 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 transformers import AutoModelForSequenceClassification, AutoTokenizer, AutoConfig
-import numpy as np
-from kimchima.pkg import logging
-import platform
-from typing import Dict, List, Optional
-import torch
-from torch import nn
-from torch.utils.data import DataLoader
-from tqdm.autonotebook import tqdm
-from transformers.utils import PushToHubMixin
-
-
-logger=logging.get_logger(__name__)
-
-"""
-Original code from: https://github.com/UKPLab/sentence-transformers/blob/master/sentence_transformers/cross_encoder/CrossEncoder.py
-Adapted by: Rob Zhang
-Date: 20240523
-"""
-
-class CrossEncoderFactory(PushToHubMixin):
-    """
-    A CrossEncoder takes exactly two sentences / texts as input and either predicts
-    a score or label for this sentence pair. It can for example predict the similarity of the sentence pair
-    on a scale of 0 ... 1.
-
-    It does not yield a sentence embedding and does not work for individual sentences.
-
-    :param model_name: A model name from Hugging Face Hub that can be loaded with AutoModel, or a path to a local
-        model. We provide several pre-trained CrossEncoder models that can be used for common tasks.
-    :param num_labels: Number of labels of the classifier. If 1, the CrossEncoder is a regression model that
-        outputs a continuous score 0...1. If > 1, it output several scores that can be soft-maxed to get
-        probability scores for the different classes.
-    :param max_length: Max length for input sequences. Longer sequences will be truncated. If None, max
-        length of the model will be used
-    :param device: Device that should be used for the model. If None, it will use CUDA if available.
-    :param tokenizer_args: Arguments passed to AutoTokenizer
-    :param automodel_args: Arguments passed to AutoModelForSequenceClassification
-    :param trust_remote_code: Whether or not to allow for custom models defined on the Hub in their own modeling files.
-        This option should only be set to True for repositories you trust and in which you have read the code, as it
-        will execute code present on the Hub on your local machine.
-    :param revision: The specific model version to use. It can be a branch name, a tag name, or a commit id,
-        for a stored model on Hugging Face.
-    :param local_files_only: If `True`, avoid downloading the model.
-    :param default_activation_function: Callable (like nn.Sigmoid) about the default activation function that
-        should be used on-top of model.predict(). If None. nn.Sigmoid() will be used if num_labels=1,
-        else nn.Identity()
-    :param classifier_dropout: The dropout ratio for the classification head.
-    """
-
-    def __init__(
-        self,
-        model_name: str,
-        num_labels: int = None,
-        max_length: int = None,
-        device: str = None,
-        tokenizer_args: Dict = {},
-        automodel_args: Dict = {},
-        trust_remote_code: bool = False,
-        revision: Optional[str] = None,
-        local_files_only: bool = False,
-        classifier_dropout: float = None,
-    ):
-        self.config = AutoConfig.from_pretrained(
-            model_name, trust_remote_code=trust_remote_code, revision=revision, local_files_only=local_files_only
-        )
-        classifier_trained = True
-        if self.config.architectures is not None:
-            classifier_trained = any(
-                [arch.endswith("ForSequenceClassification") for arch in self.config.architectures]
-            )
-
-        if classifier_dropout is not None:
-            self.config.classifier_dropout = classifier_dropout
-
-        if num_labels is None and not classifier_trained:
-            num_labels = 1
-
-        if num_labels is not None:
-            self.config.num_labels = num_labels
-        self.model = AutoModelForSequenceClassification.from_pretrained(
-            model_name,
-            config=self.config,
-            revision=revision,
-            trust_remote_code=trust_remote_code,
-            local_files_only=local_files_only,
-            **automodel_args,
-        )
-        self.tokenizer = AutoTokenizer.from_pretrained(
-            model_name,
-            revision=revision,
-            local_files_only=local_files_only,
-            trust_remote_code=trust_remote_code,
-            **tokenizer_args,
-        )
-        self.max_length = max_length
-
-        if device is None:
-            if platform.system() == 'Darwin':
-                device='mps'
-            elif torch.cuda.is_available():
-                device='cuda'
-            else:
-                device='cpu'
-            logger.info("Use pytorch device: {}".format(device))
-
-        self._target_device = torch.device(device)
-
-        self.default_activation_function = nn.Sigmoid() if self.config.num_labels == 1 else nn.Identity()
-
-    def _smart_batching_collate_text_only(self, batch):
-        texts = [[] for _ in range(len(batch[0]))]
-
-        for example in batch:
-            for idx, text in enumerate(example):
-                texts[idx].append(text.strip())
-
-        tokenized = self.tokenizer(
-            *texts, padding=True, truncation="longest_first", return_tensors="pt", max_length=self.max_length
-        )
-
-        for name in tokenized:
-            tokenized[name] = tokenized[name].to(self._target_device)
-
-        return tokenized
-
-    def predict(
-        self,
-        sentences: List[List[str]],
-        batch_size: int = 32,
-        show_progress_bar: bool = None,
-        num_workers: int = 0,
-        activation_fct=None,
-        apply_softmax=False,
-        convert_to_numpy: bool = True,
-        convert_to_tensor: bool = False,
-    ):
-        """
-        Performs predicts with the CrossEncoder on the given sentence pairs.
-
-        :param sentences: A list of sentence pairs [[Sent1, Sent2], [Sent3, Sent4]]
-        :param batch_size: Batch size for encoding
-        :param show_progress_bar: Output progress bar
-        :param num_workers: Number of workers for tokenization
-        :param activation_fct: Activation function applied on the logits output of the CrossEncoder. If None, nn.Sigmoid() will be used if num_labels=1, else nn.Identity
-        :param convert_to_numpy: Convert the output to a numpy matrix.
-        :param apply_softmax: If there are more than 2 dimensions and apply_softmax=True, applies softmax on the logits output
-        :param convert_to_tensor: Convert the output to a tensor.
-        :return: Predictions for the passed sentence pairs
-        """
-        input_was_string = False
-        if isinstance(sentences[0], str):  # Cast an individual sentence to a list with length 1
-            sentences = [sentences]
-            input_was_string = True
-
-        inp_dataloader = DataLoader(
-            sentences,
-            batch_size=batch_size,
-            collate_fn=self._smart_batching_collate_text_only,
-            num_workers=num_workers,
-            shuffle=False,
-        )
-
-        if show_progress_bar is None:
-            show_progress_bar = (
-                logger.getEffectiveLevel() == logging.INFO or logger.getEffectiveLevel() == logging.DEBUG
-            )
-
-        iterator = inp_dataloader
-        if show_progress_bar:
-            iterator = tqdm(inp_dataloader, desc="Batches")
-
-        if activation_fct is None:
-            activation_fct = self.default_activation_function
-
-        pred_scores = []
-        self.model.eval()
-        self.model.to(self._target_device)
-        with torch.no_grad():
-            for features in iterator:
-                model_predictions = self.model(**features, return_dict=True)
-                logits = activation_fct(model_predictions.logits)
-
-                if apply_softmax and len(logits[0]) > 1:
-                    logits = torch.nn.functional.softmax(logits, dim=1)
-                pred_scores.extend(logits)
-
-        if self.config.num_labels == 1:
-            pred_scores = [score[0] for score in pred_scores]
-
-        if convert_to_tensor:
-            pred_scores = torch.stack(pred_scores)
-        elif convert_to_numpy:
-            pred_scores = np.asarray([score.cpu().detach().numpy() for score in pred_scores])
-
-        if input_was_string:
-            pred_scores = pred_scores[0]
-
-        return pred_scores
-
-    def rank(
-        self,
-        query: str,
-        documents: List[str],
-        top_k: Optional[int] = None,
-        return_documents: bool = False,
-        batch_size: int = 32,
-        show_progress_bar: bool = None,
-        num_workers: int = 0,
-        activation_fct=None,
-        apply_softmax=False,
-        convert_to_numpy: bool = True,
-        convert_to_tensor: bool = False,
-    ) -> List[Dict]:
-        """
-        Performs ranking with the CrossEncoder on the given query and documents. Returns a sorted list with the document indices and scores.
-
-        Example:
-            ::
-
-                from sentence_transformers import CrossEncoder
-                model = CrossEncoder("cross-encoder/ms-marco-MiniLM-L-6-v2")
-
-                query = "Who wrote 'To Kill a Mockingbird'?"
-                documents = [
-                    "'To Kill a Mockingbird' is a novel by Harper Lee published in 1960. It was immediately successful, winning the Pulitzer Prize, and has become a classic of modern American literature.",
-                    "The novel 'Moby-Dick' was written by Herman Melville and first published in 1851. It is considered a masterpiece of American literature and deals with complex themes of obsession, revenge, and the conflict between good and evil.",
-                    "Harper Lee, an American novelist widely known for her novel 'To Kill a Mockingbird', was born in 1926 in Monroeville, Alabama. She received the Pulitzer Prize for Fiction in 1961.",
-                    "Jane Austen was an English novelist known primarily for her six major novels, which interpret, critique and comment upon the British landed gentry at the end of the 18th century.",
-                    "The 'Harry Potter' series, which consists of seven fantasy novels written by British author J.K. Rowling, is among the most popular and critically acclaimed books of the modern era.",
-                    "'The Great Gatsby', a novel written by American author F. Scott Fitzgerald, was published in 1925. The story is set in the Jazz Age and follows the life of millionaire Jay Gatsby and his pursuit of Daisy Buchanan."
-                ]
-
-                model.rank(query, documents, return_documents=True)
-
-            ::
-
-                [{'corpus_id': 0,
-                'score': 10.67858,
-                'text': "'To Kill a Mockingbird' is a novel by Harper Lee published in 1960. It was immediately successful, winning the Pulitzer Prize, and has become a classic of modern American literature."},
-                {'corpus_id': 2,
-                'score': 9.761677,
-                'text': "Harper Lee, an American novelist widely known for her novel 'To Kill a Mockingbird', was born in 1926 in Monroeville, Alabama. She received the Pulitzer Prize for Fiction in 1961."},
-                {'corpus_id': 1,
-                'score': -3.3099542,
-                'text': "The novel 'Moby-Dick' was written by Herman Melville and first published in 1851. It is considered a masterpiece of American literature and deals with complex themes of obsession, revenge, and the conflict between good and evil."},
-                {'corpus_id': 5,
-                'score': -4.8989105,
-                'text': "'The Great Gatsby', a novel written by American author F. Scott Fitzgerald, was published in 1925. The story is set in the Jazz Age and follows the life of millionaire Jay Gatsby and his pursuit of Daisy Buchanan."},
-                {'corpus_id': 4,
-                'score': -5.082967,
-                'text': "The 'Harry Potter' series, which consists of seven fantasy novels written by British author J.K. Rowling, is among the most popular and critically acclaimed books of the modern era."}]
-
-        :param query: A single query
-        :param documents: A list of documents
-        :param top_k: Return the top-k documents. If None, all documents are returned.
-        :param return_documents: If True, also returns the documents. If False, only returns the indices and scores.
-        :param batch_size: Batch size for encoding
-        :param show_progress_bar: Output progress bar
-        :param num_workers: Number of workers for tokenization
-        :param activation_fct: Activation function applied on the logits output of the CrossEncoder. If None, nn.Sigmoid() will be used if num_labels=1, else nn.Identity
-        :param convert_to_numpy: Convert the output to a numpy matrix.
-        :param apply_softmax: If there are more than 2 dimensions and apply_softmax=True, applies softmax on the logits output
-        :param convert_to_tensor: Convert the output to a tensor.
-        :return: A sorted list with the document indices and scores, and optionally also documents.
-        """
-        query_doc_pairs = [[query, doc] for doc in documents]
-        scores = self.predict(
-            query_doc_pairs,
-            batch_size=batch_size,
-            show_progress_bar=show_progress_bar,
-            num_workers=num_workers,
-            activation_fct=activation_fct,
-            apply_softmax=apply_softmax,
-            convert_to_numpy=convert_to_numpy,
-            convert_to_tensor=convert_to_tensor,
-        )
-
-        results = []
-        for i in range(len(scores)):
-            if return_documents:
-                results.append({"corpus_id": i, "score": scores[i], "text": documents[i]})
-            else:
-                results.append({"corpus_id": i, "score": scores[i]})
-
-        results = sorted(results, key=lambda x: x["score"], reverse=True)
-        return results[:top_k]
diff --git a/src/kimchima/pkg/devices.py b/src/kimchima/pkg/devices.py
deleted file mode 100644
index 040454b..0000000
--- a/src/kimchima/pkg/devices.py
+++ /dev/null
@@ -1,54 +0,0 @@
-# coding=utf-8
-# Copyright [2024] [SkywardAI]
-# 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 __future__ import annotations
-
-from enum import Enum
-import torch
-import platform
-
-from typing import Tuple
-
-
-class Devices(Enum):
-    Silicon = 'mps'
-    CPU = 'cpu'
-    # only Nvidia GPU is supported currently
-    GPU = 'cuda'
-
-
-    @classmethod
-    def get_device(cls)-> Devices:
-        r"""
-        Only support Single GPU for now
-        """
-        if platform.system() == 'Darwin':
-            return Devices.Silicon
-        elif torch.cuda.is_available():
-            return Devices.GPU
-        return Devices.CPU
-
-    @classmethod
-    def get_capability(cls)-> Tuple[int, int]:
-        r"""
-        Get the capability of the device(GPU) for current env, this is used for support latest quantization techniques like: Marlin
-        
-        Returns:
-            tuple: The capability of the device(GPU) for current env.
-
-        For not GPU env, return (0, 0)
-        """
-        if cls.get_device() == Devices.GPU:
-            return torch.cuda.get_device_capability()
-        return (0, 0)
diff --git a/src/kimchima/pkg/embedding_factory.py b/src/kimchima/pkg/embedding_factory.py
deleted file mode 100644
index 5a159b4..0000000
--- a/src/kimchima/pkg/embedding_factory.py
+++ /dev/null
@@ -1,92 +0,0 @@
-# coding=utf-8
-# Copyright [2024] [SkywardAI]
-# 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 __future__ import annotations
-
-import torch
-import torch.nn.functional as F
-from kimchima.pkg import logging
-
-
-logger = logging.get_logger(__name__)
-
-
-class EmbeddingsFactory:
-    r"""
-
-    Embeddings class to get embeddings from the specified model and tokenizer.
-    The embeddings mean pooling is used to get the embeddings from the model,
-    and the embeddings are normalized using L2 normalization.
-
-    Args:
-        pretrained_model_name_or_path: pretrained model name or path
-
-    Returns:
-        sentence_embeddings: sentence embeddings type torch.Tensor
-
-    """
-
-    def __init__(self):
-        raise EnvironmentError(
-            "Embeddings is designed to be instantiated "
-        )
-
-
-    @classmethod
-    def get_text_embeddings(cls, *args, **kwargs)-> torch.Tensor:
-        r"""
-        Get embeddings from the model.
-
-        Args:
-            prompt: prompt text
-            device: device to run the model
-            max_length: maximum length of the input text
-        """
-        model=kwargs.pop('model', None)
-        tokenizer=kwargs.pop('tokenizer', None)
-        prompt = kwargs.pop('prompt', None)
-        device = kwargs.pop('device', 'cpu')
-        max_length = kwargs.pop('max_length', 512)
-
-
-        inputs_ids = tokenizer(prompt, return_tensors='pt',max_length=max_length, padding=True, truncation=True).to(device)
-
-        model=model.to(device)
-        with torch.no_grad():
-            output = model(**inputs_ids)
-
-        embeddings=cls.mean_pooling(model_output=output, attention_mask=inputs_ids['attention_mask'])
-        logger.debug(f"Embedding mean pooling: {embeddings.shape}")
-
-        # Normalize embeddings
-        sentence_embeddings = F.normalize(embeddings, p=2, dim=1)
-
-        return sentence_embeddings
-
-
-    @classmethod
-    #Mean Pooling - Take attention mask into account for correct averaging
-    def mean_pooling(cls, **kwargs) -> torch.Tensor:
-        r"""
-        Mean Pooling - Take attention mask into account for correct averaging.
-
-        Args:
-            model_output: model output
-            attention_mask: attention mask
-        """
-        model_output = kwargs.get('model_output')
-        attention_mask = kwargs.get('attention_mask')
-        token_embeddings = model_output[0] #First element of model_output contains all token embeddings
-        input_mask_expanded = attention_mask.unsqueeze(-1).expand(token_embeddings.size()).float()
-        return torch.sum(token_embeddings * input_mask_expanded, 1) / torch.clamp(input_mask_expanded.sum(1), min=1e-9)
diff --git a/src/kimchima/pkg/logging.py b/src/kimchima/pkg/logging.py
deleted file mode 100644
index 5c7ccf9..0000000
--- a/src/kimchima/pkg/logging.py
+++ /dev/null
@@ -1,190 +0,0 @@
-# coding=utf-8
-# Copyright [2024] [Aisuko]
-# 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.
-
-# The original code in Huggingface Transformers library is licensed under the Apache 2.0 license.
-# Adaptor: Aisuko
-# TODO: Will tweak the code to fit the Kimchima library
-
-from __future__ import annotations
-
-import logging
-import os
-import sys
-import threading
-
-from logging import (
-    CRITICAL,  # NOQA
-    DEBUG,  # NOQA
-    ERROR,  # NOQA
-    FATAL,  # NOQA
-    INFO,  # NOQA
-    NOTSET,  # NOQA
-    WARN,  # NOQA
-    WARNING,  # NOQA
-)
-
-from typing import Optional
-
-_lock = threading.Lock()
-_default_handler: Optional[logging.Handler] = None
-
-log_levels = {
-    "detail": logging.DEBUG,  # will also print filename and line number
-    "debug": logging.DEBUG,
-    "info": logging.INFO,
-    "warning": logging.WARNING,
-    "error": logging.ERROR,
-    "critical": logging.CRITICAL,
-}
-
-_default_log_level = logging.WARNING
-
-
-def _get_default_logging_level():
-    """
-    If KIMCHIMA_VERBOSITY env var is set to one of the valid choices return that as the new default level. If it is
-    not - fall back to `_default_log_level`
-    """
-    env_level_str = os.getenv("KIMCHIMA_VERBOSITY", None)
-    if env_level_str:
-        if env_level_str in log_levels:
-            return log_levels[env_level_str]
-        else:
-            logging.getLogger().warning(
-                f"Unknown option KIMCHIMA_VERBOSITY={env_level_str}, "
-                f"has to be one of: { ', '.join(log_levels.keys()) }"
-            )
-    return _default_log_level
-
-
-def _get_library_name() -> str:
-    return __name__.split(".")[0]
-
-
-def _get_library_root_logger() -> logging.Logger:
-    return logging.getLogger(_get_library_name())
-
-
-def _configure_library_root_logger() -> None:
-    global _default_handler
-
-    with _lock:
-        if _default_handler:
-            # This library has already configured the library root logger.
-            return
-        _default_handler = logging.StreamHandler()  # Set sys.stderr as stream.
-        # set defaults based on https://github.com/pyinstaller/pyinstaller/issues/7334#issuecomment-1357447176
-        if sys.stderr is None:
-            sys.stderr = open(os.devnull, "w")
-
-        _default_handler.flush = sys.stderr.flush
-
-        # Apply our default configuration to the library root logger.
-        library_root_logger = _get_library_root_logger()
-        library_root_logger.addHandler(_default_handler)
-        library_root_logger.setLevel(_get_default_logging_level())
-        # if logging level is debug, we add pathname and lineno to formatter for easy debugging
-        if os.getenv("KIMCHIMA_VERBOSITY", None) == "detail":
-            formatter = logging.Formatter("[%(levelname)s|%(pathname)s:%(lineno)s] %(asctime)s >> %(message)s")
-            _default_handler.setFormatter(formatter)
-
-        library_root_logger.propagate = False
-    
-def _reset_library_root_logger() -> None:
-    global _default_handler
-
-    with _lock:
-        if not _default_handler:
-            return
-
-        library_root_logger = _get_library_root_logger()
-        library_root_logger.removeHandler(_default_handler)
-        library_root_logger.setLevel(logging.NOTSET)
-        _default_handler = None
-    
-def get_log_levels_dict():
-    return log_levels
-
-def get_logger(name: Optional[str] = None) -> logging.Logger:
-    """
-    Return a logger with the specified name.
-    """
-
-    if name is None:
-        name = _get_library_name()
-
-    _configure_library_root_logger()
-    return logging.getLogger(name)
-
-
-def get_verbosity() -> int:
-    """
-    Return the current level for the Kimchima's root logger as an int.
-
-    Returns:
-        `int`: The logging level.
-
-    <Tip>
-
-    Kimchima has following logging levels:
-
-    - 50: `kimchima.logging.CRITICAL` or `kimchima.logging.FATAL`
-    - 40: `kimchima.logging.ERROR`
-    - 30: `kimchima.logging.WARNING` or `kimchima.logging.WARN`
-    - 20: `kimchima.logging.INFO`
-    - 10: `kimchima.logging.DEBUG`
-
-    </Tip>"""
-
-    _configure_library_root_logger()
-    return _get_library_root_logger().getEffectiveLevel()
-
-
-def set_verbosity(verbosity: int) -> None:
-    """
-    Set the verbosity level for the Kimchima's root logger.
-
-    Args:
-        verbosity (`int`):
-            Logging level, e.g., one of:
-
-            - `kimchima.logging.CRITICAL` or `kimchima.logging.FATAL`
-            - `kimchima.logging.ERROR`
-            - `kimchima.logging.WARNING` or `kimchima.logging.WARN`
-            - `kimchima.logging.INFO`
-            - `kimchima.logging.DEBUG`
-    """
-
-    _configure_library_root_logger()
-    _get_library_root_logger().setLevel(verbosity)
-
-def set_verbosity_info():
-    """Set the verbosity to the `INFO` level."""
-    return set_verbosity(INFO)
-
-
-def set_verbosity_warning():
-    """Set the verbosity to the `WARNING` level."""
-    return set_verbosity(WARNING)
-
-
-def set_verbosity_debug():
-    """Set the verbosity to the `DEBUG` level."""
-    return set_verbosity(DEBUG)
-
-
-def set_verbosity_error():
-    """Set the verbosity to the `ERROR` level."""
-    return set_verbosity(ERROR)
-
diff --git a/src/kimchima/pkg/model_factory.py b/src/kimchima/pkg/model_factory.py
deleted file mode 100644
index f69555f..0000000
--- a/src/kimchima/pkg/model_factory.py
+++ /dev/null
@@ -1,108 +0,0 @@
-# coding=utf-8
-# Copyright [2024] [SkywardAI]
-# 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 __future__ import annotations
-
-from functools import lru_cache
-from kimchima.pkg import logging
-
-from transformers import (
-    AutoModel, 
-    AutoModelForCausalLM,
-    AutoModelForSeq2SeqLM
-    )
-
-
-
-logger = logging.get_logger(__name__)
-
-
-class ModelFactory:
-    r"""
-    ModelFactory class to get the model from the specified model.
-
-    Args:
-        pretrained_model_name_or_path: pretrained model name or path
-    """
-    def __init__(self):
-        raise EnvironmentError(
-            "ModelFactory is designed to be instantiated "
-        )
-
-    @classmethod
-    @lru_cache(maxsize=1)                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                
-    def auto_model(cls, *args, **kwargs)-> AutoModel:
-        r"""
-        Here we will use AutoModel from Huggingface to load the model form local.
-        It support a wider range of models beyond causal language models,
-        like BERT, RoBERTa, BART, T5 and more.
-
-        It returns the base model without a specific head, it does not directly
-        perform tasks like text generation or translation.
-
-        """
-        pretrained_model_name_or_path=kwargs.pop("pretrained_model_name_or_path", None)
-        if pretrained_model_name_or_path is None:
-            raise ValueError("pretrained_model_name_or_path cannot be None")
-
-        model = AutoModel.from_pretrained(
-            pretrained_model_name_or_path,
-            **kwargs
-        )
-        logger.debug(f"Loaded model: {pretrained_model_name_or_path}")
-        return model
-    
-    @classmethod
-    @lru_cache(maxsize=1)
-    def auto_model_for_causal_lm(cls, *args, **kwargs)-> AutoModelForCausalLM:
-        r"""
-        Here we will use AutoModelForCausalLM to load the model from local,
-        Like GPT-2 XLNet etc. 
-        It return a language modeling head which can be used to generate text,
-        translate text, write content, answer questions in a informative way.
-        """
-        pretrained_model_name_or_path=kwargs.pop("pretrained_model_name_or_path", None)
-        if pretrained_model_name_or_path is None:
-            raise ValueError("pretrained_model_name_or_path cannot be None")
-
-        model = AutoModelForCausalLM.from_pretrained(
-            pretrained_model_name_or_path,
-            **kwargs
-        )
-        logger.debug(f"Loaded model: {pretrained_model_name_or_path}")
-        return model
-
-
-    @classmethod
-    @lru_cache(maxsize=1)
-    def model_for_seq2seq(cls, *args, **kwargs)-> AutoModelForSeq2SeqLM:
-        r"""
-        Here we will use AutoModelForSeq2SeqLM to load the model from local,
-        Like BART, T5 etc. 
-        It return a sequence-to-sequence model which can be used to generate text,
-        translate text, write content, answer questions in a informative way.
-
-        Args:
-            * pretrained_model_name_or_path: str: pretrained model name or path
-        """
-        pretrained_model_name_or_path=kwargs.pop("pretrained_model_name_or_path", None)
-        if pretrained_model_name_or_path is None:
-            raise ValueError("pretrained_model_name_or_path cannot be None")
-
-        model = AutoModelForSeq2SeqLM.from_pretrained(
-            pretrained_model_name_or_path,
-            **kwargs
-        )
-        logger.debug(f"Loaded model: {pretrained_model_name_or_path}")
-        return model
diff --git a/src/kimchima/pkg/pipelines_factory.py b/src/kimchima/pkg/pipelines_factory.py
deleted file mode 100644
index c95d4ee..0000000
--- a/src/kimchima/pkg/pipelines_factory.py
+++ /dev/null
@@ -1,90 +0,0 @@
-# coding=utf-8
-# Copyright [2024] [SkywardAI]
-# 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 __future__ import annotations
-
-from functools import lru_cache
-from kimchima.pkg import logging
-
-from transformers import pipeline, Conversation
-
-logger=logging.get_logger(__name__)
-
-
-class PipelinesFactory:
-    r"""
-    A factory class for creating Huggingface Transformers pipelines for different ML tasks.
-    """
-
-    def __init__(self):
-        raise EnvironmentError(
-            "Pipelines is designed to be instantiated "
-            "using the `Pipelines.from_pretrained(pretrained_model_name_or_path)` method."
-        )
-
-    @classmethod
-    @lru_cache(maxsize=1)
-    def text_generation(cls, *args,**kwargs)-> pipeline:
-        r"""
-        Create a text generation pipeline using the Huggingface Transformers library.
-        """
-        
-        model=kwargs.pop("model", None)
-        if model is None:
-            raise ValueError("model is required")
-        tokenizer=kwargs.pop("tokenizer", None)
-        if tokenizer is None:
-            raise ValueError("tokenizer is required")
-        streamer=kwargs.pop("text_streamer", None)
-        max_new_tokens=kwargs.pop("max_new_tokens", 20)
-        
-        #
-        pipe=pipeline(
-            task="text-generation",
-            model=model,
-            tokenizer=tokenizer,
-            streamer=streamer,
-            max_new_tokens=max_new_tokens,
-            **kwargs
-        )
-
-        logger.debug(f"The text generation pipeline device is {pipe.device}")
-
-        return pipe
-    
-    @classmethod
-    def customized_pipe(cls, *args,**kwargs)-> pipeline:
-        r"""
-        Create a customized pipeline using the Huggingface Transformers library.
-        With any param which is allowd in the pipeline function.
-        """
-        
-        #
-        pipe=pipeline(
-            **kwargs
-        )
-        return pipe
-
-    @classmethod
-    def init_conversation (cls, *args,**kwargs)-> Conversation:
-        r"""
-        Create a Conversation using the Huggingface Transformers library.
-        """
-        
-        #
-        con=Conversation(
-            **kwargs
-        )
-        return con
-
diff --git a/src/kimchima/pkg/streamer_factory.py b/src/kimchima/pkg/streamer_factory.py
deleted file mode 100644
index 4668e86..0000000
--- a/src/kimchima/pkg/streamer_factory.py
+++ /dev/null
@@ -1,87 +0,0 @@
-# coding=utf-8
-# Copyright [2024] [SkywardAI]
-# 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 __future__ import annotations
-
-from functools import lru_cache
-from kimchima.pkg import logging
-
-from transformers import (
-    TextStreamer,
-    TextIteratorStreamer
-    )
-
-logger = logging.get_logger(__name__)
-
-class StreamerFactory:
-    r"""
-    StreamerFactory class to create Huggingface Transformers Streamer for different ML tasks.
-    """
-
-    def __init__(self):
-        raise EnvironmentError(
-            "StreamerFactory is designed to be instantiated "
-        )
-    
-    @classmethod
-    @lru_cache(maxsize=1)
-    def text_streamer(cls, *args, **kwargs)-> TextStreamer:
-        r"""
-        Get streamer for text generation task.
-
-        Args:
-            skip_prompt: skip prompt
-            skip_prompt_tokens: skip prompt tokens
-        """
-        #TODO support more parameters
-        tokenizer=kwargs.pop('tokenizer', None)
-        if tokenizer is None:
-            raise ValueError("tokenizer is required")
-        skip_prompt=kwargs.pop('skip_prompt', False)
-        skip_prompt_tokens=kwargs.pop('skip_prompt_tokens', False)
-
-        streamer=TextStreamer(
-            tokenizer=tokenizer,
-            skip_prompt=skip_prompt,
-            skip_prompt_tokens=skip_prompt_tokens
-            )
-        logger.info("TextStreamer created")
-
-        return streamer
-    
-    @classmethod
-    @lru_cache(maxsize=1)
-    def text_iterator_streamer(cls, *args, **kwargs)-> TextIteratorStreamer:
-        r"""
-        Get streamer for text generation task.
-
-        Args:
-            skip_prompt: skip prompt
-            skip_prompt_tokens: skip prompt tokens
-        """
-        #TODO support more parameters
-        tokenizer=kwargs.pop('tokenizer', None)
-        if tokenizer is None:
-            raise ValueError("tokenizer is required")
-        skip_prompt=kwargs.pop('skip_prompt', False)
-        skip_prompt_tokens=kwargs.pop('skip_prompt_tokens', False)
-
-        streamer=TextIteratorStreamer(
-            tokenizer=tokenizer,
-            skip_prompt=skip_prompt,
-            skip_prompt_tokens=skip_prompt_tokens
-            )
-        logger.info("TextIteratorStreamer created")
-
-        return streamer
diff --git a/src/kimchima/pkg/tokenizer_factory.py b/src/kimchima/pkg/tokenizer_factory.py
deleted file mode 100644
index 0d1631a..0000000
--- a/src/kimchima/pkg/tokenizer_factory.py
+++ /dev/null
@@ -1,49 +0,0 @@
-# coding=utf-8
-# Copyright [2024] [SkywardAI]
-# 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 __future__ import annotations
-
-from functools import lru_cache
-from transformers import AutoTokenizer
-from kimchima.pkg import logging
-
-logger = logging.get_logger(__name__)
-
-
-class TokenizerFactory:
-    r"""
-
-    TokenizerFactory class to get the tokenizer from the specified model.
-    
-    Args:
-        pretrained_model_name_or_path: pretrained model name or path
-
-    """
-    def __init__(self):
-        raise EnvironmentError(
-            "TokenizerFactory is designed to be instantiated "
-        )
-
-    @classmethod
-    @lru_cache(maxsize=1)
-    def auto_tokenizer(cls, pretrained_model_name_or_path, **kwargs)-> AutoTokenizer:
-        r"""
-        Create a tokenizer using the Huggingface Transformers AutoTokenizer class.
-        """
-        if pretrained_model_name_or_path is None:
-            raise ValueError("pretrained_model_name_or_path cannot be None")
-
-        tokenizer = AutoTokenizer.from_pretrained(pretrained_model_name_or_path, **kwargs)
-        logger.debug(f"Loaded tokenizer: {pretrained_model_name_or_path}")
-        return tokenizer
diff --git a/src/kimchima/tests/test_chat_template_factory.py b/src/kimchima/tests/test_chat_template_factory.py
deleted file mode 100644
index c72d2f0..0000000
--- a/src/kimchima/tests/test_chat_template_factory.py
+++ /dev/null
@@ -1,65 +0,0 @@
-# coding=utf-8
-# Copyright [2024] [SkywardAI]
-# 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.
-
-import unittest
-
-from kimchima.pkg import (
-    TokenizerFactory,
-    ChatTemplateFactory
-)
-
-@unittest.skip("Skip TestChatTemplateFactory test class")
-class TestChatTemplateFactory(unittest.TestCase):
-    
-        model_name = 'gpt2'
-        add_generation_prompt=False
-        messages =[{"role": "user", "content": "Hello, how are you?"},
-                   {"role": "assistant", "content": "I'm doing great. How can I help you today?"},
-                   {"role": "user", "content": "I'd like to show off how chat templating works!"}]
-
-        @classmethod
-        def setUpClass(cls):
-            r"""
-            It is called once for the entire class before any tests or test cases are run.
-            """
-            cls.tokenizer = TokenizerFactory.auto_tokenizer(pretrained_model_name_or_path=cls.model_name)
-
-        @classmethod
-        def tearDownClass(cls):
-            pass
-
-
-        def test_prompt_generation(self):
-            """
-            Test tokenlized prompt_generation method
-            """
-    
-            self.assertIsNotNone(self.model_name)
-    
-            tokenized_chat = ChatTemplateFactory.prompt_generation(
-                tokenizer=self.tokenizer,
-                messages=self.messages,
-                tokenize=True,
-                add_generation_prompt=self.add_generation_prompt
-                )
-            non_tokenized_chat = ChatTemplateFactory.prompt_generation(
-                tokenizer=self.tokenizer,
-                messages=self.messages,
-                tokenize=False,
-                add_generation_prompt=self.add_generation_prompt
-                )
-            self.assertIsNotNone(tokenized_chat)
-            self.assertEqual(self.tokenizer.decode(tokenized_chat[0]), "Hello")
-            self.assertIsNotNone(non_tokenized_chat)
-            self.assertEqual(len(non_tokenized_chat),147)
\ No newline at end of file
diff --git a/src/kimchima/tests/test_cross_encoder_factory.py b/src/kimchima/tests/test_cross_encoder_factory.py
deleted file mode 100644
index fc8313d..0000000
--- a/src/kimchima/tests/test_cross_encoder_factory.py
+++ /dev/null
@@ -1,64 +0,0 @@
-# coding=utf-8
-# Copyright [2024] [SkywardAI]
-# 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.
-
-import unittest
-
-from kimchima.pkg import (
-    CrossEncoderFactory
-)
-
-@unittest.skip("skip CrossEncoderFactory")
-class TestCrossEncoderFactory(unittest.TestCase):
-
-    encoder_name = 'cross-encoder/ms-marco-MiniLM-L-6-v2'
-    query = "A man is eating pasta."
-
-    # With all sentences in the corpus
-    corpus = [
-        "A man is eating food.",
-        "A man is eating a piece of bread.",
-        "The girl is carrying a baby.",
-        "A man is riding a horse.",
-        "A woman is playing violin.",
-        "Two men pushed carts through the woods.",
-        "A man is riding a white horse on an enclosed ground.",
-        "A monkey is playing drums.",
-        "A cheetah is running behind its prey.",
-    ]
-    
-    @classmethod
-    def setUpClass(cls):
-        cls.encoder = CrossEncoderFactory(cls.encoder_name)
-
-    def test_predict(self):
-        """
-        Test predict method
-        """
-
-        self.assertIsNotNone(self.encoder)
-        sentence_combinations = [[self.query, sentence] for sentence in self.corpus]
-        scores = self.encoder.predict(sentence_combinations)
-        self.assertIsNotNone(scores)
-        
-    def test_rank(self):
-        """
-        Test rank method
-        """
-
-        ranks = self.encoder.rank(self.query, self.corpus)
-
-        self.assertIsNotNone(ranks)
-
-
-
diff --git a/src/kimchima/tests/test_devices.py b/src/kimchima/tests/test_devices.py
deleted file mode 100644
index bc0a393..0000000
--- a/src/kimchima/tests/test_devices.py
+++ /dev/null
@@ -1,49 +0,0 @@
-# coding=utf-8
-# Copyright [2024] [Aisuko]
-# 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.
-
-import unittest
-import platform
-import torch
-
-from kimchima.pkg import Devices
-
-class TestDevices(unittest.TestCase):
-
-    def test_get_device(self):
-
-        # Test if the device is a Mac silicon
-        if platform.system() == 'Darwin':
-            self.assertEqual(Devices.get_device(), Devices.Silicon)
-        
-        # Test if the device is a GPU
-        if platform.system() != 'Darwin' and torch.cuda.is_available():
-            self.assertEqual(Devices.get_device(), Devices.GPU)
-        
-        # Test if the device is a CPU
-        if platform.system() != 'Darwin' and not torch.cuda.is_available():
-            self.assertEqual(Devices.get_device(), Devices.CPU)
-
-
-    def test_get_capability(self):
-
-        # Test if the device is a GPU
-        if Devices.get_device() == Devices.GPU:
-            self.assertIsInstance(Devices.get_capability(), tuple)
-            self.assertEqual(len(Devices.get_capability()), 2)
-            self.assertIsInstance(Devices.get_capability()[0], int)
-            self.assertIsInstance(Devices.get_capability()[1], int)
-        
-        # Test if the device is not a GPU
-        if Devices.get_device() != Devices.GPU:
-            self.assertEqual(Devices.get_capability(), (0, 0))
diff --git a/src/kimchima/tests/test_dialog.py b/src/kimchima/tests/test_dialog.py
deleted file mode 100644
index c32edfa..0000000
--- a/src/kimchima/tests/test_dialog.py
+++ /dev/null
@@ -1,88 +0,0 @@
-# coding=utf-8
-# Copyright [2024] [SkywardAI]
-# 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.
-
-import unittest
-
-from kimchima.pkg import PipelinesFactory
-from kimchima.utils import Dialog
-
-@unittest.skip("skip TestChatSummary test class")
-class TestChatSummary(unittest.TestCase):
-
-        conversation_model="gpt2"
-        summarization_model="sshleifer/distilbart-cnn-12-6"
-        msg = "why Melbourne is a good place to travel?"
-        max_length = 10
-        prompt = "Melbourne is often considered one of the most livable cities globally, offering a high quality of life."
-
-        @classmethod
-        def setUpClass(cls):
-            # Load conversation model by using pipeline
-            cls.pipe_con=PipelinesFactory.customized_pipe(task="conversational" ,model=cls.conversation_model, device_map='auto')
-            cls.pipe_sum=PipelinesFactory.customized_pipe(task="summarization", model=cls.summarization_model, device_map='auto')
-
-        
-        def test_chat_summary(self):
-            """
-            Test chat_summary method
-            """
-            con = PipelinesFactory.init_conversation()
-            con.add_message({"role": "user", "content": "Dod you like weather of Melbourne?"})
-            con.add_message({"role": "assistant", "content": "Melbourne is also sunny which is my favourite weather"})
-            con.add_message({"role": "user", "content": "why Melbourne is a good place to travel?"})
-            res = Dialog.chat_summary(
-                pipe_con=self.pipe_con,
-                pipe_sum=self.pipe_sum,
-                messages=con,
-                prompt=self.prompt,
-                max_length=self.max_length
-                )
-
-            # res is str and should not be None
-            self.assertIsNotNone(res)
-            self.assertIsInstance(res, str)
-
-        
-        def test_dialog_with_pipe(self):
-            """
-            Test dialog with pipe method
-            """
-            con = PipelinesFactory.init_conversation()
-            con.add_message({"role": "user", "content": "Dod you like weather of Melbourne?"})
-            con.add_message({"role": "assistant", "content": "Melbourne is also sunny which is my favourite weather"})
-            con.add_message({"role": "user", "content": "why Melbourne is a good place to travel?"})
-            pipe=Dialog.dialog_with_pipe(conver_pipe=self.pipe_con, con=con)
-
-            # pipe is list and should not be None
-            self.assertIsNotNone(pipe)
-
-
-        def test_summary_with_pipe(self):
-            """
-            Test summary with pipe method
-            """
-            paragraph="""
-                    Melbourne, the vibrant capital of Victoria,
-                    Australia, pulsates with a captivating blend of culture, art, and sport. 
-                    Its laneways are adorned with striking street art, while grand Victorian-era buildings stand as testaments to its rich history. 
-                    The city boasts world-class museums, like the Melbourne Museum and the National Gallery of Victoria,
-                    alongside bustling markets and hidden bars waiting to be discovered. 
-                    Sports enthusiasts revel in the electric atmosphere of the Melbourne Cricket Ground and Rod Laver Arena, 
-                    hosting iconic events like the Australian Open and the Formula 1 Grand Prix. With its diverse culinary scene, 
-                    renowned coffee culture, and thriving nightlife, Melbourne offers an unforgettable experience for every visitor."""
-            pipe=PipelinesFactory.customized_pipe(model=self.summarization_model, device_map='auto')
-            res=Dialog.summary_with_pipe(summary_pipe=pipe, paragraph=paragraph, max_length=10)
-
-            # res is str and should not be None
-            self.assertIsNotNone(res)
diff --git a/src/kimchima/tests/test_downloadr.py b/src/kimchima/tests/test_downloadr.py
deleted file mode 100644
index e6a5971..0000000
--- a/src/kimchima/tests/test_downloadr.py
+++ /dev/null
@@ -1,102 +0,0 @@
-# coding=utf-8
-# Copyright [2024] [SkywardAI]
-# 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.
-
-import unittest
-
-from kimchima.utils import Downloader
-from kimchima.pkg import (
-    PipelinesFactory,
-    ModelFactory,
-    TokenizerFactory
-    )
-
-
-@unittest.skip("skip TestDownloader")
-class TestDownloader(unittest.TestCase):
-        
-        model_name="gpt2"
-        folder_name="gpt2"
-        model_name_auto="sentence-transformers/all-MiniLM-L6-v2"
-        folder_name_auto="encoder"
-        
-
-        @classmethod
-        def setUpClass(cls):
-            r"""
-            THe attributes are needed to set up before the test cases are run.
-            """
-            pass
-
-        
-        def test_model_downloader(self):
-            """
-            Test model_downloader method
-            """
-            Downloader.save_model_by_pipe(model_name=self.model_name, folder_name=self.folder_name)
-            
-            # load it from the folder
-            pipe=PipelinesFactory.customized_pipe(model=self.folder_name, device_map='auto')
-
-            # pipe is not None
-            self.assertIsNotNone(pipe)
-            self.assertEqual(pipe.model.name_or_path, self.folder_name)
-
-        
-        def test_auto_downloader(self):
-            """
-            Test auto_downloader method
-            """
-            Downloader.auto_downloader(model_name=self.model_name_auto, folder_name=self.folder_name_auto)
-            Downloader.auto_token_downloader(model_name=self.model_name_auto, folder_name=self.folder_name_auto)
-            
-            # load it from the folder
-            model=ModelFactory.auto_model(pretrained_model_name_or_path=self.folder_name_auto)
-
-
-            # load it from the local dolder
-            tokenizer=TokenizerFactory.auto_tokenizer(pretrained_model_name_or_path=self.folder_name_auto)
-
-            self.assertIsNotNone(model)
-            self.assertEqual(model.name_or_path, self.folder_name_auto)
-
-            self.assertIsNotNone(tokenizer)
-
-            promt="test"
-            input=tokenizer(promt, return_tensors="pt")
-            output=model(**input)
-
-            self.assertIsNotNone(output[0])
-
-
-        def test_casual_downloader(self):
-            """
-            Test casual_downloader method
-            """
-            Downloader.casual_downloader(model_name=self.model_name_auto, folder_name=self.folder_name_auto)
-            Downloader.auto_token_downloader(model_name=self.model_name_auto, folder_name=self.folder_name_auto)
-
-            model=ModelFactory.auto_model_for_causal_lm(pretrained_model_name_or_path=self.folder_name_auto)
-            tokenizer=TokenizerFactory.auto_tokenizer(pretrained_model_name_or_path=self.folder_name_auto)
-
-            self.assertIsNotNone(model)
-            self.assertEqual(model.name_or_path, self.folder_name_auto)
-
-            self.assertIsNotNone(tokenizer)
-
-            prompt="test"
-            input=tokenizer(prompt, return_tensors="pt")
-            output=model(**input)
-            self.assertIsNotNone(output[0])
-
-            
\ No newline at end of file
diff --git a/src/kimchima/tests/test_embedding_factory.py b/src/kimchima/tests/test_embedding_factory.py
deleted file mode 100644
index 5dd48af..0000000
--- a/src/kimchima/tests/test_embedding_factory.py
+++ /dev/null
@@ -1,72 +0,0 @@
-# coding=utf-8
-# Copyright [2024] [SkywardAI]
-# 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.
-
-import unittest
-
-from kimchima.pkg import (
-    ModelFactory,
-    TokenizerFactory,
-    EmbeddingsFactory
-)
-
-@unittest.skip("skip TestAutoFactory")
-class TestAutoFactory(unittest.TestCase):
-
-    model_name = 'sentence-transformers/all-MiniLM-L6-v2'
-
-    @classmethod
-    def setUpClass(cls):
-        cls.model = ModelFactory.auto_model(pretrained_model_name_or_path=cls.model_name)
-        cls.tokenizer = TokenizerFactory.auto_tokenizer(pretrained_model_name_or_path=cls.model_name)
-
-
-    @classmethod
-    def tearDownClass(cls):
-        pass
-
-
-    def test_get_embeddings(self):
-        """
-        Test get_embeddings method
-        """
-
-        self.assertIsNotNone(self.model)
-
-        embeddings = EmbeddingsFactory.get_text_embeddings(
-            model=self.model,
-            tokenizer=self.tokenizer, 
-            prompt='Melbourne',
-            device='cpu'
-            )
-
-        self.assertIsNotNone(embeddings)
-        self.assertEqual(embeddings.shape, (1, 384))
-
-
-    def test_get_embeddings_with_list(self):
-        """
-        Test get_embeddings method with list
-        """
-
-        self.assertIsNotNone(self.model)
-
-        embeddings = EmbeddingsFactory.get_text_embeddings(
-            model=self.model,
-            tokenizer=self.tokenizer, 
-            prompt=['Melbourne', 'Sydney'],
-            device='cpu'
-            )
-
-        self.assertIsNotNone(embeddings)
-        self.assertEqual(embeddings.shape, (2, 384))
diff --git a/src/kimchima/tests/test_model_factory.py b/src/kimchima/tests/test_model_factory.py
deleted file mode 100644
index 12bc451..0000000
--- a/src/kimchima/tests/test_model_factory.py
+++ /dev/null
@@ -1,54 +0,0 @@
-# coding=utf-8
-# Copyright [2024] [SkywardAI]
-# 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.
-
-
-import unittest
-
-from kimchima.pkg import ModelFactory
-
-
-@unittest.skip("skip TestModelFactory")
-class TestModelFactory(unittest.TestCase):
-    model_name = 'gpt2'
-
-    def test_auto_model(self):
-        """
-        Test auto_model method
-        """
-        model = ModelFactory.auto_model(pretrained_model_name_or_path=self.model_name)
-
-        # model is not None
-        self.assertIsNotNone(model)
-        self.assertEqual(model.config.model_type, 'gpt2')
-
-    def test_auto_model_for_causal_lm(self):
-        """
-        Test auto_model_for_causal_lm method
-        """
-        model = ModelFactory.auto_model_for_causal_lm(pretrained_model_name_or_path=self.model_name)
-
-        # model is not None
-        self.assertIsNotNone(model)
-        self.assertEqual(model.config.model_type, 'gpt2')
-
-
-    def test_model_for_seq2seq(self):
-        """
-        Test model_for_seq2seq method
-        """
-        model = ModelFactory.model_for_seq2seq(pretrained_model_name_or_path='google-t5/t5-base')
-
-        # model is not None
-        self.assertIsNotNone(model)
-        self.assertEqual(model.config.model_type, 't5')
diff --git a/src/kimchima/tests/test_pipelines_factory.py b/src/kimchima/tests/test_pipelines_factory.py
deleted file mode 100644
index c15b36a..0000000
--- a/src/kimchima/tests/test_pipelines_factory.py
+++ /dev/null
@@ -1,108 +0,0 @@
-# coding=utf-8
-# Copyright [2024] [SkywardAI]
-# 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.
-
-import unittest
-
-from kimchima.pkg import (
-    ModelFactory,
-    TokenizerFactory,
-    StreamerFactory,
-    PipelinesFactory
-)
-
-@unittest.skip("skip TestPipelinesFactory")
-class TestPipelinesFactory(unittest.TestCase):
-    
-        model_name = 'gpt2'
-        model=None
-        tokenizer=None
-        streamer=None
-    
-        @classmethod
-        def setUpClass(cls):
-            cls.model = ModelFactory.auto_model_for_causal_lm(pretrained_model_name_or_path=cls.model_name)
-            cls.tokenizer = TokenizerFactory.auto_tokenizer(pretrained_model_name_or_path=cls.model_name)
-            cls.streamer = StreamerFactory.text_streamer(tokenizer=cls.tokenizer)
-    
-    
-        @classmethod
-        def tearDownClass(cls):
-            pass
-
-        
-        def test_cached_pipe(self):
-            r"""
-            Test the cache mechanism of the pipelines, the second function should not be invoked
-            """
-            self.assertIsNotNone(self.model)
-    
-            pipe = PipelinesFactory.text_generation(
-                model=self.model,
-                tokenizer=self.tokenizer,
-                text_streamer=self.streamer
-                )
-            
-            pipe_cached = PipelinesFactory.text_generation(
-                model=self.model,
-                tokenizer=self.tokenizer,
-                text_streamer=self.streamer
-                )
-            
-            # two pipelines should be same obj
-            self.assertEqual(pipe, pipe_cached)
-            
-    
-        def test_text_generation(self):
-            """
-            Test text_generation method
-            """
-    
-            self.assertIsNotNone(self.model)
-    
-            pipe = PipelinesFactory.text_generation(
-                model=self.model,
-                tokenizer=self.tokenizer,
-                text_streamer=self.streamer
-                )
-    
-            self.assertIsNotNone(pipe)
-            self.assertEqual(pipe.task, 'text-generation')
-
-
-        def test_customized_pipe(self):
-            """
-            Test customized_pipe method
-            """
-    
-            pipe = PipelinesFactory.customized_pipe(
-                task="text-generation",
-                model=self.model,
-                tokenizer=self.tokenizer,
-                streamer=self.streamer,
-                max_new_tokens=20,
-                device_map='auto'
-                )
-    
-            self.assertIsNotNone(pipe)
-            self.assertEqual(pipe.task, 'text-generation')
-
-        def test_init_conversation(self):
-            """
-            Test init_conversation method
-            """
-            con = PipelinesFactory.init_conversation("how is the weather like in melbourne?")
-            con.add_message({"role": "assistant", "content": "The Big lebowski."})
-            con.add_message({"role": "user", "content": "Is it good?"})
-            self.assertIsNotNone(con)
-            self.assertEqual(con.messages[-1]["content"],"Is it good?")
\ No newline at end of file
diff --git a/src/kimchima/utils/__init__.py b/src/kimchima/utils/__init__.py
deleted file mode 100644
index 6866290..0000000
--- a/src/kimchima/utils/__init__.py
+++ /dev/null
@@ -1,19 +0,0 @@
-# coding=utf-8
-# Copyright [2024] [SkywardAI]
-# 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 .dialog import Dialog
-from .downloader import Downloader
-
-__all__ = [ "Dialog", "Downloader"]
diff --git a/src/kimchima/utils/dialog.py b/src/kimchima/utils/dialog.py
deleted file mode 100644
index 50fca7a..0000000
--- a/src/kimchima/utils/dialog.py
+++ /dev/null
@@ -1,111 +0,0 @@
-
-# coding=utf-8
-# Copyright [2024] [SkywardAI]
-# 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 __future__ import annotations
-
-from kimchima.pkg import logging
-
-logger=logging.get_logger(__name__)
-
-
-class Dialog:
-     
-    def __init__(self):
-        raise EnvironmentError(
-            "Dialog is designed to be instantiated "
-            "using the `Dialog.chat_summary()` method."
-        )
-
-    @classmethod
-    def chat_summary(cls, *args,**kwargs)-> str:
-        r"""
-        Chat and summarize the conversation.
-        """
-        pipe_con=kwargs.pop("pipe_con", None)
-        if pipe_con is None:
-            raise ValueError("conversation pipeline is required")
-            
-        pipe_sum=kwargs.pop("pipe_sum", None)
-        if pipe_sum is None:
-            raise ValueError("summarization pipeline is required")
-            
-        messages=kwargs.pop("messages", None)
-        if messages is None:
-            raise ValueError("messages is required")
-
-        prompt=kwargs.pop("prompt", None)
-        max_length=kwargs.pop("max_length", None)
-            
-        response = pipe_con(messages)
-
-        logger.info("Finish conversation pipeline")
-        if prompt is None:
-            return response.messages[-1]["content"]
-            
-        raw_response = prompt + response.messages[-1]["content"]
-            
-        if max_length is None:
-            max_length = len(raw_response)
-
-        response = pipe_sum(raw_response, min_length=5, max_length=max_length)
-
-        logger.info("Finish summarization pipeline")
-
-        return response[0].get('summary_text')
-    
-    @classmethod
-    def dialog_with_pipe(cls, *args, **kwargs):
-        r"""
-        Conversational pipeline with the conversation.
-
-        Args:
-            * conver_pipe: pipeline with `conversational` task
-                * like pipeline(task='conversational',model="microsoft/GODEL-v1_1-base-seq2seq", tokenizer=tokenizer)
-            * con: Huggingface transformers Conversation class instance
-            * **kwargs:
-                * max_length: maximum length of the response
-                * min_length: minimum length of the response
-                * top_k: top k tokens to sample from
-                * top_p: top p tokens to sample from
-                * temperature: temperature of the sampling
-                * do_sample: whether to sample
-        """
-        conver_pipe=kwargs.pop("conver_pipe", None)
-        if conver_pipe is None:
-            raise ValueError("conversation pipeline is required")
-        
-        con=kwargs.pop("con", None)
-        if con is None:
-            raise ValueError("con is required")
-        
-        return conver_pipe(con, **kwargs)
-    
-    @classmethod
-    def summary_with_pipe(cls, *args, **kwargs):
-        r"""
-        Summary conversaion records with the summarization pipeline.
-        """
-        summary_pipe=kwargs.pop("summary_pipe", None)
-        if summary_pipe is None:
-            raise ValueError("summary pipeline is required")
-
-        paragraph=kwargs.pop("paragraph", None)
-        if paragraph is None:
-            raise ValueError("paragraph is required")
-
-        return summary_pipe(paragraph, **kwargs)
-
-
-        
diff --git a/src/kimchima/utils/downloader.py b/src/kimchima/utils/downloader.py
deleted file mode 100644
index 58b80c4..0000000
--- a/src/kimchima/utils/downloader.py
+++ /dev/null
@@ -1,152 +0,0 @@
-
-# coding=utf-8
-# Copyright [2024] [SkywardAI]
-# 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 __future__ import annotations
-
-
-import os
-import shutil
-
-from kimchima.pkg import (
-    logging,
-    PipelinesFactory,
-    ModelFactory,
-    TokenizerFactory,
-    )
-
-logger=logging.get_logger(__name__)
-
-
-class Downloader:
-    r"""
-    This class is designed to download the model from Huggingface and save it to the specified folder.
-    """
-
-    def __init__(self):
-        raise EnvironmentError(
-            "Embeddings is designed to be instantiated "
-            "using the `Embeddings.from_pretrained(pretrained_model_name_or_path)` method."
-        )
-
-    @classmethod
-    def _move_files_and_remove_dir(cls, src_folder, dst_folder):
-        for filename in os.listdir(src_folder):
-            dst_file = os.path.join(dst_folder, filename)
-            if os.path.exists(dst_file):
-                os.remove(dst_file)
-            shutil.move(os.path.join(src_folder, filename), dst_folder)
-        shutil.rmtree(src_folder)
-
-    @classmethod
-    def save_model_by_pipe(cls, *args, **kwargs):
-        r"""
-        Here we will use pipeline from Huggingface to download the model.
-        And save the model to the specified folder.
-
-        Args:
-            * model_name: str: model name
-            * folder_name: str: folder name to save the model
-        """
-        model_name=kwargs.pop("model_name", None)
-        if model_name is None:
-            raise ValueError("model_name is required")
-        
-        folder_name=kwargs.pop("folder_name", None)
-        
-        pipe=PipelinesFactory.customized_pipe(model=model_name)        
-        pipe.save_pretrained(folder_name if folder_name is not None else model_name)
-        logger.info(f"Model {model_name} has been downloaded successfully")
-
-    
-    @classmethod
-    def auto_downloader(cls, *args, **kwargs):
-        r"""
-        Here we will use AutoModel from Huggingface to download the model.
-        It support a wider range of models beyond causal language models,
-        like BERT, RoBERTa, BART, T5 and more.
-
-        It returns the base model without a specific head, it does not directly
-        perform tasks like text generation or translation.
-
-        Args:
-            * model_name: str: model name
-            * folder_name: str: folder name to save the model
-        """
-
-        model_name=kwargs.pop("model_name", None)
-        if model_name is None:
-            raise ValueError("model_name is required")
-        
-        folder_name=kwargs.pop("folder_name", None)
-        if folder_name is None:
-            raise ValueError("folder_name is required")
-        if model_name == folder_name:
-            raise ValueError("folder_name should not be equal to model_name")
-
-        # save_pretrained only saves the model weights, not the configuration
-        model=ModelFactory.auto_model(pretrained_model_name_or_path=model_name)
-        model.save_pretrained(folder_name)
-
-        tokenizer=TokenizerFactory.auto_tokenizer(pretrained_model_name_or_path=model_name)
-        tokenizer.save_pretrained(folder_name + "/tmp1", legacy_format=False)
-        tokenizer.save_pretrained(folder_name + "/tmp2", legacy_format=True)
-
-        for tmp_folder in ["/tmp1", "/tmp2"]:
-            cls._move_files_and_remove_dir(folder_name+ tmp_folder, folder_name)
-        logger.info(f"Model {model_name} has been downloaded successfully")
-
-    
-    @classmethod
-    def casual_downloader(cls, *args, **kwargs):
-        r"""
-        Here we will use AutoModelForCausalLM from Huggingface to download the model
-        Like GPT-2 XLNet etc. 
-        It return a language modeling head which can be used to generate text,
-        translate text, write content, answer questions in a informative way.
-
-        Args:
-            * model_name: str: model name
-            * folder_name: str: folder name to save the model
-        """
-        model_name=kwargs.pop("model_name", None)
-        if model_name is None:
-            raise ValueError("model_name is required")
-
-        folder_name=kwargs.pop("folder_name", None)
-        # https://github.com/huggingface/transformers/issues/25296
-        # https://github.com/huggingface/accelerate/issues/661
-        model=ModelFactory.auto_model_for_causal_lm(pretrained_model_name_or_path=model_name)
-        model.save_pretrained(folder_name if folder_name is not None else model_name)
-        logger.info(f"Model {model_name} has been downloaded successfully")
-
-    @classmethod
-    def auto_token_downloader(cls, *args, **kwargs):
-        r"""
-        Here we will use AutoTokenizer from Huggingface to download the tokenizer congifuration.
-
-        Args:
-            * model_name: str: model name
-            * folder_name: str: folder name to save the model
-        """
-        model_name=kwargs.pop("model_name", None)
-        if model_name is None:
-            raise ValueError("model_name is required")
-
-        folder_name=kwargs.pop("folder_name", None)
-
-        tokenizer=TokenizerFactory.auto_tokenizer(pretrained_model_name_or_path=model_name)
-        tokenizer.save_pretrained(folder_name if folder_name is not None else model_name)
-        logger.info(f"Tokenizer {model_name} has been downloaded successfully")
-
diff --git a/src/kimchima/cmds/__init__.py b/src/models/__init__.py
similarity index 100%
rename from src/kimchima/cmds/__init__.py
rename to src/models/__init__.py
diff --git a/src/kimchima/models/one_layer_nn.py b/src/models/simple_nn.py
similarity index 58%
rename from src/kimchima/models/one_layer_nn.py
rename to src/models/simple_nn.py
index eb6dd67..ced18ff 100644
--- a/src/kimchima/models/one_layer_nn.py
+++ b/src/models/simple_nn.py
@@ -1,17 +1,16 @@
-
-
 import torch
-# https://github.com/tensorflow/tensorflow/issues/2115#issuecomment-497307252
-from torch.utils.tensorboard.writer import SummaryWriter
+from torch.utils.tensorboard import SummaryWriter
+
 writer = SummaryWriter()
 
-# log scalars
+
 x = torch.arange(-5, 5, 0.1).view(-1, 1)
 y = -5 * x + 0.1 * torch.randn(x.size())
 
 model = torch.nn.Linear(1, 1)
 criterion = torch.nn.MSELoss()
-optimizer = torch.optim.SGD(model.parameters(), lr = 0.1)
+optimizer = torch.optim.SGD(model.parameters(), lr=0.1)
+
 
 def train_model(iter):
     for epoch in range(iter):
@@ -22,8 +21,22 @@ def train_model(iter):
         loss.backward()
         optimizer.step()
 
-train_model(5)
+
+train_model(10)
 writer.flush()
 
 
-writer.close()
\ No newline at end of file
+writer.close()
+
+
+class SimpleNN:
+    def __init__(self):
+        pass
+
+    @classmethod
+    def forward_pass(cls):
+        pass
+
+    @classmethod
+    def backward_pass(cls):
+        return True
diff --git a/src/kimchima/models/__init__.py b/src/tests/__init__.py
similarity index 100%
rename from src/kimchima/models/__init__.py
rename to src/tests/__init__.py
diff --git a/src/tests/test_simple_nn.py b/src/tests/test_simple_nn.py
new file mode 100644
index 0000000..53b4fa2
--- /dev/null
+++ b/src/tests/test_simple_nn.py
@@ -0,0 +1,7 @@
+import unittest
+from models.simple_nn import SimpleNN
+
+
+class TestSimpleNN(unittest.TestCase):
+    def test_backward_pass(self):
+        self.assertTrue(SimpleNN.backward_pass())
diff --git a/src/kimchima/tests/__init__.py b/src/trainers/__init__.py
similarity index 100%
rename from src/kimchima/tests/__init__.py
rename to src/trainers/__init__.py