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

Function get_model_modules

diffusers/utils/check_repo.py:231–267  ·  view source on GitHub ↗

Get the model modules inside the transformers library.

()

Source from the content-addressed store, hash-verified

229# If some modeling modules should be ignored for all checks, they should be added in the nested list
230# _ignore_modules of this function.
231def get_model_modules():
232 """Get the model modules inside the transformers library."""
233 _ignore_modules = [
234 "modeling_auto",
235 "modeling_encoder_decoder",
236 "modeling_marian",
237 "modeling_mmbt",
238 "modeling_outputs",
239 "modeling_retribert",
240 "modeling_utils",
241 "modeling_flax_auto",
242 "modeling_flax_encoder_decoder",
243 "modeling_flax_utils",
244 "modeling_speech_encoder_decoder",
245 "modeling_flax_speech_encoder_decoder",
246 "modeling_flax_vision_encoder_decoder",
247 "modeling_transfo_xl_utilities",
248 "modeling_tf_auto",
249 "modeling_tf_encoder_decoder",
250 "modeling_tf_outputs",
251 "modeling_tf_pytorch_utils",
252 "modeling_tf_utils",
253 "modeling_tf_transfo_xl_utilities",
254 "modeling_tf_vision_encoder_decoder",
255 "modeling_vision_encoder_decoder",
256 ]
257 modules = []
258 for model in dir(diffusers.models):
259 # There are some magic dunder attributes in the dir, we ignore them
260 if not model.startswith("__"):
261 model_module = getattr(diffusers.models, model)
262 for submodule in dir(model_module):
263 if submodule.startswith("modeling") and submodule not in _ignore_modules:
264 modeling_module = getattr(model_module, submodule)
265 if inspect.ismodule(modeling_module):
266 modules.append(modeling_module)
267 return modules
268
269
270def get_models(module, include_pretrained=False):

Calls

no outgoing calls

Tested by

no test coverage detected