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

Logger bug fix #551

Merged
merged 1 commit into from
Oct 22, 2021
Merged

Logger bug fix #551

merged 1 commit into from
Oct 22, 2021

Conversation

agv7
Copy link
Contributor

@agv7 agv7 commented Oct 22, 2021

What does this PR do?

Solves the "module 'textattack' has no attribute 'shared'" error that comes up whenever doing "from textattack.augmentation import EmbeddingAugmenter".

Before Change:
loggerbug_before

After Change:
loggerbug_after

Summary

Earlier, there was "logger = textattack.shared.utils.logger", but according to https://stackoverflow.com/questions/8899198/module-has-no-attribute and the current way that attacker.py uses logger (https://github.com/QData/TextAttack/blob/907ec46556d8c36bfe62b4db0484dfcbd9b706db/textattack/attacker.py), it looks like the best way to solve the problem is to replace the line with a direct import. The problem earlier was that there was no direct way to get the attribute logger, but this PR should fix that problem.

Additions

  • The line "from textattack.shared.utils import logger" has been added.

Changes

  • The line "logger = textattack.shared.utils.logger" has been changed to "from textattack.shared.utils import logger".

Deletions

  • The line "logger = textattack.shared.utils.logger" has been deleted.

Checklist

  • The title of your pull request should be a summary of its contribution.
  • Please write detailed description of what parts have been newly added and what parts have been modified. Please also explain why certain changes were made.
  • If your pull request addresses an issue, please mention the issue number in the pull request description to make sure they are linked (and people consulting the issue know you are working on it)
  • To indicate a work in progress please mark it as a draft on Github.
  • Make sure existing tests pass.
  • Add relevant tests. No quality testing = no merge.
  • All public methods must have informative docstrings that work nicely with sphinx. For new modules/files, please add/modify the appropriate .rst file in TextAttack/docs/apidoc.'

@agv7 agv7 mentioned this pull request Oct 22, 2021
1 task
@@ -25,8 +26,6 @@
from .models.wrappers import ModelWrapper
from .training_args import CommandLineTrainingArgs, TrainingArgs

logger = textattack.shared.utils.logger
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

should we still initiate the logger, but this time with something like logger = logger?

Copy link
Contributor Author

@agv7 agv7 Oct 22, 2021

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think the logger variable gets defined through the import itself, so it might not be needed.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@Hanyu-Liu-123 is this ready to merge? The import makes sense!

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good to me! Thank you @ankitgv0

@agv7 agv7 marked this pull request as ready for review October 22, 2021 03:06
@qiyanjun qiyanjun merged commit 1918bfd into QData:master Oct 22, 2021
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

Successfully merging this pull request may close these issues.

3 participants