alibaba / alibaba/FederatedScope

Error when register_model() Custom model

Open
#782 0 comments 0 reactions 0 assignees View on GitHub
Dominant language
Python
Stars
1.5k
Forks
261
PR merge metrics
No merged PRs in 30d

Description

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.
```jsx
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:

```jsx
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!

Contributor guide

No contributing guide indexed for this repository

Research direction

Start with the own-case documentation and the register_model entry point, then compare how register_data adds entries to the registry with how register.model_dict is populated. Confirm why call_fs_net is not present and verify that the custom model can be selected and constructed when registration is working.

Written by the indexing model from the issue text.

Assessment

Tech stack
python, pytorch
Domain
distributed-systems, machine-learning
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
30/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.