GithubHelp home page GithubHelp logo

concept-erasure's People

Contributors

luciaquirke avatar norabelrose 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  avatar  avatar  avatar  avatar  avatar  avatar  avatar

concept-erasure's Issues

torch.where bug

Hi,

Reporting a bug with the latest package version concept-erasure 0.2.1, python 10.4 and torch 1.13.0+cu116.

Screen Shot 2023-08-29 at 15 52 50

The second argument to torch.Tensor.where() has to be a tensor, not a float. Fixed it with the following

Lzeros = torch.zeros(L.shape) W = V * L.rsqrt().where(mask, Lzeros) @ V.mT W_inv = V * L.sqrt().where(mask, Lzeros) @ V.mT

QuadraticEraser doesn't import the same way as LeaceEraser

image
This was the only code that executed in the runtime, and the same thing happens for both CUDA and CPU instances.

Am I wrong in thinking QuadraticEraser is supposed to work the same as LeaceEraser?

Adapting the code from:

QuadraticEraser,

also fails:

!pip install concept-erasure datasets transformers --quiet

from itertools import pairwise, product

import numpy as np
import pytest
import torch
import torch.nn.functional as F
from sklearn.datasets import make_classification
from sklearn.discriminant_analysis import QuadraticDiscriminantAnalysis
from sklearn.linear_model import LogisticRegression
from sklearn.metrics import log_loss
from sklearn.svm import LinearSVC

from concept_erasure import (
    ErasureMethod,
    LeaceFitter,
    OracleEraser,
    OracleFitter,
    QuadraticEraser,
    optimal_linear_shrinkage,
)
from concept_erasure.optimal_transport import is_positive_definite

Applying this during decoding time

Hi, thanks for repository and paper. Is it possible to apply this to generation tasks in language models and not just classification ?
I am very interested in this aspect. Also, just to confirm, the scrubber is a technique that is applied during inference and doesn't modify model parameters right ? It only modifies hidden representations ?

Sample Code for Simple Use Case?

Hi, would it be possible to provide a very simply sample to patch a llama model removing a specific singular text concept from the model? The sample provided on the README is slightly confusing

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.