Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[pull] master from CogStack:master #21

Merged
merged 2 commits into from
Jan 7, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
38 changes: 37 additions & 1 deletion docker/docker-compose-gpu.yml
100644 → 100755
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down
27 changes: 27 additions & 0 deletions docker/docker-compose.yml
100644 → 100755
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down
Empty file modified docker/run_example_medmen.sh
100644 → 100755
Empty file.
2 changes: 1 addition & 1 deletion envs/env_app
100644 → 100755
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
42 changes: 42 additions & 0 deletions envs/env_app_1
Original file line number Diff line number Diff line change
@@ -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
2 changes: 1 addition & 1 deletion envs/env_medcat
100644 → 100755
Original file line number Diff line number Diff line change
Expand Up @@ -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
36 changes: 36 additions & 0 deletions envs/env_medcat_1
Original file line number Diff line number Diff line change
@@ -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
Loading