jbilcke-hf HF staff commited on
Commit
53c0486
1 Parent(s): 2745124

Update handler.py

Browse files
Files changed (1) hide show
  1. handler.py +23 -2
handler.py CHANGED
@@ -157,9 +157,30 @@ class EndpointHandler:
157
  tmp_vae_path = setup_vae_path(original_vae_path)
158
 
159
  # Override the VAE path in constants to use our temporary directory
160
- from hyvideo.constants import VAE_PATH
161
  VAE_PATH["884-16c-hy"] = str(tmp_vae_path)
162
  logger.info(f"Updated VAE_PATH to: {VAE_PATH['884-16c-hy']}")
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
163
 
164
  self.args.dit_weight = str(dit_weight_path)
165
 
@@ -175,7 +196,7 @@ class EndpointHandler:
175
  except Exception as e:
176
  logger.error(f"Error initializing model: {str(e)}")
177
  raise
178
-
179
  def __call__(self, data: Dict[str, Any]) -> Dict[str, Any]:
180
  """Process a single request"""
181
  # Log incoming request
 
157
  tmp_vae_path = setup_vae_path(original_vae_path)
158
 
159
  # Override the VAE path in constants to use our temporary directory
160
+ from hyvideo.constants import VAE_PATH, TEXT_ENCODER_PATH, TOKENIZER_PATH
161
  VAE_PATH["884-16c-hy"] = str(tmp_vae_path)
162
  logger.info(f"Updated VAE_PATH to: {VAE_PATH['884-16c-hy']}")
163
+
164
+ # Update text encoder paths to use absolute paths
165
+ text_encoder_path = str(Path(path) / "text_encoder")
166
+ text_encoder_2_path = str(Path(path) / "text_encoder_2")
167
+
168
+ # Update both text encoder and tokenizer paths
169
+ TEXT_ENCODER_PATH.update({
170
+ "llm": text_encoder_path,
171
+ "clipL": text_encoder_2_path
172
+ })
173
+
174
+ TOKENIZER_PATH.update({
175
+ "llm": text_encoder_path,
176
+ "clipL": text_encoder_2_path
177
+ })
178
+
179
+ logger.info(f"Updated text encoder paths:")
180
+ logger.info(f"TEXT_ENCODER_PATH['llm']: {TEXT_ENCODER_PATH['llm']}")
181
+ logger.info(f"TEXT_ENCODER_PATH['clipL']: {TEXT_ENCODER_PATH['clipL']}")
182
+ logger.info(f"TOKENIZER_PATH['llm']: {TOKENIZER_PATH['llm']}")
183
+ logger.info(f"TOKENIZER_PATH['clipL']: {TOKENIZER_PATH['clipL']}")
184
 
185
  self.args.dit_weight = str(dit_weight_path)
186
 
 
196
  except Exception as e:
197
  logger.error(f"Error initializing model: {str(e)}")
198
  raise
199
+
200
  def __call__(self, data: Dict[str, Any]) -> Dict[str, Any]:
201
  """Process a single request"""
202
  # Log incoming request