Skip to content

Commit

Permalink
Testing
Browse files Browse the repository at this point in the history
  • Loading branch information
Weves committed Apr 25, 2024
1 parent 648f2d0 commit c1f429f
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions backend/model_server/custom_models.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,10 @@
import numpy as np
import tensorflow as tf # type: ignore
from fastapi import APIRouter
from huggingface_hub.constants import HF_HOME
from transformers import AutoTokenizer # type: ignore
from transformers import TFDistilBertForSequenceClassification
from transformers.utils import TRANSFORMERS_CACHE

from model_server.constants import MODEL_WARM_UP_STRING
from model_server.utils import simple_log_function_time
Expand All @@ -24,6 +26,8 @@
def get_intent_model_tokenizer(
model_name: str = INTENT_MODEL_VERSION,
) -> "AutoTokenizer":
print(f"HF Home: {HF_HOME}")
print(f"Cache dir: {TRANSFORMERS_CACHE}")
global _INTENT_TOKENIZER
if _INTENT_TOKENIZER is None:
_INTENT_TOKENIZER = AutoTokenizer.from_pretrained(model_name)
Expand All @@ -36,6 +40,8 @@ def get_local_intent_model(
) -> TFDistilBertForSequenceClassification:
global _INTENT_MODEL
if _INTENT_MODEL is None or max_context_length != _INTENT_MODEL.max_seq_length:
print(f"HF Home: {HF_HOME}")
print(f"Cache dir: {TRANSFORMERS_CACHE}")
_INTENT_MODEL = TFDistilBertForSequenceClassification.from_pretrained(
model_name
)
Expand Down

0 comments on commit c1f429f

Please sign in to comment.