Conversation
There was a problem hiding this comment.
There are some changes that do not conform to Python style guidelines:
--- /home/runner/work/TensorRT/TensorRT/examples/distributed_inference/data_parallel_gpt2.py 2024-05-02 00:29:27.054073+00:00
+++ /home/runner/work/TensorRT/TensorRT/examples/distributed_inference/data_parallel_gpt2.py 2024-05-02 00:31:18.785078+00:00
@@ -13,12 +13,26 @@
distributed_state = PartialState()
model = GPT2LMHeadModel.from_pretrained("gpt2").eval().to(distributed_state.device)
-model.forward = torch.compile(model.forward, backend="torch_tensorrt", options={"truncate_long_and_double": True, "enabled_precisions": {torch.float16}, "debug": True}, dynamic=False,)
+model.forward = torch.compile(
+ model.forward,
+ backend="torch_tensorrt",
+ options={
+ "truncate_long_and_double": True,
+ "enabled_precisions": {torch.float16},
+ "debug": True,
+ },
+ dynamic=False,
+)
with distributed_state.split_between_processes([input_id1, input_id2]) as prompt:
cur_input = torch.clone(prompt[0]).to(distributed_state.device)
- gen_tokens = model.generate(cur_input, do_sample=True, temperature=0.9, max_length=100,)
+ gen_tokens = model.generate(
+ cur_input,
+ do_sample=True,
+ temperature=0.9,
+ max_length=100,
+ )
gen_text = tokenizer.batch_decode(gen_tokens)[0]
narendasan
reviewed
May 3, 2024
Collaborator
narendasan
left a comment
There was a problem hiding this comment.
- Need a requirements.txt
- Annotate the script with description of whats happening https://github.com/pytorch/TensorRT/blob/main/examples/dynamo/torch_compile_advanced_usage.py
- Add a reference to index.rst so that it gets rendered in the docs:
Line 113 in 12e885a
4bc05b7 to
dfbf6ea
Compare
dfbf6ea to
7b4b504
Compare
Contributor
|
@bowang007 You didn't properly clean up the merge conflicts, therefore db24b3b had |
bowang007
added a commit
that referenced
this pull request
May 17, 2024
peri044
pushed a commit
that referenced
this pull request
May 21, 2024
laikhtewari
pushed a commit
that referenced
this pull request
May 24, 2024
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Description
This PR shows a simple example about using
acceleratelibrary for data parallel inference.Checklist: