Spaces:
Sleeping
Sleeping
fix dispatch
Browse files
app.py
CHANGED
@@ -160,8 +160,9 @@ class ModelContext:
|
|
160 |
pipeline = model_manager.load_model(self.model_name)
|
161 |
if hasattr(pipeline, 'reset_device_map'):
|
162 |
pipeline.reset_device_map()
|
163 |
-
#
|
164 |
-
|
|
|
165 |
return pipeline
|
166 |
|
167 |
def __exit__(self, exc_type, exc_val, exc_tb):
|
|
|
160 |
pipeline = model_manager.load_model(self.model_name)
|
161 |
if hasattr(pipeline, 'reset_device_map'):
|
162 |
pipeline.reset_device_map()
|
163 |
+
# Check if the pipeline supports dispatch_model
|
164 |
+
if hasattr(pipeline, 'state_dict'):
|
165 |
+
dispatch_model(pipeline, device_map="auto")
|
166 |
return pipeline
|
167 |
|
168 |
def __exit__(self, exc_type, exc_val, exc_tb):
|