Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

change: Model interface loading #117

Open
mathysgrapotte opened this issue Feb 19, 2025 · 0 comments
Open

change: Model interface loading #117

mathysgrapotte opened this issue Feb 19, 2025 · 0 comments

Comments

@mathysgrapotte
Copy link
Owner

Is your change request related to a problem? Please describe.

Current interface loading in utils/launch_utils.py loads a model from file if the class is named Model. This lacks flexibility.

Describe the solution you'd like

Have a register decorator would be best :

# In model files
from stimulus import register_model

@register_model
class ModelTitanic(...):
    ...

we could then validate the interface using a small validation method :

def validate_model_interface(cls):
    required_methods = ['forward', 'compute_loss', 'batch']
    for method in required_methods:
        if not hasattr(cls, method):
            raise ModelInterfaceError(f"Model {cls.__name__} missing {method}")
@mathysgrapotte mathysgrapotte moved this to Todo - mid issues in Stimulus v1.0 Feb 19, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
Status: Todo
Development

No branches or pull requests

1 participant