MCPcopy Index your code
hub / github.com/modelscope/DiffSynth-Studio / load_model

Function load_model

apps/gradio/entity_level_control.py:156–173  ·  view source on GitHub ↗
(model_type='FLUX', model_path='FLUX.1-dev')

Source from the content-addressed store, hash-verified

154model_dict = {}
155
156def load_model(model_type='FLUX', model_path='FLUX.1-dev'):
157 global model_dict
158 model_key = f"{model_type}:{model_path}"
159 if model_key in model_dict:
160 return model_dict[model_key]
161 model_path = os.path.join(config["model_config"][model_type]["model_folder"], model_path)
162 model_manager = ModelManager(torch_dtype=torch.bfloat16, device="cuda", model_id_list=["FLUX.1-dev"])
163 model_manager.load_lora(
164 download_customized_models(
165 model_id="DiffSynth-Studio/Eligen",
166 origin_file_path="model_bf16.safetensors",
167 local_dir="models/lora/entity_control",
168 ),
169 lora_alpha=1,
170 )
171 pipe = config["model_config"][model_type]["pipeline_class"].from_model_manager(model_manager)
172 model_dict[model_key] = model_manager, pipe
173 return model_manager, pipe
174
175
176with gr.Blocks() as app:

Callers 2

initialize_modelFunction · 0.70
generate_imageFunction · 0.70

Calls 4

load_loraMethod · 0.95
ModelManagerClass · 0.90
from_model_managerMethod · 0.45

Tested by

no test coverage detected