lxuechen / private-transformers

A codebase that makes differentially private training of transformers easy.

Home Page:https://arxiv.org/abs/2110.05679

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

compatibility issue with transformers

kshll6 opened this issue · comments

  1. I installed private-transformers by pip install git+https://github.com/lxuechen/private-transformers.git

  2. I then installed classification requirements by pip install -r classification/requirements.txt

However, there seems to be a combatibility issue: '
ERROR: pip's dependency resolver does not currently take into account all the packages that are installed. This behaviour is the source of the following dependency conflicts.
private-transformers 0.2.3 requires transformers>=4.20.1, but you have transformers 4.16.2 which is incompatible.

I tried to install transformers==4.20.1 but it seems that the requirements file overwrites with version 4.16.2.

I also tried to run pytest tests, but then got:
==================================== ERRORS ====================================
________________ ERROR collecting tests/test_privacy_engine.py _________________
tests/test_privacy_engine.py:37: in
from private_transformers import PrivacyEngine, freeze_isolated_params_for_vit, supported_layers_grad_samplers
private_transformers/init.py:16: in
from .privacy_engine import PrivacyEngine
private_transformers/privacy_engine.py:33: in
from . import autograd_grad_sample, transformers_support
private_transformers/autograd_grad_sample.py:28: in
from .settings import BackwardHookMode
private_transformers/settings.py:48: in
transformers.models.opt.modeling_opt.OPTForCausalLM,
E AttributeError: module 'transformers.models' has no attribute 'opt'
=========================== short test summary info ============================
ERROR tests/test_privacy_engine.py - AttributeError: module 'transformers.models' has no attribute 'opt'
!!!!!!!!!!!!!!!!!!!! Interrupted: 1 error during collection !!!!!!!!!!!!!!!!!!!!
=============================== 1 error in 1.60s ===============================

Update: When I reinstalled private_transformers as in step 1, pytest is working as intended