Buildwellai commited on
Commit
9f067b2
·
verified ·
1 Parent(s): 3b46e02

Update handler.py

Browse files
Files changed (1) hide show
  1. handler.py +2 -1
handler.py CHANGED
@@ -2,7 +2,7 @@ import os
2
  from typing import Dict, List, Any
3
  from transformers import AutoTokenizer, AutoModelForCausalLM, AutoConfig
4
  import torch
5
- from peft import PeftModel
6
  from dotenv import load_dotenv
7
 
8
  load_dotenv()
@@ -12,6 +12,7 @@ class EndpointHandler:
12
  """
13
  Initializes the model and tokenizer.
14
  """
 
15
  max_seq_length = int(os.getenv("MAX_SEQ_LENGTH", 2048))
16
  max_new_tokens = int(os.getenv("MAX_NEW_TOKENS", 512))
17
  self.hf_token = os.getenv("HUGGINGFACE_TOKEN")
 
2
  from typing import Dict, List, Any
3
  from transformers import AutoTokenizer, AutoModelForCausalLM, AutoConfig
4
  import torch
5
+ from peft import PeftModel # Import PeftModel
6
  from dotenv import load_dotenv
7
 
8
  load_dotenv()
 
12
  """
13
  Initializes the model and tokenizer.
14
  """
15
+ # Key settings (from environment variables, with defaults)
16
  max_seq_length = int(os.getenv("MAX_SEQ_LENGTH", 2048))
17
  max_new_tokens = int(os.getenv("MAX_NEW_TOKENS", 512))
18
  self.hf_token = os.getenv("HUGGINGFACE_TOKEN")