forked from AISaturdaysLagos/Cohort8-Team-Template
-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
693c3ce
commit 5b390c9
Showing
4 changed files
with
288 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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 | ||
} |