11# Sentimental analyses with MLFLOW and models Wrappers
22
3+ [ ![ version] ( https://img.shields.io/badge/version-1.0.0-green.svg )] ( https://semver.org )
4+
5+ ## Table of content
6+ - [ Overview] ( #overview )
7+ - [ Architecture] ( #architecture )
8+ - [ Install] ( #install )
9+ - [ Usage] ( #usage )
10+ - [ Contributing] ( #contributing )
11+ - [ Production] ( #production )
12+ - [ Monitoring] ( #monitoring )
13+ - [ Api] ( #api )
14+ - [ License] ( #license )
15+ - [ Author] ( #author )
16+ - [ Thanks] ( #thanks )
17+
18+ ## Overview
19+
320Tweet sentimental analyses with different models.
421
522Four wrapper of models:
@@ -15,18 +32,7 @@ MLFlow is used to list all experiments and easily commpare results for several d
1532Optuna is used to optimise parameters. It run a set of experiments with a variation of parameters and select the best configuration
1633maximising the accuracy.
1734
18-
19-
20- The app is dockerised and can be installed launching the command
21- ``` bash
22- docker compose up
23- ```
24- or to run in background
25- ``` bash
26- docker compose up -d
27- ```
28-
29- ## Access and architecture
35+ ## Architecture
3036The application contains alerting system and monitoring on grafana on port 3000
3137APP PORT
3238MLFLOW 5001
@@ -42,15 +48,36 @@ Prometheus send metrics as the number of prediction running.
4248An alert is send by mail when number of predictions in concurrency are up to 5.
4349An alert is send when the result of the prediction is too bad, probability < 0.5.
4450
45- ## Installation in dev
46- # Install uv (Rust package to fastly install package)
51+
52+ ## Install
53+
54+ The app is dockerised and can be installed launching the command
55+ ``` bash
56+ docker compose up
57+ ```
58+ or to run in background
59+ ``` bash
60+ docker compose up -d
61+ ```
62+
63+
64+ ## Contributing
65+ #### Install uv (Rust package to fastly install package)
4766``` bash
4867curl -Ls https://astral.sh/uv/install.sh | bash
4968export PATH=" $HOME /.cargo/bin:$PATH "
5069```
70+ #### Source the code in the container
71+ Modify the docker-compose.yaml to add the source code as volume
72+ ``` bash
73+ volumes:
74+ - ./src:/app/src/
75+ - ./mlruns:/app/mlruns/
76+ ```
5177
52- ## OVH Train with AI train
78+ ## Usage
5379
80+ ### OVH Train with AI train
5481Create an object storage on OVH managed with ovhai cli
5582The secret key is obtain clicking on the user object storage line 'access secret key'
5683``` bash
@@ -65,7 +92,7 @@ Credentials are stored in ~/.config/ovhai/context.json
6592uv pip install boto3 awscli ovhai
6693```
6794
68- ## Run on multi GPU
95+ ### Run on multi GPU
6996DEBUG
7097``` bash
7198export TORCH_DISTRIBUTED_DEBUG=DETAIL
@@ -74,16 +101,36 @@ export TORCH_DISTRIBUTED_DEBUG=DETAIL
74101python -m torch.distributed.run --nproc_per_node=2 train.py
75102```
76103
77- ## Tests
104+ ### Tests
78105``` bash
79106pytest src/tests
80107```
81108
82- ## Launch a test to verify the prection from the API
109+ ### Launch a test to verify the prection from the API
83110Go on 127.0.0.1:5000, tap your tweet and click on predict button
84111
85- Par requête http
112+
113+ ## Production
114+ An exemple deployment is available on https://tweetsentiment.shift.python.software.fr
115+
116+ ## Monitoring
117+ Add alert and monitoring and dashboard on grafana on your local instance
118+ and save them in grafana folder.
119+ Reload grafana and they will be available on http://localhost:3000 as provisionning templates
120+
121+ ## Api
122+ You can contact the api example
123+ or change the url on the script predict_client.py to test your instance
86124``` bash
87125export $( cat .env | xargs)
88- python post .py
126+ python predict_client .py
89127```
128+ ## License
129+
130+ MIT License
131+
132+ ## Author
133+ Shift python software
134+
135+ ## Thanks
136+ Thanks to all contributors
0 commit comments