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

Update adaround_optimizer.py #3709

Merged
merged 1 commit into from
Jan 13, 2025
Merged

Update adaround_optimizer.py #3709

merged 1 commit into from
Jan 13, 2025

Conversation

NikilXYZ
Copy link
Contributor

@NikilXYZ NikilXYZ commented Jan 3, 2025

Make sure that the input and output end up as tensors end up on the right device

Referencing this issue: #3708

Make sure that the input and output end up as tensors end up on the right device

Signed-off-by: Nikil Ragav <[email protected]>
Copy link
Contributor

@quic-mtuttle quic-mtuttle 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 the fix! Looks good to me.

@@ -176,6 +176,8 @@ def _optimize_rounding(cls, module: ModuleInfo, quantized_input_name,
else:
model_inputs = cached_dataset[np.random.randint(len(cached_dataset))]
inp_data, orig_out_data = act_sampler.sample_acts(create_input_dict(orig_model.model, model_inputs))
inp_data, orig_out_data = torch.from_numpy(inp_data[0]).to(torch_device), torch.from_numpy(out_data[0]).to(torch_device)
Copy link
Contributor

Choose a reason for hiding this comment

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

I did not understand one aspect of the change. There are two parts to the change - 1. we are converting numpy tensors to torch, 2. we are placing the torch tensors on a device.

How does the rest of the code work if we are now passing torch tensors instead of numpy?

Copy link
Contributor

Choose a reason for hiding this comment

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

The rest of the code expects a torch tensor on the correct device, since it is using torch to backprop through the layer

@quic-hitameht quic-hitameht merged commit 72e22e9 into quic:develop Jan 13, 2025
4 checks passed
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.

4 participants