(*names)
| 11 | |
| 12 | |
| 13 | def register_model(*names): |
| 14 | # either pass a list or a single alias. |
| 15 | # function receives them as a tuple of strings |
| 16 | |
| 17 | def decorate(cls): |
| 18 | for name in names: |
| 19 | assert issubclass( |
| 20 | cls, LM |
| 21 | ), f"Model '{name}' ({cls.__name__}) must extend LM class" |
| 22 | |
| 23 | assert ( |
| 24 | name not in MODEL_REGISTRY |
| 25 | ), f"Model named '{name}' conflicts with existing model! Please register with a non-conflicting alias instead." |
| 26 | |
| 27 | MODEL_REGISTRY[name] = cls |
| 28 | return cls |
| 29 | |
| 30 | return decorate |
| 31 | |
| 32 | |
| 33 | def get_model(model_name): |
nothing calls this directly
no outgoing calls
no test coverage detected