MCPcopy Create free account
hub / github.com/YesianRohn/TextSSR / _get_task_class

Function _get_task_class

diffusers/src/diffusers/pipelines/auto_pipeline.py:215–230  ·  view source on GitHub ↗
(mapping, pipeline_class_name, throw_error_if_not_exist: bool = True)

Source from the content-addressed store, hash-verified

213
214
215def _get_task_class(mapping, pipeline_class_name, throw_error_if_not_exist: bool = True):
216 def get_model(pipeline_class_name):
217 for task_mapping in SUPPORTED_TASKS_MAPPINGS:
218 for model_name, pipeline in task_mapping.items():
219 if pipeline.__name__ == pipeline_class_name:
220 return model_name
221
222 model_name = get_model(pipeline_class_name)
223
224 if model_name is not None:
225 task_class = mapping.get(model_name, None)
226 if task_class is not None:
227 return task_class
228
229 if throw_error_if_not_exist:
230 raise ValueError(f"AutoPipeline can't find a pipeline linked to {pipeline_class_name} for {model_name}")
231
232
233class AutoPipelineForText2Image(ConfigMixin):

Callers 7

_get_connected_pipelineFunction · 0.85
from_pretrainedMethod · 0.85
from_pipeMethod · 0.85
from_pretrainedMethod · 0.85
from_pipeMethod · 0.85
from_pretrainedMethod · 0.85
from_pipeMethod · 0.85

Calls 1

get_modelFunction · 0.85

Tested by

no test coverage detected