Add Vision Transformer demo in computer_vision module#13351
Add Vision Transformer demo in computer_vision module#13351dhruvidave348 wants to merge 12 commits intoTheAlgorithms:masterfrom
Conversation
There was a problem hiding this comment.
Click here to look at the relevant links ⬇️
🔗 Relevant Links
Repository:
Python:
Automated review generated by algorithms-keeper. If there's any problem regarding this review, please open an issue about it.
algorithms-keeper commands and options
algorithms-keeper actions can be triggered by commenting on this PR:
@algorithms-keeper reviewto trigger the checks for only added pull request files@algorithms-keeper review-allto trigger the checks for all the pull request files, including the modified files. As we cannot post review comments on lines not part of the diff, this command will post all the messages in one comment.NOTE: Commands are in beta and so this feature is restricted only to a member or owner of the organization.
| @@ -0,0 +1,2 @@ | |||
| def vision_transformer_demo(): | |||
There was a problem hiding this comment.
As there is no test file in this pull request nor any test function or class in the file computer_vision/vision_transformer.py, please provide doctest for the function vision_transformer_demo
Please provide return type hint for the function: vision_transformer_demo. If the function does not return a value, please provide the type hint as: def function() -> None:
for more information, see https://pre-commit.ci
There was a problem hiding this comment.
Click here to look at the relevant links ⬇️
🔗 Relevant Links
Repository:
Python:
Automated review generated by algorithms-keeper. If there's any problem regarding this review, please open an issue about it.
algorithms-keeper commands and options
algorithms-keeper actions can be triggered by commenting on this PR:
@algorithms-keeper reviewto trigger the checks for only added pull request files@algorithms-keeper review-allto trigger the checks for all the pull request files, including the modified files. As we cannot post review comments on lines not part of the diff, this command will post all the messages in one comment.NOTE: Commands are in beta and so this feature is restricted only to a member or owner of the organization.
| ) from e | ||
|
|
||
|
|
||
| def classify_image(image: Image.Image) -> str: |
There was a problem hiding this comment.
As there is no test file in this pull request nor any test function or class in the file computer_vision/vision_transformer.py, please provide doctest for the function classify_image
| return model.config.id2label[predicted_class_idx] | ||
|
|
||
|
|
||
| def demo(url: str = None) -> None: |
There was a problem hiding this comment.
As there is no test file in this pull request nor any test function or class in the file computer_vision/vision_transformer.py, please provide doctest for the function demo
There was a problem hiding this comment.
Click here to look at the relevant links ⬇️
🔗 Relevant Links
Repository:
Python:
Automated review generated by algorithms-keeper. If there's any problem regarding this review, please open an issue about it.
algorithms-keeper commands and options
algorithms-keeper actions can be triggered by commenting on this PR:
@algorithms-keeper reviewto trigger the checks for only added pull request files@algorithms-keeper review-allto trigger the checks for all the pull request files, including the modified files. As we cannot post review comments on lines not part of the diff, this command will post all the messages in one comment.NOTE: Commands are in beta and so this feature is restricted only to a member or owner of the organization.
| from transformers import ViTForImageClassification, ViTImageProcessor | ||
|
|
||
|
|
||
| def classify_image(image: Image.Image) -> str: |
There was a problem hiding this comment.
As there is no test file in this pull request nor any test function or class in the file computer_vision/vision_transformer.py, please provide doctest for the function classify_image
| return model.config.id2label[predicted_class_idx] | ||
|
|
||
|
|
||
| def demo(url: Optional[str] = None) -> None: |
There was a problem hiding this comment.
As there is no test file in this pull request nor any test function or class in the file computer_vision/vision_transformer.py, please provide doctest for the function demo
for more information, see https://pre-commit.ci
|
Closing require_tests PRs to prepare for Hacktoberfest |
What does this PR do?
vision_transformer.pyfile in thecomputer_visionmodule.vision_transformer_demo()function that prints a message for running a Vision Transformer.Type of change
Checklist: