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

Error when register_model() Custom model #782

Open
HansJack1999 opened this issue Aug 27, 2024 · 0 comments
Open

Error when register_model() Custom model #782

HansJack1999 opened this issue Aug 27, 2024 · 0 comments

Comments

@HansJack1999
Copy link

I am encountering an issue while trying to build my own model following the guide provided in the documentation(https://federatedscope.io/docs/own-case/). Unfortunately, it seems that the register function for my custom model is not taking effect.

I did not install the library using pip install ., but instead, I am running the code directly from the source. I have set DEV_MODE = True in the main function as recommended.

While I was able to successfully register my custom data using the register function, I ran into a problem with registering my custom model. Upon stepping through the code, I noticed that only the preset models (like fedsam_conv2, resnet, and mynet) were registered in register.model_dict, but my custom model was not.

for func in register.model_dict.values():
        model = func(model_config, input_shape)
        if model is not None:
            return model
register_model("FS-Net", call_fs_net)

My data register function register_data("ISCX", call_file_data) can be executed, but register_model("FS-Net", call_fs_net) is not executed.Here is a version of the relevant code I am using:

def call_fs_net(model_config, local_data):
    if model_config.type == "FS-Net":
        model = ModelBuilder(model_config)
        return model


register_model("FS-Net", call_fs_net)

I would greatly appreciate any guidance or suggestions you could provide to help me resolve this issue. Thank you for your time and support!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant