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

Fix wrong inputs/model placement when using a single core #725

Merged
merged 1 commit into from
Nov 15, 2024

Conversation

JingyaHuang
Copy link
Collaborator

@JingyaHuang JingyaHuang commented Oct 25, 2024

What does this PR do?

It's a recent find that I did not experience before. Previously, when only a single neuron core was used, input tensors were allocated to the same core that the model has been loaded with torch.jit.load. But it seems that now the input tensors are always allocated to nc:0, whereas the model is loaded to a core with lower usage, so we could bump into unexpected flaky situations where they are in different cores...

2024-Oct-25 15:40:20.728276 13974:13974 ERROR  NMGR:dlr_check_tensor_set_on_same_vtpb_v2    Tensor input249 allocated on vnc 0 must be allocated on same vnc as model (1)

Before submitting

  • This PR fixes a typo or improves the docs (you can dismiss the other checks if that's the case).
  • Did you make sure to update the documentation with your changes?
  • Did you write any new necessary tests?

@HuggingFaceDocBuilderDev

The docs for this PR live here. All of your documentation changes will be reflected on that endpoint. The docs are available until 30 days after the last update.

move_trace_to_device(model, device_id)
if is_neuronx_available():
torch_neuronx.experimental.set_neuron_cores(
model, start_nc=0, nc_count=1
Copy link
Collaborator

Choose a reason for hiding this comment

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

What happens if the model has tp_degree > 1 ?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

There is no tp support right now for SD models, only one neuron device is supported, and we want both cores to be used, we apply ddp with the entire model loaded on both cores.

Copy link

This PR is stale because it has been open 15 days with no activity. Remove stale label or comment or this will be closed in 5 days.

@github-actions github-actions bot added the Stale label Nov 13, 2024
@dacorvo dacorvo merged commit 459aa55 into main Nov 15, 2024
10 checks passed
@dacorvo dacorvo deleted the fix-wrong-core-placement-single branch November 15, 2024 09:41
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants