ApsidalSolid4 commited on
Commit
edd5bd3
·
verified ·
1 Parent(s): 3f8bf20

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +7 -5
app.py CHANGED
@@ -72,11 +72,13 @@ class TextClassifier:
72
  """Initialize the model and tokenizer."""
73
  logger.info("Initializing model and tokenizer...")
74
 
75
- # Remove the use_fast parameter completely
76
- self.tokenizer = AutoTokenizer.from_pretrained(
77
- self.model_name,
78
- model_max_length=MAX_LENGTH
79
- )
 
 
80
 
81
  # First initialize the base model
82
  self.model = AutoModelForSequenceClassification.from_pretrained(
 
72
  """Initialize the model and tokenizer."""
73
  logger.info("Initializing model and tokenizer...")
74
 
75
+ # Download and save tokenizer files locally
76
+ local_tokenizer_path = "tokenizer"
77
+ if not os.path.exists(local_tokenizer_path):
78
+ AutoTokenizer.from_pretrained(self.model_name).save_pretrained(local_tokenizer_path)
79
+
80
+ # Load from local files
81
+ self.tokenizer = AutoTokenizer.from_pretrained(local_tokenizer_path)
82
 
83
  # First initialize the base model
84
  self.model = AutoModelForSequenceClassification.from_pretrained(