Upgrade torch nightly version to 2.8.0.dev20250408+cpu#30
Upgrade torch nightly version to 2.8.0.dev20250408+cpu#30jinevening merged 3 commits intoSamsung:mainfrom
Conversation
.github/workflows/check-pr.yaml
Outdated
| strategy: | ||
| matrix: | ||
| torch-version: ["2.5", "2.6"] | ||
| torch-version: ["2.5", "2.6", "2.7", "nightly"] |
There was a problem hiding this comment.
NOTE: pytorch 2.7.0 release date is planed to 4/25, due to https://dev-discuss.pytorch.org/t/pytorch-release-2-7-0-call-for-features/2780.
bd7971e to
8a05322
Compare
|
It seems that this PR includes some chanages about ResizeNearestNeighbor (not sure this is the only change), but they are hidden behind the commit message of "Upgrade torch nightly version". I suggest to make an issue whenever we upgrade torch version, and list up related issues there. That will be helpful to track our decisions for supporting new torch versions. @dayo09 Could you make an issue for this update? |
|
@jinevening Sorry that I forgot to link the issue #9. |
|
|
||
| input: torch.fx.Node | ||
| dim: int | ||
| dim: int = 0 |
There was a problem hiding this comment.
Some operators have void dim field in torch 2.8.dev
There was a problem hiding this comment.
Does it occur only in SliceArgs? If not, how about to split the PR to set the default value for dim arg?
| SegmentIndexSelectConst(), | ||
| LegalizeCausalMaskValue(enabled=config.get("legalize_causal_mask_value")), | ||
| ConvertIndexToResizeNearestNeighbor(), | ||
| LowerToResizeNearestNeighbor(), |
There was a problem hiding this comment.
Now that Upsample is added to the Lowering to Resize Nearest Neighbor target list, I intergrate them and rename the pass.
| # This pass should be run before 'RestoreLinear' and after 'decompose_quantize_op'. | ||
| # TODO run pass regardless of the orders. | ||
| with SuppressWarning(UserWarning, ".*quantize_per_tensor"): | ||
| with SuppressWarning(UserWarning, ".*quantize_per_tensor"), SuppressWarning( |
There was a problem hiding this comment.
To suppress the warning from 2.8. It seems oneDNN kinda thirdparty feature is added. It's very unnecessary warning for us.
| def __init__(self): | ||
| super().__init__() | ||
|
|
||
| def convert_index_to_resize_nearest_neighbor( |
There was a problem hiding this comment.
This part is almost the same to the original code.
|
|
||
| return resize_nearest_neighbor | ||
|
|
||
| def convert_upsample_nearest2d_to_resize_nearest_neighbor( |
There was a problem hiding this comment.
This part is newly added.
| @tag.skip_if( | ||
| not HAS_TORCH_OVER_28_DEV, | ||
| reason="The case isn't supported yet. It will be supported from torch 2.8.0.dev", | ||
| ) | ||
| class InterpolateOnePointFive(torch.nn.Module): |
There was a problem hiding this comment.
Q. Why it's not supported in lower version?
A.
- CASE(torch < 2.8.0.dev)
- it's converted to index. -> It's interpreted to "Multiple indices" case. -> it's not supported in tico yet.
- CASE(torch >= 2.8.0.dev)
- it's converted to upsample nearest 2d. -> it converts directly to RNN(ResizeNearsestNeighbor) in tico. -> Can support 1.5 times.
There was a problem hiding this comment.
Can I ask what is "Multiple indices" case?
There was a problem hiding this comment.
@jinevening IndexTensorVisitor don't support multiple indices.
# TODO Support multiple indices
if len(indices) - indices.count(None) > 1: # type: ignore[arg-type]
raise NotYetSupportedError(
"Multiple indices is not supported yet in aten.index.Tensor"
)This is current implementaion. I left it as TODO.
I didn't look into what values were. 🤔
| from test.utils import tag | ||
|
|
||
|
|
||
| class InterpolateDouble(torch.nn.Module): |
There was a problem hiding this comment.
(not in this PR) BTW, it seems that this file can be moved to op, not net.
|
Ah, I missed #9 (added a back link to the main comment). I left some comments. PTAL |
|
#37 must be merged to resolve the lint error. |
| class ResizeNearestNeighborArgs: | ||
| """ | ||
| # Only consider `torch.nn.functional.interpolate(x, scale_factor=2.0, mode='nearest')` case. | ||
| # Maps from `torch.nn.functional.interpolate(x, scale_factor=scale_factor, mode='nearest')` case. |
There was a problem hiding this comment.
| # Maps from `torch.nn.functional.interpolate(x, scale_factor=scale_factor, mode='nearest')` case. | |
| # Mapped from `torch.nn.functional.interpolate(x, scale_factor=scale_factor, mode='nearest')` case. |
(nit)
May be..?
Let's upgrade torch nightly version to the latest. TICO-DCO-1.0-Signed-off-by: Dayoung Lee <dayoung.lee@samsung.com>
Co-authored-by: seongwoo chae <mhs4670go@naver.com>
| [BEFORE PASS] | ||
| input - aten.index - output |
There was a problem hiding this comment.
| [BEFORE PASS] | |
| input - aten.index - output | |
| [BEFORE PASS] | |
| case 1. | |
| input - aten.index - output | |
| case 2. | |
| input - aten.upsample_nearest2d.vec - output |
It would be nice to add a case for aten.upsample_nearest2d.vec :D
There was a problem hiding this comment.
Let me apply in the next PR :-D
miusic
left a comment
There was a problem hiding this comment.
LGTM with some comments 👍
| model: torch.nn.Module, example_inputs: tuple, pt2_model_path: str | ||
| ): | ||
| # Create .pt2 model | ||
| with torch.no_grad(), SuppressWarning(UserWarning, ".*quantize_per_tensor"): |
There was a problem hiding this comment.
Not related with this PR but seems that quantize_per_tensor warning has been removed.
Let's upgrade torch nightly version to the latest.
TICO-DCO-1.0-Signed-off-by: Dayoung Lee dayoung.lee@samsung.com
Related to: #9