GithubHelp home page GithubHelp logo

Comments (3)

rayrayraykk avatar rayrayraykk commented on July 28, 2024

Hello!

Thank you for bringing this to our attention. It appears that the tutorial could indeed be slightly outdated. To align with the current state of the codebase, the correct implementation of the function should be like this:

def call_my_data(config, client_config=None):
    pass

Please note that if you encounter any issues while implementing the function, feel free to ask for further clarification.
Additionally, if you come across any other content in the tutorials that seems out of date, do let us know so that we can update the information accordingly.

Thank you for your contribution!

from federatedscope.

stupidhhh avatar stupidhhh commented on July 28, 2024

Thank you for bringing this to our attention. It appears that the tutorial could indeed be slightly outdated. To align with the current state of the codebase, the correct implementation of the function should be like this:

Thank you for your answer, but I have a new problem after changing the code, the new problem is as follows:
image
The complete code is below:

from torchvision.datasets import MNIST
from torchvision.transforms import transforms

from federatedscope.core.data import BaseDataTranslator
from federatedscope.register import register_data


def load_my_data(config, client_cfgs=None):
    transform = transforms.Compose([
        transforms.ToTensor(),
        transforms.Normalize(mean=[0.1307], std=[0.3081])
    ])
    data_train = MNIST(root='data', train=True, transform=transform, download=True)
    data_test = MNIST(root='data', train=False, transform=transform, download=True)
    translator = BaseDataTranslator(config, client_cfgs)
    fs_data = translator([data_train, [], data_test])
    return fs_data, config


def call_my_data(config, client_config=None):
    pass


register_data("mydata", call_my_data)

I changed the value of data.type in the scripts.example_configs.femnist.yaml file to mydata and ran federatedscope.main.py with this config file.

from federatedscope.

rayrayraykk avatar rayrayraykk commented on July 28, 2024

The pass in my past answer is code omitted for brevity, and you should implement it like this:

# ... [code omitted for brevity]

def call_my_data(config, client_config=None):
     if config.data.type == "mydata":
         data, modified_config = load_my_data(config)
         return data, modified_config

# ... [code omitted for brevity]

from federatedscope.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.