Python Bridge can be configured using the config.json file in the config folder:

Default Python Bridge Configuration
{
    "host": "0.0.0.0",
    "port": 5000,
    "logging": {
        "level": "info",
        "loggers": {
            "werkzeug": "info",
            "gensim.utils": "warn",
            "pytorch_pretrained_bert.modeling": "warn",
            "pytorch_pretrained_bert.tokenization": "warn"
        }
    },
    "models_data_dir": "models_data",
    "model_types": {
        "LatentSemanticIndexing" : {
            "model_names": ["lsi"]
        },
        "Bert": {
            "model_names": ["bert-base-uncased"],
            "default_model": "bert-base-uncased"
        },
        "SentimentAnalysisVader": {
            "model_names": ["vader"]
        },
        "SentimentAnalysisTextBlob": {
            "model_names": ["textBlob"]
        }
    }
}


In Line 2, the  host ( type=string | default=0.0.0.0 | required ) - Identifies the host from which the service will listen to requests. By default the service accepts all request

Lines 3, the  port ( type=integer | default=5000 | required ) - Port in which the service will listen for requests

In Line 4 we can find the logging section, in this section can be specified the logging level for the root logger, and the level for specific loggers

  • Line 5  level ( type=string | default=info | required ) - Level of the root logger, and by extension all loggers without a set level
  • Line 6  loggers ( type=json | optional ) - section for specific loggers, each logger can be identified by its name and level (e.g."name": "level")

Line 13,  models_data_dir ( type=string | default=models_data | required ) - path to folder storing the models

Line 14,  model_types ( type=json | required ) - section holding the types of model to load. If a new type is added, it needs to be added here too

Model Type Structure

Each type of model is constructed with an specific structure:

"Model_Type" : {
  "Model_Name": ["name1", "name2", "name3"]
}
  • Model_Type ( type=json | optional ) - The model type indicates the type of logic to implement, (e.i. the name of the class)
    • model_names ( type=string array | optional ) - Holds the names of the actual models to implement.
      • Each model is stored in a folder with the same name, inside the models_data folder, it makes a path like "models_data\Model_Name\name1"

Model Versioning

A model can be retrain, or a new model can be generated using the same algorithm with different parameters, so it could be said every single one of those parameters is a different version, each one of this versions can be stored in folders inside the model_name folder. An example of the directory tree and how each folder is named can be seen below

models_data
│
├───Model_Name
│   ├───name1
│   |   ├───1
│   |   ├───2
│   |   └───3
│   ├───name2
│   |   ├───1
│   |   └───2
│   └───name3
│       └───1
├───LatentSemanticIndexing
│   └───lsi
│       ├───1
│       └───2
├───SentimentAnalysisTextBlob
│   └───textBlob
│       └───1
├───SentimentAnalysisVader
│   └───vader
│       └───1
└───TfidfVectorizer
    └───tfidf
        └───1
  • No labels