-
Notifications
You must be signed in to change notification settings - Fork 607
[llava][21/N] Add llava runner test binary and build script #4667
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
Conversation
As titled. This PR moves the token generation loop in llama2 runner into a new class so it can be reused. [ghstack-poisoned]
…o a class" As titled. This PR moves the token generation loop in llama2 runner into a new class so it can be reused. Differential Revision: [D61047601](https://our.internmc.facebook.com/intern/diff/D61047601) [ghstack-poisoned]
As titled. This PR moves the token generation loop in llama2 runner into a new class so it can be reused. Differential Revision: [D61047601](https://our.internmc.facebook.com/intern/diff/D61047601) [ghstack-poisoned]
[ghstack-poisoned]
[ghstack-poisoned]
[ghstack-poisoned]
🔗 Helpful Links🧪 See artifacts and rendered test results at hud.pytorch.org/pr/pytorch/executorch/4667
Note: Links to docs will display an error until the docs builds have been completed. ✅ No FailuresAs of commit 5b687ce with merge base 84100d1 ( This comment was automatically generated by Dr. CI and updates every 15 minutes. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Lgtm after linter/nits, thank you
… and build script" Add a `main.cpp` and CMakeLists.txt for llava runner. This runner takes in an image in the format of `.pt` (a serialized pytorch model) along with text prompt. It will generate text tokens in a way similar to llama runner. Run `build.sh` to build the runner. To serialize the image into a `.pt` file, run the following script: ```python import torch from torch import nn copy = torch.tensor(resized) m = nn.Module() par = nn.Parameter(copy, requires_grad=False) m.register_parameter("0",par) tensors = torch.jit.script(m) tensors.save("image.pt") ``` To run the runner, use the following command: ``` cmake-out/examples/models/llava/llava_main \ --tokenizer_path tokenizer.bin \ --model_path llava_kv_768.pte \ --prompt "\nWhat are the things I should be cautious about when I visit here?" \ --image_path image.pt \ --temperature 0 ``` [ghstack-poisoned]
Add a `main.cpp` and CMakeLists.txt for llava runner. This runner takes in an image in the format of `.pt` (a serialized pytorch model) along with text prompt. It will generate text tokens in a way similar to llama runner. Run `build.sh` to build the runner. To serialize the image into a `.pt` file, run the following script: ```python import torch from torch import nn copy = torch.tensor(resized) m = nn.Module() par = nn.Parameter(copy, requires_grad=False) m.register_parameter("0",par) tensors = torch.jit.script(m) tensors.save("image.pt") ``` To run the runner, use the following command: ``` cmake-out/examples/models/llava/llava_main \ --tokenizer_path tokenizer.bin \ --model_path llava_kv_768.pte \ --prompt "\nWhat are the things I should be cautious about when I visit here?" \ --image_path image.pt \ --temperature 0 ``` [ghstack-poisoned]
… and build script" Add a `main.cpp` and CMakeLists.txt for llava runner. This runner takes in an image in the format of `.pt` (a serialized pytorch model) along with text prompt. It will generate text tokens in a way similar to llama runner. Run `build.sh` to build the runner. To serialize the image into a `.pt` file, run the following script: ```python import torch from torch import nn copy = torch.tensor(resized) m = nn.Module() par = nn.Parameter(copy, requires_grad=False) m.register_parameter("0",par) tensors = torch.jit.script(m) tensors.save("image.pt") ``` To run the runner, use the following command: ``` cmake-out/examples/models/llava/llava_main \ --tokenizer_path tokenizer.bin \ --model_path llava_kv_768.pte \ --prompt "\nWhat are the things I should be cautious about when I visit here?" \ --image_path image.pt \ --temperature 0 ``` [ghstack-poisoned]
Add a `main.cpp` and CMakeLists.txt for llava runner. This runner takes in an image in the format of `.pt` (a serialized pytorch model) along with text prompt. It will generate text tokens in a way similar to llama runner. Run `build.sh` to build the runner. To serialize the image into a `.pt` file, run the following script: ```python import torch from torch import nn copy = torch.tensor(resized) m = nn.Module() par = nn.Parameter(copy, requires_grad=False) m.register_parameter("0",par) tensors = torch.jit.script(m) tensors.save("image.pt") ``` To run the runner, use the following command: ``` cmake-out/examples/models/llava/llava_main \ --tokenizer_path tokenizer.bin \ --model_path llava_kv_768.pte \ --prompt "\nWhat are the things I should be cautious about when I visit here?" \ --image_path image.pt \ --temperature 0 ``` [ghstack-poisoned]
@larryliu0820 has imported this pull request. If you are a Meta employee, you can view this diff on Phabricator. |
@larryliu0820 has imported this pull request. If you are a Meta employee, you can view this diff on Phabricator. |
1 similar comment
@larryliu0820 has imported this pull request. If you are a Meta employee, you can view this diff on Phabricator. |
… and build script" Add a `main.cpp` and CMakeLists.txt for llava runner. This runner takes in an image in the format of `.pt` (a serialized pytorch model) along with text prompt. It will generate text tokens in a way similar to llama runner. Run `build.sh` to build the runner. To serialize the image into a `.pt` file, run the following script: ```python import torch from torch import nn copy = torch.tensor(resized) m = nn.Module() par = nn.Parameter(copy, requires_grad=False) m.register_parameter("0",par) tensors = torch.jit.script(m) tensors.save("image.pt") ``` To run the runner, use the following command: ``` cmake-out/examples/models/llava/llava_main \ --tokenizer_path tokenizer.bin \ --model_path llava_kv_768.pte \ --prompt "\nWhat are the things I should be cautious about when I visit here?" \ --image_path image.pt \ --temperature 0 ``` Differential Revision: [D61146432](https://www.internalfb.com/diff/D61146432) [ghstack-poisoned]
Add a `main.cpp` and CMakeLists.txt for llava runner. This runner takes in an image in the format of `.pt` (a serialized pytorch model) along with text prompt. It will generate text tokens in a way similar to llama runner. Run `build.sh` to build the runner. To serialize the image into a `.pt` file, run the following script: ```python import torch from torch import nn copy = torch.tensor(resized) m = nn.Module() par = nn.Parameter(copy, requires_grad=False) m.register_parameter("0",par) tensors = torch.jit.script(m) tensors.save("image.pt") ``` To run the runner, use the following command: ``` cmake-out/examples/models/llava/llava_main \ --tokenizer_path tokenizer.bin \ --model_path llava_kv_768.pte \ --prompt "\nWhat are the things I should be cautious about when I visit here?" \ --image_path image.pt \ --temperature 0 ``` Differential Revision: [D61146432](https://www.internalfb.com/diff/D61146432) [ghstack-poisoned]
@larryliu0820 has imported this pull request. If you are a Meta employee, you can view this diff on Phabricator. |
… and build script" Add a `main.cpp` and CMakeLists.txt for llava runner. This runner takes in an image in the format of `.pt` (a serialized pytorch model) along with text prompt. It will generate text tokens in a way similar to llama runner. Run `build.sh` to build the runner. To serialize the image into a `.pt` file, run the following script: ```python import torch from torch import nn copy = torch.tensor(resized) m = nn.Module() par = nn.Parameter(copy, requires_grad=False) m.register_parameter("0",par) tensors = torch.jit.script(m) tensors.save("image.pt") ``` To run the runner, use the following command: ``` cmake-out/examples/models/llava/llava_main \ --tokenizer_path tokenizer.bin \ --model_path llava_kv_768.pte \ --prompt "\nWhat are the things I should be cautious about when I visit here?" \ --image_path image.pt \ --temperature 0 ``` Differential Revision: [D61146432](https://www.internalfb.com/diff/D61146432) [ghstack-poisoned]
Add a `main.cpp` and CMakeLists.txt for llava runner. This runner takes in an image in the format of `.pt` (a serialized pytorch model) along with text prompt. It will generate text tokens in a way similar to llama runner. Run `build.sh` to build the runner. To serialize the image into a `.pt` file, run the following script: ```python import torch from torch import nn copy = torch.tensor(resized) m = nn.Module() par = nn.Parameter(copy, requires_grad=False) m.register_parameter("0",par) tensors = torch.jit.script(m) tensors.save("image.pt") ``` To run the runner, use the following command: ``` cmake-out/examples/models/llava/llava_main \ --tokenizer_path tokenizer.bin \ --model_path llava_kv_768.pte \ --prompt "\nWhat are the things I should be cautious about when I visit here?" \ --image_path image.pt \ --temperature 0 ``` Differential Revision: [D61146432](https://www.internalfb.com/diff/D61146432) [ghstack-poisoned]
@larryliu0820 has imported this pull request. If you are a Meta employee, you can view this diff on Phabricator. |
Summary: Add a `main.cpp` and CMakeLists.txt for llava runner. This runner takes in an image in the format of `.pt` (a serialized pytorch model) along with text prompt. It will generate text tokens in a way similar to llama runner. Run `build.sh` to build the runner. To serialize the image into a `.pt` file, run the following script: ```python import torch from torch import nn copy = torch.tensor(resized) m = nn.Module() par = nn.Parameter(copy, requires_grad=False) m.register_parameter("0",par) tensors = torch.jit.script(m) tensors.save("image.pt") ``` To run the runner, use the following command: ``` cmake-out/examples/models/llava/llava_main \ --tokenizer_path tokenizer.bin \ --model_path llava_kv_768.pte \ --prompt "\nWhat are the things I should be cautious about when I visit here?" \ --image_path image.pt \ --temperature 0 ``` imported-using-ghimport Test Plan: Imported from OSS Reviewed By: kirklandsign Differential Revision: D61146432 Pulled By: larryliu0820
… and build script" Add a `main.cpp` and CMakeLists.txt for llava runner. This runner takes in an image in the format of `.pt` (a serialized pytorch model) along with text prompt. It will generate text tokens in a way similar to llama runner. Run `build.sh` to build the runner. To serialize the image into a `.pt` file, run the following script: ```python import torch from torch import nn copy = torch.tensor(resized) m = nn.Module() par = nn.Parameter(copy, requires_grad=False) m.register_parameter("0",par) tensors = torch.jit.script(m) tensors.save("image.pt") ``` To run the runner, use the following command: ``` cmake-out/examples/models/llava/llava_main \ --tokenizer_path tokenizer.bin \ --model_path llava_kv_768.pte \ --prompt "\nWhat are the things I should be cautious about when I visit here?" \ --image_path image.pt \ --temperature 0 ``` Differential Revision: [D61146432](https://www.internalfb.com/diff/D61146432) [ghstack-poisoned]
Add a `main.cpp` and CMakeLists.txt for llava runner. This runner takes in an image in the format of `.pt` (a serialized pytorch model) along with text prompt. It will generate text tokens in a way similar to llama runner. Run `build.sh` to build the runner. To serialize the image into a `.pt` file, run the following script: ```python import torch from torch import nn copy = torch.tensor(resized) m = nn.Module() par = nn.Parameter(copy, requires_grad=False) m.register_parameter("0",par) tensors = torch.jit.script(m) tensors.save("image.pt") ``` To run the runner, use the following command: ``` cmake-out/examples/models/llava/llava_main \ --tokenizer_path tokenizer.bin \ --model_path llava_kv_768.pte \ --prompt "\nWhat are the things I should be cautious about when I visit here?" \ --image_path image.pt \ --temperature 0 ``` Differential Revision: [D61146432](https://www.internalfb.com/diff/D61146432) [ghstack-poisoned]
@larryliu0820 has imported this pull request. If you are a Meta employee, you can view this diff on Phabricator. |
Summary: Pull Request resolved: #4750 Pull Request resolved: #4667 Add a `main.cpp` and CMakeLists.txt for llava runner. This runner takes in an image in the format of `.pt` (a serialized pytorch model) along with text prompt. It will generate text tokens in a way similar to llama runner. Run `build.sh` to build the runner. To serialize the image into a `.pt` file, run the following script: ```python import torch from torch import nn copy = torch.tensor(resized) m = nn.Module() par = nn.Parameter(copy, requires_grad=False) m.register_parameter("0",par) tensors = torch.jit.script(m) tensors.save("image.pt") ``` To run the runner, use the following command: ``` cmake-out/examples/models/llava/llava_main \ --tokenizer_path tokenizer.bin \ --model_path llava_kv_768.pte \ --prompt "\nWhat are the things I should be cautious about when I visit here?" \ --image_path image.pt \ --temperature 0 ``` imported-using-ghimport Test Plan: Imported from OSS Reviewed By: kirklandsign Differential Revision: D61146432 Pulled By: larryliu0820
… and build script" Add a `main.cpp` and CMakeLists.txt for llava runner. This runner takes in an image in the format of `.pt` (a serialized pytorch model) along with text prompt. It will generate text tokens in a way similar to llama runner. Run `build.sh` to build the runner. To serialize the image into a `.pt` file, run the following script: ```python import torch from torch import nn copy = torch.tensor(resized) m = nn.Module() par = nn.Parameter(copy, requires_grad=False) m.register_parameter("0",par) tensors = torch.jit.script(m) tensors.save("image.pt") ``` To run the runner, use the following command: ``` cmake-out/examples/models/llava/llava_main \ --tokenizer_path tokenizer.bin \ --model_path llava_kv_768.pte \ --prompt "\nWhat are the things I should be cautious about when I visit here?" \ --image_path image.pt \ --temperature 0 ``` Differential Revision: [D61146432](https://www.internalfb.com/diff/D61146432) [ghstack-poisoned]
Add a `main.cpp` and CMakeLists.txt for llava runner. This runner takes in an image in the format of `.pt` (a serialized pytorch model) along with text prompt. It will generate text tokens in a way similar to llama runner. Run `build.sh` to build the runner. To serialize the image into a `.pt` file, run the following script: ```python import torch from torch import nn copy = torch.tensor(resized) m = nn.Module() par = nn.Parameter(copy, requires_grad=False) m.register_parameter("0",par) tensors = torch.jit.script(m) tensors.save("image.pt") ``` To run the runner, use the following command: ``` cmake-out/examples/models/llava/llava_main \ --tokenizer_path tokenizer.bin \ --model_path llava_kv_768.pte \ --prompt "\nWhat are the things I should be cautious about when I visit here?" \ --image_path image.pt \ --temperature 0 ``` Differential Revision: [D61146432](https://www.internalfb.com/diff/D61146432) [ghstack-poisoned]
@larryliu0820 has imported this pull request. If you are a Meta employee, you can view this diff on Phabricator. |
Summary: Pull Request resolved: #4750 Pull Request resolved: #4667 Add a `main.cpp` and CMakeLists.txt for llava runner. This runner takes in an image in the format of `.pt` (a serialized pytorch model) along with text prompt. It will generate text tokens in a way similar to llama runner. Run `build.sh` to build the runner. To serialize the image into a `.pt` file, run the following script: ```python import torch from torch import nn copy = torch.tensor(resized) m = nn.Module() par = nn.Parameter(copy, requires_grad=False) m.register_parameter("0",par) tensors = torch.jit.script(m) tensors.save("image.pt") ``` To run the runner, use the following command: ``` cmake-out/examples/models/llava/llava_main \ --tokenizer_path tokenizer.bin \ --model_path llava_kv_768.pte \ --prompt "\nWhat are the things I should be cautious about when I visit here?" \ --image_path image.pt \ --temperature 0 ``` imported-using-ghimport Test Plan: Imported from OSS Reviewed By: kirklandsign Differential Revision: D61146432 Pulled By: larryliu0820
… and build script" Add a `main.cpp` and CMakeLists.txt for llava runner. This runner takes in an image in the format of `.pt` (a serialized pytorch model) along with text prompt. It will generate text tokens in a way similar to llama runner. Run `build.sh` to build the runner. To serialize the image into a `.pt` file, run the following script: ```python import torch from torch import nn copy = torch.tensor(resized) m = nn.Module() par = nn.Parameter(copy, requires_grad=False) m.register_parameter("0",par) tensors = torch.jit.script(m) tensors.save("image.pt") ``` To run the runner, use the following command: ``` cmake-out/examples/models/llava/llava_main \ --tokenizer_path tokenizer.bin \ --model_path llava_kv_768.pte \ --prompt "\nWhat are the things I should be cautious about when I visit here?" \ --image_path image.pt \ --temperature 0 ``` Differential Revision: [D61146432](https://www.internalfb.com/diff/D61146432) [ghstack-poisoned]
Add a `main.cpp` and CMakeLists.txt for llava runner. This runner takes in an image in the format of `.pt` (a serialized pytorch model) along with text prompt. It will generate text tokens in a way similar to llama runner. Run `build.sh` to build the runner. To serialize the image into a `.pt` file, run the following script: ```python import torch from torch import nn copy = torch.tensor(resized) m = nn.Module() par = nn.Parameter(copy, requires_grad=False) m.register_parameter("0",par) tensors = torch.jit.script(m) tensors.save("image.pt") ``` To run the runner, use the following command: ``` cmake-out/examples/models/llava/llava_main \ --tokenizer_path tokenizer.bin \ --model_path llava_kv_768.pte \ --prompt "\nWhat are the things I should be cautious about when I visit here?" \ --image_path image.pt \ --temperature 0 ``` Differential Revision: [D61146432](https://www.internalfb.com/diff/D61146432) [ghstack-poisoned]
Summary: Pull Request resolved: pytorch#4750 Pull Request resolved: pytorch#4667 Add a `main.cpp` and CMakeLists.txt for llava runner. This runner takes in an image in the format of `.pt` (a serialized pytorch model) along with text prompt. It will generate text tokens in a way similar to llama runner. Run `build.sh` to build the runner. To serialize the image into a `.pt` file, run the following script: ```python import torch from torch import nn copy = torch.tensor(resized) m = nn.Module() par = nn.Parameter(copy, requires_grad=False) m.register_parameter("0",par) tensors = torch.jit.script(m) tensors.save("image.pt") ``` To run the runner, use the following command: ``` cmake-out/examples/models/llava/llava_main \ --tokenizer_path tokenizer.bin \ --model_path llava_kv_768.pte \ --prompt "\nWhat are the things I should be cautious about when I visit here?" \ --image_path image.pt \ --temperature 0 ``` imported-using-ghimport Test Plan: Imported from OSS Reviewed By: kirklandsign Differential Revision: D61146432 Pulled By: larryliu0820
@larryliu0820 has imported this pull request. If you are a Meta employee, you can view this diff on Phabricator. |
Summary: Pull Request resolved: #4750 Pull Request resolved: #4667 Add a `main.cpp` and CMakeLists.txt for llava runner. This runner takes in an image in the format of `.pt` (a serialized pytorch model) along with text prompt. It will generate text tokens in a way similar to llama runner. Run `build.sh` to build the runner. To serialize the image into a `.pt` file, run the following script: ```python import torch from torch import nn copy = torch.tensor(resized) m = nn.Module() par = nn.Parameter(copy, requires_grad=False) m.register_parameter("0",par) tensors = torch.jit.script(m) tensors.save("image.pt") ``` To run the runner, use the following command: ``` cmake-out/examples/models/llava/llava_main \ --tokenizer_path tokenizer.bin \ --model_path llava_kv_768.pte \ --prompt "\nWhat are the things I should be cautious about when I visit here?" \ --image_path image.pt \ --temperature 0 ``` imported-using-ghimport Test Plan: Imported from OSS Reviewed By: kirklandsign Differential Revision: D61146432 Pulled By: larryliu0820
… and build script" Add a `main.cpp` and CMakeLists.txt for llava runner. This runner takes in an image in the format of `.pt` (a serialized pytorch model) along with text prompt. It will generate text tokens in a way similar to llama runner. Run `build.sh` to build the runner. To serialize the image into a `.pt` file, run the following script: ```python import torch from torch import nn copy = torch.tensor(resized) m = nn.Module() par = nn.Parameter(copy, requires_grad=False) m.register_parameter("0",par) tensors = torch.jit.script(m) tensors.save("image.pt") ``` To run the runner, use the following command: ``` cmake-out/examples/models/llava/llava_main \ --tokenizer_path tokenizer.bin \ --model_path llava_kv_768.pte \ --prompt "\nWhat are the things I should be cautious about when I visit here?" \ --image_path image.pt \ --temperature 0 ``` Differential Revision: [D61146432](https://www.internalfb.com/diff/D61146432) [ghstack-poisoned]
Add a `main.cpp` and CMakeLists.txt for llava runner. This runner takes in an image in the format of `.pt` (a serialized pytorch model) along with text prompt. It will generate text tokens in a way similar to llama runner. Run `build.sh` to build the runner. To serialize the image into a `.pt` file, run the following script: ```python import torch from torch import nn copy = torch.tensor(resized) m = nn.Module() par = nn.Parameter(copy, requires_grad=False) m.register_parameter("0",par) tensors = torch.jit.script(m) tensors.save("image.pt") ``` To run the runner, use the following command: ``` cmake-out/examples/models/llava/llava_main \ --tokenizer_path tokenizer.bin \ --model_path llava_kv_768.pte \ --prompt "\nWhat are the things I should be cautious about when I visit here?" \ --image_path image.pt \ --temperature 0 ``` Differential Revision: [D61146432](https://www.internalfb.com/diff/D61146432) [ghstack-poisoned]
@larryliu0820 has imported this pull request. If you are a Meta employee, you can view this diff on Phabricator. |
Summary: Pull Request resolved: #4750 Pull Request resolved: #4667 Add a `main.cpp` and CMakeLists.txt for llava runner. This runner takes in an image in the format of `.pt` (a serialized pytorch model) along with text prompt. It will generate text tokens in a way similar to llama runner. Run `build.sh` to build the runner. To serialize the image into a `.pt` file, run the following script: ```python import torch from torch import nn copy = torch.tensor(resized) m = nn.Module() par = nn.Parameter(copy, requires_grad=False) m.register_parameter("0",par) tensors = torch.jit.script(m) tensors.save("image.pt") ``` To run the runner, use the following command: ``` cmake-out/examples/models/llava/llava_main \ --tokenizer_path tokenizer.bin \ --model_path llava_kv_768.pte \ --prompt "\nWhat are the things I should be cautious about when I visit here?" \ --image_path image.pt \ --temperature 0 ``` imported-using-ghimport Test Plan: Imported from OSS Reviewed By: kirklandsign Differential Revision: D61146432 Pulled By: larryliu0820
… and build script" Add a `main.cpp` and CMakeLists.txt for llava runner. This runner takes in an image in the format of `.pt` (a serialized pytorch model) along with text prompt. It will generate text tokens in a way similar to llama runner. Run `build.sh` to build the runner. To serialize the image into a `.pt` file, run the following script: ```python import torch from torch import nn copy = torch.tensor(resized) m = nn.Module() par = nn.Parameter(copy, requires_grad=False) m.register_parameter("0",par) tensors = torch.jit.script(m) tensors.save("image.pt") ``` To run the runner, use the following command: ``` cmake-out/examples/models/llava/llava_main \ --tokenizer_path tokenizer.bin \ --model_path llava_kv_768.pte \ --prompt "\nWhat are the things I should be cautious about when I visit here?" \ --image_path image.pt \ --temperature 0 ``` Differential Revision: [D61146432](https://www.internalfb.com/diff/D61146432) [ghstack-poisoned]
Add a `main.cpp` and CMakeLists.txt for llava runner. This runner takes in an image in the format of `.pt` (a serialized pytorch model) along with text prompt. It will generate text tokens in a way similar to llama runner. Run `build.sh` to build the runner. To serialize the image into a `.pt` file, run the following script: ```python import torch from torch import nn copy = torch.tensor(resized) m = nn.Module() par = nn.Parameter(copy, requires_grad=False) m.register_parameter("0",par) tensors = torch.jit.script(m) tensors.save("image.pt") ``` To run the runner, use the following command: ``` cmake-out/examples/models/llava/llava_main \ --tokenizer_path tokenizer.bin \ --model_path llava_kv_768.pte \ --prompt "\nWhat are the things I should be cautious about when I visit here?" \ --image_path image.pt \ --temperature 0 ``` Differential Revision: [D61146432](https://www.internalfb.com/diff/D61146432) [ghstack-poisoned]
@larryliu0820 has imported this pull request. If you are a Meta employee, you can view this diff on Phabricator. |
Summary: Pull Request resolved: pytorch#4750 Pull Request resolved: pytorch#4667 Add a `main.cpp` and CMakeLists.txt for llava runner. This runner takes in an image in the format of `.pt` (a serialized pytorch model) along with text prompt. It will generate text tokens in a way similar to llama runner. Run `build.sh` to build the runner. To serialize the image into a `.pt` file, run the following script: ```python import torch from torch import nn copy = torch.tensor(resized) m = nn.Module() par = nn.Parameter(copy, requires_grad=False) m.register_parameter("0",par) tensors = torch.jit.script(m) tensors.save("image.pt") ``` To run the runner, use the following command: ``` cmake-out/examples/models/llava/llava_main \ --tokenizer_path tokenizer.bin \ --model_path llava_kv_768.pte \ --prompt "\nWhat are the things I should be cautious about when I visit here?" \ --image_path image.pt \ --temperature 0 ``` imported-using-ghimport Test Plan: Imported from OSS Reviewed By: kirklandsign Differential Revision: D61146432 Pulled By: larryliu0820
Stack from ghstack (oldest at bottom):
Add a
main.cpp
and CMakeLists.txt for llava runner. This runner takes in an image in the format of.pt
(a serialized pytorch model) along with text prompt. It will generate text tokens in a way similar to llama runner.Run
build.sh
to build the runner.To serialize the image into a
.pt
file, run the following script:To run the runner, use the following command:
Differential Revision: D61146432