tensorflow / tensorflow/privacy

ABCMeta object is not subscriptable

Open
#595 1 comment 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
Python
Stars
2k
Forks
477
Avg merge
22h 12m
Merged PRs (30d)
1

Description

I am using tensorflow_privacy package for dp training. The error messages are as follows:

Traceback (most recent call last):
  File "src/synthesize.py", line 9, in <module>
    from p3gm import P3GM
  File "/home/ruc/xiaotong/OpenDataGen/log/20240903/P3GM/src/p3gm.py", line 8, in <module>
    from tensorflow_privacy.privacy.analysis.rdp_accountant import compute_rdp, get_privacy_spent
  File "/home/ruc/xiaotong/OpenDataGen/log/20240903/P3GM/src/tensorflow_privacy/__init__.py", line 61, in <module>
    from tensorflow_privacy.privacy.keras_models.dp_keras_model import DPModel
  File "/home/ruc/xiaotong/OpenDataGen/log/20240903/P3GM/src/tensorflow_privacy/privacy/keras_models/dp_keras_model.py", line 20, in <module>
    from tensorflow_privacy.privacy.fast_gradient_clipping import clip_grads
  File "/home/ruc/xiaotong/OpenDataGen/log/20240903/P3GM/src/tensorflow_privacy/privacy/fast_gradient_clipping/clip_grads.py", line 29, in <module>
    from tensorflow_privacy.privacy.fast_gradient_clipping import common_manip_utils
  File "/home/ruc/xiaotong/OpenDataGen/log/20240903/P3GM/src/tensorflow_privacy/privacy/fast_gradient_clipping/common_manip_utils.py", line 19, in <module>
    from tensorflow_privacy.privacy.fast_gradient_clipping import type_aliases
  File "/home/ruc/xiaotong/OpenDataGen/log/20240903/P3GM/src/tensorflow_privacy/privacy/fast_gradient_clipping/type_aliases.py", line 24, in <module>
    PackedTensors = Union[Tensor, Iterable[Tensor], Mapping[str, Tensor]]
TypeError: 'ABCMeta' object is not subscriptable

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Read tensorflow_privacy/privacy/fast_gradient_clipping/type_aliases.py, especially the PackedTensors definition, and reproduce the failing import from the traceback. Done means the tensorflow_privacy import no longer raises the reported TypeError.

Written by the indexing model from the issue text.

Assessment

Tech stack
python, tensorflow
Domain
machine-learning
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.