Skip to content

Commit b6f324d

Browse files
authored
Fix Model Info Displays in Tool Controller (#32)
* Passthrough CONFIG_NAME Build Arg in Dockerfile * Fix Format String in Tool Controller * Specify CONFIG_NAME in CI Docker Build * Add Good Build Arg Defaults to docker-compose.yml * Remove Extraneous Enum from config.py; Add Better Diagnostic Defaults
1 parent 3228faf commit b6f324d

File tree

5 files changed

+14
-17
lines changed

5 files changed

+14
-17
lines changed

.github/workflows/ci.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -159,6 +159,7 @@ jobs:
159159
tags: ${{ env.tags }}
160160
build-args: |
161161
MODEL_NAME=${{ env.MODEL_NAME }}
162+
CONFIG_NAME=${{ env.CONFIG_NAME }}
162163
labels: |
163164
org.opencontainers.image.created=${{ env.created }}
164165
org.opencontainers.image.source=${{ github.repositoryUrl }}

docker-compose.yml

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,8 +5,9 @@ services:
55
image: docker.synapse.org/syn22277123/phi-annotator-huggingface
66
build:
77
context: server
8-
# args:
9-
# MODEL_NAME: "dslim/bert-base-NER"
8+
args:
9+
MODEL_NAME: "dslim/bert-base-NER-uncased"
10+
CONFIG_NAME: "bert-base-ner-uncased"
1011
container_name: phi-annotator
1112
networks:
1213
- nlpsandbox-internal

server/Dockerfile

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,10 @@
11
FROM python:3.9.6-slim-buster
22

3-
ARG MODEL_NAME="dslim/bert-base-NER"
3+
ARG MODEL_NAME
4+
ARG CONFIG_NAME
45

56
ENV APP_DIR=/opt/app
7+
ENV CONFIG_NAME=${CONFIG_NAME}
68

79
SHELL ["/bin/bash", "-euxo", "pipefail", "-c"]
810

server/openapi_server/config.py

Lines changed: 6 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1,18 +1,12 @@
11
import os
2-
from enum import Enum
2+
33

44
defaultValues = {
5-
"CONFIG_NAME": "",
6-
"MODEL_NAME": ""
5+
"CONFIG_NAME": "<UNSPECIFIED>",
6+
"MODEL_NAME": "<UNSPECIFIED>"
77
}
88

99

10-
class ConfigName(Enum):
11-
BERT_BASE_NER = "bert-base-ner"
12-
BERT_BASE_NER_UNCASED = "bert-base-ner-uncased"
13-
BERT_LARGE_NER = "bert-large-ner"
14-
15-
1610
class AbstractConfig(object):
1711
"""
1812
Parent class containing get_property to return the environment variable or
@@ -32,10 +26,9 @@ def get_property(self, property_name):
3226

3327

3428
class Config(AbstractConfig):
35-
"""
36-
This class is used to provide coniguration values to the application, first
37-
using environment variables and if not found, defaulting to those values
38-
provided in the defaultValues dictionary above.
29+
"""This class is used to provide configuration values to the application,
30+
first using environment variables and if not found, defaulting to those
31+
values provided in the defaultValues dictionary above.
3932
"""
4033

4134
@property

server/openapi_server/controllers/tool_controller.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ def get_tool(): # noqa: E501
1818
version="1.0.0",
1919
license=License.APACHE_2_0,
2020
repository="github:nlpsandbox/phi-annotator-huggingface",
21-
description="Hugging Face PHI annotator ({config.model_name})",
21+
description=f"Hugging Face PHI annotator ({config.model_name})",
2222
author="NLP Sandbox Team",
2323
author_email="team@nlpsandbox.io",
2424
url="https://github.com/nlpsandbox/phi-annotator-huggingface",

0 commit comments

Comments
 (0)