-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #122 from RMoodsTeam/118-cli-nlp-model-manager
118 cli nlp model manager
- Loading branch information
Showing
12 changed files
with
419 additions
and
130 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
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,22 +1,27 @@ | ||
### Building and running your application | ||
## Building and running your application | ||
|
||
When you're ready, start your application by running: | ||
`docker compose up --build`. | ||
When you're ready, build your application by running: | ||
```docker build -t rmoods-nlp .``` | ||
|
||
Your application will be available at http://localhost:8000. | ||
The ```-t``` parameter refers to tag, which is the name of the image. | ||
You can replace ``rmoods-nlp`` with any name you like. | ||
|
||
### Deploying your application to the cloud | ||
After the build completes, you can run your application using the following command: | ||
```docker run --name rmoods-nlp -d rmoods-nlp``` | ||
|
||
First, build your image, e.g.: `docker build -t myapp .`. | ||
If your cloud uses a different CPU architecture than your development | ||
machine (e.g., you are on a Mac M1 and your cloud provider is amd64), | ||
you'll want to build the image for that platform, e.g.: | ||
`docker build --platform=linux/amd64 -t myapp .`. | ||
The ```-d``` parameter runs the container in detached mode, which means the container | ||
runs in the background ```--name``` refers to docker name, it can be used | ||
instead of container id. | ||
|
||
Then, push it to your registry, e.g. `docker push myregistry.com/myapp`. | ||
If you want to open docker image console run: | ||
```docker exec -it rmoods-nlp /bin/bash``` | ||
|
||
Consult Docker's [getting started](https://docs.docker.com/go/get-started-sharing/) | ||
docs for more detail on building and pushing. | ||
```rmoods-nlp``` is the name of the container. If we did not specify a name, | ||
Docker would have assigned a random name to the container. To check the name of the container, run: | ||
```docker ps``` | ||
|
||
### References | ||
To stop the container, run: | ||
```docker stop rmoods-nlp``` | ||
|
||
## References | ||
* [Docker's Python guide](https://docs.docker.com/language/python/) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -7,6 +7,7 @@ | |
installation.md | ||
using_docker.md | ||
env_example.md | ||
using_manager.md | ||
``` | ||
|
||
```{toctree} | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
# Using the models manager | ||
|
||
#### To use the models manager, run the following command: | ||
|
||
```bash | ||
./manager.sh <command> <model_names> | ||
``` | ||
|
||
#### Manager commands: | ||
- remote - Check the status of the models online | ||
- install - Install the models | ||
- clean - Delete all models from file system | ||
- upload - Upload the models to the server | ||
- status - Check the status of local models with Google Drive | ||
|
||
#### Status and remote command marks: | ||
- ❌ - Not installed | ||
- ✅ - Installed | ||
- ❓ - Version mismatch | ||
|
||
#### Model names is the optional parameter for upload and install: | ||
- If no model names are provided, all models will be installed/uploaded | ||
```bash | ||
./manager.sh upload | ||
``` | ||
- To upload/install model give list of model names, separate them with a space | ||
```bash | ||
./manager.sh install sentiment | ||
``` |
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 @@ | ||
#!/bin/bash | ||
|
||
command=$1; shift | ||
array=("$@") | ||
|
||
case $command in | ||
"install") | ||
if [[ ${#array[@]} -eq 0 ]]; then | ||
PYTHONPATH=src python -c 'import version_checker; version_checker.update_model_versions()' | ||
else | ||
PYTHONPATH=src python -c 'import sys, version_checker; version_checker.update_model_versions(sys.argv[1:])' "${array[@]}" | ||
fi | ||
;; | ||
"remote") | ||
PYTHONPATH=src python -c 'import version_checker; version_checker.get_status()' | ||
;; | ||
"upload") | ||
if [[ ${#array[@]} -eq 0 ]]; then | ||
PYTHONPATH=src python -c 'import sys, version_checker; version_checker.upload_manager()' | ||
else | ||
PYTHONPATH=src python -c 'import sys, version_checker; version_checker.upload_manager(sys.argv[1:])' "${array[@]}" | ||
fi | ||
;; | ||
"status") | ||
PYTHONPATH=src python -c 'import version_checker; version_checker.get_status(True)' | ||
;; | ||
"clean") rm -r models ;; | ||
*) echo "Usage: $0 {install|clean|status|remote|upload}" ;; | ||
esac |
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.