Code Monkey home page Code Monkey logo

editbias's Introduction

EditBias: Debiasing Language Models via Model Editing

Setup

Environment

This codebase uses Python 3.9.18. Other versions may work as well.

Create an environment and install the dependencies:

$ conda create -n editbias python=3.9
$ conda activate editbias
(editbias) $ pip install -r requirements.txt

EditBias

  • Training

     (editbias) $ bash scripts/gpt2-xl.sh >scripts/gpt2-xl.log 2>&1

    Record the path $p_1$ of the final parameters of the editor networks in the training log.

  • Evaluation

    1. Set archive as $p_1$ in the evaluation script.

    2. Run bash scripts/gpt2-xl_eval.sh >scripts/gpt2-xl_eval.log 2>&1 and record the output path $p_2$ in the evaluation log.

    3. Set root as $p_2$ in res.py and run python res.py

Bias Tracing

Enter bias_tracing

Run the scripts bash scripts/gpt2.sh or bash scripts/roberta.sh.

Citing the paper

If this code or paper was useful, please consider using the following citation:

@article{xinxu2023EditBias,
    title={EditBias: Debiasing Language Models via Model Editing},
    author={Xin Xu, Wei Xu, Ningyu Zhang},
    year={2023},
    url={https://github.com/xxupiano/EditBias}
}

editbias's People

Contributors

xxupiano avatar

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.