diff --git a/app/docker-compose_template.yaml b/app/docker-compose_template.yaml new file mode 100644 index 00000000..4933e37c --- /dev/null +++ b/app/docker-compose_template.yaml @@ -0,0 +1,21 @@ +version: "3.7" + +services: + + streamlit_app: + container_name: streamlit_container + build: + context: . + dockerfile: Dockerfile + + networks: + - my_bridge_network + model_service: + container_name: NSL_model + build: + context: . + dockerfile: Dockerfile.df + +networks: + my_bridge_network: + driver: bridge diff --git a/app/model_service/main.py b/app/model_service/main.py new file mode 100644 index 00000000..1a19bd32 --- /dev/null +++ b/app/model_service/main.py @@ -0,0 +1,18 @@ +"""doc +""" + +from fastapi import FastAPI +import uvicorn + + +app = FastAPI() + + +@app.post("/predict") +def inference(): + data = "Hello" + return data + + +if __name__ == "__main__": + uvicorn.run("main:app", port=3030, reload=True) diff --git a/app/model_service/model.py b/app/model_service/model.py new file mode 100644 index 00000000..dc401f00 --- /dev/null +++ b/app/model_service/model.py @@ -0,0 +1,29 @@ +""" +Ray serve for deployment +""" + +from typing import Any +import wandb +from ray import serve + + +@serve.deployment +class SIGN2TEXT: + """_summary_""" + + def __init__(self) -> None: + pass + + def __call__(self, *args: Any, **kwds: Any) -> Any: + pass + + +@serve.deployment +class YB2AUDIO: + """_summary_""" + + def __init__(self) -> None: + pass + + def __call__(self, *args: Any, **kwds: Any) -> Any: + pass diff --git a/signa2text/src/dev2.ipynb b/signa2text/src/dev2.ipynb new file mode 100644 index 00000000..243d5ff1 --- /dev/null +++ b/signa2text/src/dev2.ipynb @@ -0,0 +1,220 @@ +{ + "cells": [ + { + "cell_type": "code", + "execution_count": 1, + "metadata": {}, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "Previous directory: /workspace/NSL_2_AUDIO/signa2text\n" + ] + } + ], + "source": [ + "import os\n", + "\n", + "# Get the current working directory\n", + "current_dir = os.getcwd()\n", + "\n", + "# Go back to the previous directory\n", + "os.chdir('..')\n", + "\n", + "# Now, the current working directory is the previous directory\n", + "previous_dir = os.getcwd()\n", + "\n", + "print(\"Previous directory:\", previous_dir)\n" + ] + }, + { + "cell_type": "code", + "execution_count": 2, + "metadata": {}, + "outputs": [ + { + "data": { + "text/plain": [ + "'/workspace/NSL_2_AUDIO/signa2text'" + ] + }, + "execution_count": 2, + "metadata": {}, + "output_type": "execute_result" + } + ], + "source": [ + "pwd" + ] + }, + { + "cell_type": "code", + "execution_count": 3, + "metadata": {}, + "outputs": [], + "source": [ + "from models.baseline_transformer import ASLTransformer, LandmarkEmbedding, TokenEmbedding\n", + "from dataset.dataset_loader import get_dataset, prepare_dataloader # get_test_dataset\n", + "from dataset.dataset_paths import get_dataset_paths" + ] + }, + { + "cell_type": "code", + "execution_count": 4, + "metadata": {}, + "outputs": [], + "source": [ + "train_data_paths, valid_data_paths = get_dataset_paths(dev_mode=True)" + ] + }, + { + "cell_type": "code", + "execution_count": 5, + "metadata": {}, + "outputs": [], + "source": [ + "train_dataset = get_dataset(train_data_paths)\n", + "train_dataset = prepare_dataloader(train_dataset,10)" + ] + }, + { + "cell_type": "code", + "execution_count": 6, + "metadata": {}, + "outputs": [], + "source": [ + "for source, target in train_dataset:\n", + " break" + ] + }, + { + "cell_type": "code", + "execution_count": 7, + "metadata": {}, + "outputs": [ + { + "data": { + "text/plain": [ + "(torch.Size([10, 128, 345]), torch.Size([10, 64]))" + ] + }, + "execution_count": 7, + "metadata": {}, + "output_type": "execute_result" + } + ], + "source": [ + "source.shape , target.shape" + ] + }, + { + "cell_type": "code", + "execution_count": 8, + "metadata": {}, + "outputs": [], + "source": [ + "source_emb = LandmarkEmbedding(64)\n", + "target_emd = TokenEmbedding(num_vocab=62, embedding_dim= 64, maxlen=64)" + ] + }, + { + "cell_type": "code", + "execution_count": 19, + "metadata": {}, + "outputs": [ + { + "data": { + "text/plain": [ + "(torch.Size([10, 64]), torch.Size([10, 128, 345]))" + ] + }, + "execution_count": 19, + "metadata": {}, + "output_type": "execute_result" + } + ], + "source": [ + "target.size(), source.size()" + ] + }, + { + "cell_type": "code", + "execution_count": 14, + "metadata": {}, + "outputs": [], + "source": [ + "source_emb_ans= source_emb(source)\n", + "target_emd_ans = target_emd(target)" + ] + }, + { + "cell_type": "code", + "execution_count": 15, + "metadata": {}, + "outputs": [ + { + "data": { + "text/plain": [ + "torch.Size([10, 64, 64])" + ] + }, + "execution_count": 15, + "metadata": {}, + "output_type": "execute_result" + } + ], + "source": [ + "target_emd_ans.shape" + ] + }, + { + "cell_type": "code", + "execution_count": 16, + "metadata": {}, + "outputs": [ + { + "data": { + "text/plain": [ + "torch.Size([10, 64])" + ] + }, + "execution_count": 16, + "metadata": {}, + "output_type": "execute_result" + } + ], + "source": [ + "source_emb_ans.shape" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "metadata": {}, + "outputs": [], + "source": [] + } + ], + "metadata": { + "kernelspec": { + "display_name": "Python 3", + "language": "python", + "name": "python3" + }, + "language_info": { + "codemirror_mode": { + "name": "ipython", + "version": 3 + }, + "file_extension": ".py", + "mimetype": "text/x-python", + "name": "python", + "nbconvert_exporter": "python", + "pygments_lexer": "ipython3", + "version": "3.11.2" + } + }, + "nbformat": 4, + "nbformat_minor": 2 +}