Skip to content

Use regular torch.Tensor for CPU tensors#8416

Merged
qihqi merged 4 commits intomasterfrom
hanq_torchxla2
Nov 27, 2024
Merged

Use regular torch.Tensor for CPU tensors#8416
qihqi merged 4 commits intomasterfrom
hanq_torchxla2

Conversation

@qihqi
Copy link
Copy Markdown
Collaborator

@qihqi qihqi commented Nov 26, 2024

This is to test the water with encouraging enable_globally() usage pattern. So ideally torch_xla2 should not conflict with regular (non-compute) torch usage (such as dataloading). So we will make the type conversion explicit.

@qihqi qihqi changed the title Unit test pass Use regular torch.Tensor for CPU tensors Nov 26, 2024
@qihqi qihqi marked this pull request as ready for review November 26, 2024 22:06
@qihqi qihqi requested review from GleasonK and ManfeiBai November 26, 2024 22:06
context_length = 2048
input_shape_prefill = (1, context_length)
input_shape_decode = (1, 1)
model_args = model_exportable.ModelArgs(
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

why we have indent here for this function? for with torch_xla2.default_env():?



@op(torch.ops.aten.clone)
@op(torch.ops.aten.clone.default)
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

what is the .default change?

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

actually not needed, removed.

Copy link
Copy Markdown
Collaborator

@ManfeiBai ManfeiBai left a comment

Choose a reason for hiding this comment

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

Thanks, LGTM

@qihqi qihqi merged commit 20f5166 into master Nov 27, 2024
@qihqi qihqi deleted the hanq_torchxla2 branch November 27, 2024 23:10
rpsilva-aws pushed a commit to rpsilva-aws/xla that referenced this pull request Dec 6, 2024
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.

2 participants