8000 [feat] Inference API by brettallenyo · Pull Request #798 · facebookresearch/mmf · GitHub
[go: up one dir, main page]

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

[feat] Inference API #798

Closed
wants to merge 1 commit into from
Closed

[feat] Inference API #798

wants to merge 1 commit into from

Conversation

brettallenyo
Copy link
@brettallenyo brettallenyo commented Mar 5, 2021

Added an API to run inference in these
use cases:

  • region features -> mmft
  • region features -> visual_bert

Based on configs, some are provided here,
users can run inference on various
trained models with something as simple
as an image URL and a text query.

Would love for people to take a look and provide
feedback about my coding style and design choices.

If you want to run it on your own you can pull and run

from mmf.utils.inference import Inference

if __name__ == "__main__":
    inference = Inference(checkpoint_path="/checkpoint/brettallen/visualbert")
    answer = inference.forward(
        "http://i.imgur.com/1IWZX69.jpg",
        {"text": "what type of shoes is the woman in pink wearing"},
        image_format="url",
    )
    print(answer)

@facebook-github-bot facebook-github-bot added the CLA Signed Do not delete this pull request or issue due to inactivity. label Mar 5, 2021
@brettallenyo brettallenyo force-pushed the BrettAllen/Encoder branch 2 times, most recently from 2ab71e9 to 3012b7f Compare March 8, 2021 20:05
@brettallenyo brettallenyo changed the title WIP: Inference API Inference API Mar 17, 2021
@brettallenyo brettallenyo force-pushed the BrettAllen/Encoder branch 2 times, most recently from 68ba8d9 to 6a41441 Compare March 18, 2021 19:48
10000
Copy link
Contributor
@facebook-github-bot facebook-github-bot left a comment

Choose a reason for hiding this comment

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

@brettallenyo has imported this pull request. If you are a Facebook employee, you can view this diff on Phabricator.

@facebook-github-bot
Copy link
Contributor

@brettallenyo has updated the pull request. You must reimport the pull request before landing.

Copy link
Contributor
@vedanuj vedanuj left a comment

Choose a reason for hiding this comment

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

This is a great contribution. Please check my comments and address them.

@facebook-github-bot
Copy link
Contributor

@brettallenyo has updated the pull request. You must reimport the pull request before landing.

@facebook-github-bot
Copy link
Contributor

@brettallenyo has updated the pull request. You must reimport the pull request before landing.

17 similar comments
@facebook-github-bot
Copy link
Contributor

@brettallenyo has updated the pull request. You must reimport the pull request before landing.

@facebook-github-bot
Copy link
Contributor

@brettallenyo has updated the pull request. You must reimport the pull request before landing.

@facebook-github-bot
Copy link
Contributor

@brettallenyo has updated the pull request. You must reimport the pull request before landing.

@facebook-github-bot
Copy link
Contributor

@brettallenyo has updated the pull request. You must reimport the pull request before landing.

@facebook-github-bot
Copy link
Contributor

@brettallenyo has updated the pull request. You must reimport the pull request before landing.

@facebook-github-bot
Copy link
Contributor

@brettallenyo has updated the pull request. You must reimport the pull request before landing.

@facebook-github-bot
Copy link
Contributor

@brettallenyo has updated the pull request. You must reimport the pull request before landing.

@facebook-github-bot
Copy link
Contributor

@brettallenyo has updated the pull request. You must reimport the pull request before landing.

@facebook-github-bot
Copy link
Contributor

@brettallenyo has updated the pull request. You must reimport the pull request before landing.

@facebook-github-bot
Copy link
Contributor

@brettallenyo has updated the pull request. You must reimport the pull request before landing.

@facebook-github-bot
Copy link
Contributor

@brettallenyo has updated the pull request. You must reimport the pull request before landing.

@facebook-github-bot
Copy link
Contributor

@brettallenyo has updated the pull request. You must reimport the pull request before landing.

@facebook-github-bot
Copy link
Contributor

@brettallenyo has updated the pull request. You must reimport the pull request before landing.

@facebook-github-bot
Copy link
Contributor

@brettallenyo has updated the pull request. You must reimport the pull request before landing.

@facebook-github-bot
Copy link
Contributor

@brettallenyo has updated the pull request. You must reimport the pull request before landing.

@facebook-github-bot
Copy link
Contributor

@brettallenyo has updated the pull request. You must reimport the pull request before landing.

@facebook-github-bot
Copy link
Contributor

@brettallenyo has updated the pull request. You must reimport the pull request before landing.

@facebook-github-bot
Copy link
Contributor

@brettallenyo has updated the pull request. You must reimport the pull request before landing.

@vedanuj vedanuj changed the title Inference API [feat] Inference API Mar 20, 2021
@facebook-github-bot
Copy link
Contributor

@brettallenyo has updated the pull request. You must reimport the pull request before landing.

@facebook-github-bot
Copy link
Contributor

@brettallenyo has imported this pull request. If you are a Facebook employee, you can view this diff on Phabricator.

@facebook-github-bot
Copy link
Contributor

@brettallenyo has updated the pull request. You must reimport the pull request before landing.

Added an API to run inference in three
use cases:
- region features -> mmft
- region features -> visual_bert
- grid features -> movie_mcan

Based on configs, some are provided here,
users can run inference on various
trained models with something as simple
as an image URL and a text query.
@facebook-github-bot
Copy link
Contributor

@brettallenyo has updated the pull request. You must reimport the pull request before landing.

@facebook-github-bot
Copy link
Contributor

@brettallenyo has imported this pull request. If you are a Facebook employee, you can view this diff on Phabricator.

Copy link
Contributor
@vedanuj vedanuj left a comment

Choose a reason for hiding this comment

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

Thanks for addressing the comments. Looks good to me.

facebook-github-bot pushed a commit that referenced this pull request Mar 24, 2021
Summary:
Added an API to run inference in these
use cases:
- region features -> mmft
- region features -> visual_bert

Based on configs, some are provided here,
users can run inference on various
trained models with something as simple
as an image URL and a text query.

Would love for people to take a look and provide
feedback about my coding style and design choices.

If you want to run it on your own you can pull and run
```
from mmf.utils.inference import Inference

if __name__ == "__main__":
    inference = Inference(checkpoint_path="/checkpoint/brettallen/visualbert")
    answer = inference.forward(
        "http://i.imgur.com/1IWZX69.jpg",
        {"text": "what type of shoes is the woman in pink wearing"},
        image_format="url",
    )
    print(answer)
```

Pull Request resolved: #798

Reviewed By: vedanuj

Differential Revision: D27171794

Pulled By: brettallenyo

fbshipit-source-id: 25b51e5da8cdae944b53970ce1a30b253dee339f
@apsdehal apsdehal deleted the BrettAllen/Encoder branch May 12, 2021 18:55
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
CLA Signed Do not delete this pull request or issue due to inactivity.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants
0