Giter Site home page Giter Site logo

easyfl-ai / easyfl Goto Github PK

View Code? Open in Web Editor NEW
295.0 295.0 49.0 2.15 MB

An easy-to-use federated learning platform

License: Apache License 2.0

Makefile 0.07% Dockerfile 0.24% Python 98.53% Shell 1.16%
computer-vision data-privacy deep-learning federated-learning machine-learning

easyfl's People

Contributors

codergan avatar j-bing avatar weimingwill avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar

easyfl's Issues

I have a question about the semi_supervised_evaluation.py script in FedSSL.

` # fine-tune model
if args.use_MLP:
logreg = MLP(num_features, n_classes, 4096)
logreg = logreg.to(device)
else:
logreg = nn.Sequential(nn.Linear(num_features, n_classes))
logreg = logreg.to(device)

# loss / optimizer
criterion = nn.CrossEntropyLoss()
optimizer = torch.optim.Adam(params=logreg.parameters(), lr=args.learning_rate)

# Train fine-tuned model
logreg.train()
resnet.train()
accs = []
for epoch in range(args.num_epochs):
    print("======epoch {}======".format(epoch))
    metrics = defaultdict(list)
    for step, (h, y) in enumerate(train_loader):
        h = h.to(device)
        y = y.to(device)

        outputs = logreg(resnet(h))

        loss = criterion(outputs, y)
        optimizer.zero_grad()
        loss.backward()
        optimizer.step()

        # calculate accuracy and save metrics
        accuracy = (outputs.argmax(1) == y).sum().item() / y.size(0)
        metrics["Loss/train"].append(loss.item())
        metrics["Accuracy/train"].append(accuracy)

    print(f"Epoch [{epoch}/{args.num_epochs}]: " + "\t".join(
        [f"{k}: {np.array(v).mean()}" for k, v in metrics.items()]))

    if epoch % 1 == 0:
        acc = test_whole(resnet, logreg, device, test_loader, args.model_path)
        if epoch <= 100:
            accs.append(acc)
test_whole(resnet, logreg, device, test_loader, args.model_path)
print(args.model_path)
print(f"Best one for 100 epoch is {max(accs):.4f}")`

I have a question about the semi_supervised_evaluation.py script in FedSSL. During the finetuning process, the parameters of the Adam optimizer are set as logreg.parameters(). Does this mean that during finetuning, the parameters of the encoder won't be changed, and only the logreg model will be trained? Is this correct?

object detection dataset

great works!!Can I use the dataset for object detection and how should I modify the configuration?

support for other models

Hi,
I read the configuration file that supports the common DL models. But I have some customized models and non-public datasets as well (for classifying images) and need to use them within this awesome platform. How to apply that?

Accuracy Results for FEDMA

Thank you for your great work!
While I was able to successfully execute the experiments, I encountered a slight discrepancy in the accuracy results. Specifically, I achieved an accuracy of 82.1%, which is slightly lower than the 83.34% reported in the paper.
I want to know ae there any specific environmental or dependency versions that are critical to achieving the reported accuracy?

Bug fixing: GPU runtime

Hi, Thanks for the good work and open source of EasyFL. I am interested in your recent work discussing the SSL + FL.

When I run the FedSSL, I found a bug regarding the GPU runtime.
Specifically, when set up "--gpu 1", it will never use the current GPU. It is caused by the if-condition if args.gpu > 1 in main.py, which will make the self.conf.gpu==0 all the time.

What I revise to make it work:

  1. add else term for if args.gpu > 1: config["gpu"] = args.gpu
  2. change self.conf.device = "cuda" when self.conf.gpu==1 in coordinator.py

BTW, slurm is used for multiple GPU runtime. For those envs not using slurm, I recommend adding some warnings in the code or tutorial to make the multi-GPU configuration clear.

Hope it will help. Thanks for your work.

Spelling problem

does it mean aggregation_strategy.

aggregation_stragtegy: "FedAvg"

How to specify the gpu in the training?

Hello, I want to use gpu speed up the training process. However the default gpu which id is "0" has been occupied. So I want to specify the gpu to train my model. But in the config file I only find the key that specify the number of gpu. So I want to know how to change the config file that I can specify my training gpu id.

Add simulation of resource-constrained scenarios (communication aspect)

Thanks for the excellent code, I have the following questions:

Where should I contribute (add) my code if I want to implement federated learning with limited resources. For example, I need to simulate the delay and energy consumption of weight upload, as well as the distribution of data in each edge node, training delay and energy consumption, etc. In order to achieve the above, I need to add functions, such as increasing the heterogeneity settings of clients, or realizing the bandwidth and network gain of transmission links.

Unfortunately, I don't see a way to do it in the existing code, and it seems that the above simulation is difficult to achieve. How should I insert it?

plotting issue

Hi, I am trying Easyfl but faced some issues with plotting loss graph. is there any supporting material about it?

Evaluation Metrics

Thank you for your good job ! I have a question on how to use it. In the paer "EasyFL: A Low-code Federated Learning Platform For Dummies" it is mentioned that Easyfl offers both qualitatively and quantitavely metrices. However, how can I read model accuracy, total training time, processing time each round?

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.