VascoBartolo commited on
Commit
4427cbd
1 Parent(s): 9c17314

change model processor to path config

Browse files
Files changed (1) hide show
  1. handler.py +5 -4
handler.py CHANGED
@@ -1,13 +1,14 @@
1
  from typing import Dict, List, Any
2
  import torch
3
- from transformers import AutoModelForSeq2SeqLM, AutoProcessor
4
 
5
  class EndpointHandler:
6
- def __init__(self):
7
- self.model = AutoModelForSeq2SeqLM.from_pretrained('EnariGmbH/surftown-1.0')
 
8
 
9
  # Load the processor from the configuration files
10
- self.processor = AutoProcessor.from_pretrained('EnariGmbH/surftown-1.0')
11
 
12
  # Ensure the model is in evaluation mode
13
  self.model.eval()
 
1
  from typing import Dict, List, Any
2
  import torch
3
+ from transformers import AutoModelForSeq2SeqLM, AutoProcessor, AutoConfig
4
 
5
  class EndpointHandler:
6
+ def __init__(self, path="/app"):
7
+ config = AutoConfig.from_pretrained(path)
8
+ self.model = AutoModelForSeq2SeqLM.from_config(config)
9
 
10
  # Load the processor from the configuration files
11
+ self.processor = AutoProcessor.from_pretrained(path)
12
 
13
  # Ensure the model is in evaluation mode
14
  self.model.eval()