onisj commited on
Commit
0d7d8a7
·
verified ·
1 Parent(s): 5c6c282

Update handler.py

Browse files
Files changed (1) hide show
  1. handler.py +4 -1
handler.py CHANGED
@@ -11,13 +11,15 @@ logger = logging.getLogger(__name__)
11
  class EndpointHandler:
12
  def __init__(self, path=""):
13
  self.path = path
 
 
14
  try:
15
  self.task = self._determine_task()
16
  except Exception as e:
17
  logger.error(f"Failed to determine task: {str(e)}")
18
  raise
19
 
20
- logger.info(f"Initializing model for task: {self.task} at path: {path}")
21
  if self.task == "text-generation":
22
  self.model = AutoModelForCausalLM.from_pretrained(
23
  path,
@@ -49,6 +51,7 @@ class EndpointHandler:
49
 
50
  def _determine_task(self):
51
  config_path = os.path.join(self.path, "config.json")
 
52
  if not os.path.exists(config_path):
53
  logger.error(f"config.json not found in {self.path}")
54
  raise ValueError(f"config.json not found in {self.path}")
 
11
  class EndpointHandler:
12
  def __init__(self, path=""):
13
  self.path = path
14
+ logger.info(f"Initializing handler with path: {path}")
15
+ logger.info(f"Directory contents: {os.listdir(path) if os.path.exists(path) else 'Path does not exist'}")
16
  try:
17
  self.task = self._determine_task()
18
  except Exception as e:
19
  logger.error(f"Failed to determine task: {str(e)}")
20
  raise
21
 
22
+ logger.info(f"Initializing model for task: {self.task}")
23
  if self.task == "text-generation":
24
  self.model = AutoModelForCausalLM.from_pretrained(
25
  path,
 
51
 
52
  def _determine_task(self):
53
  config_path = os.path.join(self.path, "config.json")
54
+ logger.info(f"Checking for config.json at: {config_path}")
55
  if not os.path.exists(config_path):
56
  logger.error(f"config.json not found in {self.path}")
57
  raise ValueError(f"config.json not found in {self.path}")