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

change enums.Device #337

Merged
merged 3 commits into from
Feb 21, 2023
Merged

change enums.Device #337

merged 3 commits into from
Feb 21, 2023

Conversation

wanliAlex
Copy link
Collaborator

@wanliAlex wanliAlex commented Feb 20, 2023

  • What kind of change does this PR introduce? (Bug fix, feature, docs update, ...)
    We change enums.Device from inherited class to class

  • What is the current behavior? (You can also link to an open issue here)
    enums.Device is a inherited class to class

class Device(str, Enum):
    cpu = "cpu"
    cuda = "cuda"
  • What is the new behavior (if this is a feature change)?
    it is now a class with a custom __str__ method.
class Device(str, Enum):
    cpu = "cpu"
    cuda = "cuda"

    def __str__(self):
        # To pass the str(Device.cpu) == "cpu" check in clip
        return self.value
  • Does this PR introduce a breaking change? (What changes might users need to make in their application due to this PR?)

no

  • Have unit tests been run against this PR? (Has there also been any additional testing?)
    no

  • Related Python client changes (link commit/PR here)
    no

  • Related documentation changes (link commit/PR here)
    no

  • Other information:
    We change this due to an odd device check in clip models, which is
    str(Device.cpu) == "cpu", this will return False with inherited class.
    Therefore, we change it to class to solve the problem.

  • Please check if the PR fulfills these requirements

  • The commit message follows our guidelines
  • Tests for the changes have been added (for bug fixes/features)
  • Docs have been added / updated (for bug fixes / features)

@pandu-k
Copy link
Collaborator

pandu-k commented Feb 20, 2023

Does Device validation work with this change?

@wanliAlex wanliAlex temporarily deployed to marqo-test-suite February 20, 2023 03:37 — with GitHub Actions Inactive
@wanliAlex wanliAlex temporarily deployed to marqo-test-suite February 20, 2023 03:37 — with GitHub Actions Inactive
@wanliAlex wanliAlex temporarily deployed to marqo-test-suite February 20, 2023 03:37 — with GitHub Actions Inactive
@wanliAlex wanliAlex temporarily deployed to marqo-test-suite February 20, 2023 03:37 — with GitHub Actions Inactive
@wanliAlex wanliAlex temporarily deployed to marqo-test-suite February 20, 2023 03:37 — with GitHub Actions Inactive
@wanliAlex wanliAlex temporarily deployed to marqo-test-suite February 20, 2023 05:18 — with GitHub Actions Inactive
@pandu-k pandu-k temporarily deployed to marqo-test-suite February 20, 2023 23:42 — with GitHub Actions Inactive
@pandu-k pandu-k merged commit 5dcf4f7 into mainline Feb 21, 2023
@pandu-k pandu-k deleted the device-enum-fix branch February 21, 2023 00:40
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.

2 participants