YsnHdn commited on
Commit
25d4fbe
1 Parent(s): aef7e33

Refactor : access to the model

Browse files
Files changed (2) hide show
  1. Dockerfile +3 -0
  2. helper_functions.py +3 -5
Dockerfile CHANGED
@@ -17,6 +17,9 @@ ENV HF_HOME /code/.cache/huggingface
17
  # Create cache directory with appropriate permissions
18
  RUN mkdir -p $HF_HOME && chmod -R 777 $HF_HOME
19
 
 
 
 
20
  # Copy the rest of the application files
21
  COPY . .
22
 
 
17
  # Create cache directory with appropriate permissions
18
  RUN mkdir -p $HF_HOME && chmod -R 777 $HF_HOME
19
 
20
+ # Copy the model files into the image
21
+ COPY ./bertModel-20240428T144909Z-001 /code/bertModel-20240428T144909Z-001
22
+
23
  # Copy the rest of the application files
24
  COPY . .
25
 
helper_functions.py CHANGED
@@ -6,15 +6,13 @@ from typing import Optional
6
  from torch import Tensor
7
 
8
  # Load the model
9
- model_path = "Sayado/Model_PFE"
10
- model = BertForSequenceClassification.from_pretrained(model_path)
11
 
12
  # Load the tokenizer
13
- tokenizer_path = "Sayado/Model_PFE"
14
- tokenizer = BertTokenizer.from_pretrained(tokenizer_path)
15
 
16
  # Charger le label encoder
17
- with open("label_encoder.pkl", "rb") as f:
18
  label_encoder = pickle.load(f)
19
 
20
  class_labels = {
 
6
  from torch import Tensor
7
 
8
  # Load the model
9
+ model = BertForSequenceClassification.from_pretrained(r"bertModel-20240428T144909Z-001\bertModel\saved_model")
 
10
 
11
  # Load the tokenizer
12
+ tokenizer = BertTokenizer.from_pretrained(r"bertModel-20240428T144909Z-001\bertModel\saved_tokenizer")
 
13
 
14
  # Charger le label encoder
15
+ with open(r"bertModel-20240428T144909Z-001\bertModel\label_encoder.pkl", "rb") as f:
16
  label_encoder = pickle.load(f)
17
 
18
  class_labels = {