Git Product home page Git Product logo

Comments (5)

SanghyukChun avatar SanghyukChun commented on September 27, 2024

Hello, please use Please use the reweighting option for using LBC. You can check the details here:
#1 (comment)

from cgl_fairness.

sangwon-jung94 avatar sangwon-jung94 commented on September 27, 2024

Hi, I'm sorry for a typo. It is iteration, not iter. And the iter argument is used in trainer/rewieghting.py. It represents the number of iterations for outer update of eta in a minimax optimization.

We modified our README as well. Thanks.

from cgl_fairness.

Ethan-Chen-plus avatar Ethan-Chen-plus commented on September 27, 2024

@sangwon79 @SanghyukChun Thanks! However there still exists another error:

Traceback (most recent call last):
  File "/data1/cgl_fairness/main.py", line 124, in <module>
    main()
  File "/data1/cgl_fairness/main.py", line 98, in main
    trainer_.train(train_loader, test_loader, args.epochs, writer=writer)
  File "/data1/cgl_fairness/trainer/reweighting.py", line 46, in train
    weight_set = self.debias_weights(Y_train, S_train, extended_multipliers, num_groups, num_classes)
                 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/data1/cgl_fairness/trainer/reweighting.py", line 207, in debias_weights
    weights = w_matrix[sen_attrs, label]
              ~~~~~~~~^^^^^^^^^^^^^^^^^^
RuntimeError: indices should be either on cpu or on the same device as the indexed tensor (cpu)

so I use this in reweighting.py:

sen_attrs = sen_attrs.to(w_matrix.device)
label = label.to(w_matrix.device)
weights = w_matrix[sen_attrs, label]

It makes it run, but the score keeps in a low degree:
image

from cgl_fairness.

sangwon-jung94 avatar sangwon-jung94 commented on September 27, 2024

Thanks again.
The first issue may be due to the difference in the version of Torch package. It works well in our setting.
We left out a line of code in the process of publishing our code.
The first and second issues have been solved in the modified code. Please git pull again.

from cgl_fairness.

Ethan-Chen-plus avatar Ethan-Chen-plus commented on September 27, 2024

Thanks a lot! This has been solved.

from cgl_fairness.

Related Issues (6)

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.