diff --git a/docker/docker-compose-gpu.yml b/docker/docker-compose-gpu.yml old mode 100644 new mode 100755 index 6047add..15c5a15 --- a/docker/docker-compose-gpu.yml +++ b/docker/docker-compose-gpu.yml @@ -32,7 +32,43 @@ services: devices: - driver: nvidia count: 1 - device_ids: ['0'] + #device_ids: ['0'] + capabilities: ["gpu", "utility", "compute", "video"] + + nlp-medcat-service-production-1: + container_name: cogstack-medcat-service-production-1 + ### Multiple images available: + ## default image, only CPU support: cogstacksystems/medcat-service:latest + ## GPU support: cogstacksystems/medcat-service-gpu:latest + # image: cogstacksystems/medcat-service:latest + platform: linux + restart: always + ## Default dockerfile: ../Dockerfile + ## GPU dockerfile: ../Dockerfile_gpu + build: + context: ../ + dockerfile: "Dockerfile_gpu" + environment: + - http_proxy=$HTTP_PROXY + - https_proxy=$HTTPS_PROXY + - no_proxy=$no_proxy + env_file: + - ../envs/env_app_1 + - ../envs/env_medcat_1 + volumes: + - ../models:/cat/models/:rw + ports: + - "5556:5000" + networks: + - cognet + + deploy: + resources: + reservations: + devices: + - driver: nvidia + count: 1 + # device_ids: ['0'] capabilities: ["gpu", "utility", "compute", "video"] networks: diff --git a/docker/docker-compose.yml b/docker/docker-compose.yml old mode 100644 new mode 100755 index e23fd3d..c689f7e --- a/docker/docker-compose.yml +++ b/docker/docker-compose.yml @@ -25,6 +25,33 @@ services: - "5555:5000" networks: - cognet + + nlp-medcat-service-production-1: + container_name: cogstack-medcat-service-production-1 + ### Multiple images available: + ## default image, only CPU support: cogstacksystems/medcat-service:latest + ## GPU support: cogstacksystems/medcat-service-gpu:latest + # image: cogstacksystems/medcat-service:latest + platform: linux + restart: always + ## Default dockerfile: ../Dockerfile + ## GPU dockerfile: ../Dockerfile_gpu + build: + context: ../ + dockerfile: "Dockerfile" + environment: + - http_proxy=$HTTP_PROXY + - https_proxy=$HTTPS_PROXY + - no_proxy=$no_proxy + env_file: + - ../envs/env_app_1 + - ../envs/env_medcat_1 + volumes: + - ../models:/cat/models/:rw + ports: + - "5556:5000" + networks: + - cognet networks: cognet: diff --git a/docker/run_example_medmen.sh b/docker/run_example_medmen.sh old mode 100644 new mode 100755 diff --git a/envs/env_app b/envs/env_app old mode 100644 new mode 100755 index ee3a7a3..090fc8d --- a/envs/env_app +++ b/envs/env_app @@ -17,7 +17,7 @@ APP_MODEL_META_PATH_LIST=/cat/models/Status # MedCAT Model Pack path # IMPORTANT: if this parameter has value IT WILL BE LOADED FIRST OVER EVERYTHING ELSE (CDB, Vocab, MetaCATs, etc.) declared above. # Respect the same paths as above : /cat/models/model_pack_name.zip -APP_MEDCAT_MODEL_PACK= +APP_MEDCAT_MODEL_PACK=/cat/models/medcat_deid_model_691c3f6a6e5400e7.zip # optionally, an filter the reported concepts by CUIs # APP_MODEL_CUI_FILTER_PATH=/cat/models/cui_filter.txt diff --git a/envs/env_app_1 b/envs/env_app_1 new file mode 100755 index 0000000..090fc8d --- /dev/null +++ b/envs/env_app_1 @@ -0,0 +1,42 @@ +# Additional settings + +# IMPORTANT : log level set +# CRITICAL - 50, ERROR - 40, WARNING - 30, INFO - 20, DEBUG - 10, NOTSET - 0 +APP_LOG_LEVEL=INFO + +# can include only one model for NER +APP_NAME=MedCAT +APP_MODEL_LANGUAGE=en +APP_MODEL_NAME=MedMen +APP_MODEL_CDB_PATH=/cat/models/cdb.dat +APP_MODEL_VOCAB_PATH=/cat/models/vocab.dat + +# optionally, can include multiple models for meta tasks, separated using ':' +APP_MODEL_META_PATH_LIST=/cat/models/Status + +# MedCAT Model Pack path +# IMPORTANT: if this parameter has value IT WILL BE LOADED FIRST OVER EVERYTHING ELSE (CDB, Vocab, MetaCATs, etc.) declared above. +# Respect the same paths as above : /cat/models/model_pack_name.zip +APP_MEDCAT_MODEL_PACK=/cat/models/medcat_deid_model_691c3f6a6e5400e7.zip + +# optionally, an filter the reported concepts by CUIs +# APP_MODEL_CUI_FILTER_PATH=/cat/models/cui_filter.txt + +# NLP processing +APP_BULK_NPROC=8 +APP_TRAINING_MODE=False + +# Flask server config +SERVER_HOST=0.0.0.0 +SERVER_PORT=5000 +SERVER_WORKERS=1 +SERVER_WORKER_TIMEOUT=300 +SERVER_THREADS=1 + +# set the number of torch threads, this should be used ONLY if you are using CPUs and the default image +# set to -1 or 0 if you are using GPU +APP_TORCH_THREADS=8 + +# GPU SETTING +# CAUTION, use only if you are using the GPU docker image. +APP_CUDA_DEVICE_COUNT=1 \ No newline at end of file diff --git a/envs/env_medcat b/envs/env_medcat old mode 100644 new mode 100755 index 3332665..21c07a3 --- a/envs/env_medcat +++ b/envs/env_medcat @@ -32,5 +32,5 @@ SPACY_MODEL= # POSSIBLE VALUES: [list, dict], if left empty then "dict" is the default. ANNOTATIONS_ENTITY_OUTPUT_MODE=dict -DEID_MODE=False +DEID_MODE=True DEID_REDACT=True \ No newline at end of file diff --git a/envs/env_medcat_1 b/envs/env_medcat_1 new file mode 100755 index 0000000..21c07a3 --- /dev/null +++ b/envs/env_medcat_1 @@ -0,0 +1,36 @@ +TYPE=NOT_UMLS + +# IMPORTANT : log level set +# CRITICAL - 50, ERROR - 40, WARNING - 30, INFO - 20, DEBUG - 10, NOTSET - 0 +LOG_LEVEL=40 + +NESTED_ENTITIES=False + +CNTX_SPAN=9 +CNTX_SPAN_SHORT=3 +MIN_CUI_COUNT=30000 +MIN_CUI_COUNT_STRICT=-1 +MIN_ACC=0.2 +MIN_ACC_TH=0.2 + +LEARNING_RATE=0.1 +ANNEAL=False +KEEP_PUNCT=:|. + +# can be left empty if you want to use the CDB spacy model, otherwise, possible values are : en_core_sci_lg, en_core_sci_md, etc... +# please note that only SpaCy models that are installed on the docker container are usable (take a look at the .Dockerfile and install any other custom models you may want to use) +SPACY_MODEL= + +# IMPORTANT: +# Mode in which annotation entities should be outputted in the JSON response, +# by default this is set to "list" of dicts, so the output would be : {"annotations": [{"id": "0", "cui" : "C1X..", ..}, {"id":"1", "cui": "...."}]} +# newer versions of MedCAT (1.2+) output entities as a dict, where the id of the entity is a key and the rest of the data is a value, so for "dict", +# the output is +# {"annotations": {"entities": {"0": {"cui": "C0027361", "id": 0,.....}, "1": {"cui": "C001111", "id": 1......}} +# Be mindful of this option as it can affect other services that rely directly on the responses of the service +# (the NiFi groovy scripts and annotation ingester are two such services that process the output, and so they might require further customisation) +# POSSIBLE VALUES: [list, dict], if left empty then "dict" is the default. +ANNOTATIONS_ENTITY_OUTPUT_MODE=dict + +DEID_MODE=True +DEID_REDACT=True \ No newline at end of file