Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

AttributeError: 'AvgNonZeroReducer' object has no attribute 'triplets_past_filter' #6

Open
zouxianghong opened this issue May 15, 2024 · 2 comments

Comments

@zouxianghong
Copy link

When I tried to run the following code, one error occurred.
python training/train.py --config config/protocols/4-step.yaml --train_environment pickles/Oxford/Oxford_train_queries.pickle

Error info:
Traceback (most recent call last): File "/home/ericxhzou/Code/InCloud/training/train.py", line 44, in <module> trained_model = trainer.train() File "/home/ericxhzou/Code/InCloud/training/trainer.py", line 122, in train self.training_step(batch, positives_mask, negatives_mask) File "/home/ericxhzou/Code/InCloud/training/trainer.py", line 84, in training_step loss_place_rec, num_triplets, non_zero_triplets, embedding_norm = self.loss_fn(embeddings, positives_mask, negatives_mask) File "/home/ericxhzou/Code/InCloud/losses/pr_loss.py", line 80, in __call__ 'num_non_zero_triplets': self.loss_fn.reducer.triplets_past_filter, File "/root/.pyenv/versions/3.10.13/lib/python3.10/site-packages/torch/nn/modules/module.py", line 1269, in __getattr__ raise AttributeError("'{}' object has no attribute '{}'".format( AttributeError: 'AvgNonZeroReducer' object has no attribute 'triplets_past_filter'

@Thunder-Volcano
Copy link

The python version may be not right. You can try python version 3.8 in your conda env.

@JBKnights
Copy link
Collaborator

Hi there! This issue is usually from using the newer version of pytorch_metric_learning from my experience; try downgrading to an older version using pip install pytorch_metric_learning==1.6.3 and see if that works?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants