Skip to content

upgrade natten to 0.21 version - #41905

Closed
kaixuanliu wants to merge 10 commits into
huggingface:mainfrom
kaixuanliu:dinat-xpu
Closed

kaixuanliu wants to merge 10 commits into
huggingface:mainfrom
kaixuanliu:dinat-xpu

Conversation

@kaixuanliu

Copy link
Copy Markdown
Contributor

No description provided.

Signed-off-by: Liu, Kaixuan <kaixuan.liu@intel.com>
Signed-off-by: Liu, Kaixuan <kaixuan.liu@intel.com>
Signed-off-by: Liu, Kaixuan <kaixuan.liu@intel.com>
Signed-off-by: Liu, Kaixuan <kaixuan.liu@intel.com>
Signed-off-by: Liu, Kaixuan <kaixuan.liu@intel.com>
Signed-off-by: Liu, Kaixuan <kaixuan.liu@intel.com>
Signed-off-by: Liu, Kaixuan <kaixuan.liu@intel.com>
@kaixuanliu
kaixuanliu marked this pull request as ready for review November 11, 2025 12:41
@github-actions

Copy link
Copy Markdown
Contributor

[For maintainers] Suggested jobs to run (before merge)

run-slow: dinat

Signed-off-by: Liu, Kaixuan <kaixuan.liu@intel.com>
@kaixuanliu

Copy link
Copy Markdown
Contributor Author

@ydshieh Hi, current transformers uses an old version natten(0.14.6) and have many conflicts when we run CI tests for tests/models/dinat, in this PR we upgrade the natten to latest version(0.21.0) and I have updated related APIs, all relavant test cases passed w/ this PR on my side, pls help review. Many thanks!

@kaixuanliu kaixuanliu changed the title upgrade natten to 0.20 version upgrade natten to 0.21 version Nov 12, 2025
@ydshieh

ydshieh commented Nov 12, 2025

Copy link
Copy Markdown
Collaborator

Just want to point out that

#40287

But happy to update the dependency however.

self.query(hidden_states)
.view(batch_size, -1, self.num_attention_heads, self.attention_head_size)
.transpose(1, 2)
batch_size, height, width, _ = hidden_states.shape

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.

could you shortly explain the changes in these lines of changes in this attention block ?

@ydshieh

ydshieh commented Nov 12, 2025

Copy link
Copy Markdown
Collaborator

other than some torch export issues, I got

=FAILED tests/models/dinat/test_modeling_dinat.py::DinatModelIntegrationTest::test_inference_image_classification_head - AssertionError: Tensor-likes are not close!

on Nvidia A10. It's fine, you don't need to deal with it, but is this test passing on XPU?

@kaixuanliu

Copy link
Copy Markdown
Contributor Author

@ydshieh Oops, I tested the tests/models/dinat both on A100 and Intel XPU, but I forgot to turn on RUN_SLOW, this case also fails on my side after I export RUN_SLOW=1. Will change this PR to draft and investigate what happened. Sorry for the inconvenience!

@kaixuanliu
kaixuanliu marked this pull request as draft November 12, 2025 09:44
@ydshieh

ydshieh commented Nov 12, 2025

Copy link
Copy Markdown
Collaborator

@kaixuanliu

I have to let you know the whole dinat tests are not (actually) running for very long time, from our history, it was not run any test on 2025/01/01, and maybe even earlier.

So it might be really difficult to check , especially we also have the natten / torch version issues etc.

Is it important for XPU to run test with this model?

@yao-matrix

yao-matrix commented Nov 12, 2025 •

Copy link
Copy Markdown
Contributor

@kaixuanliu

I have to let you know the whole dinat tests are not (actually) running for very long time, from our history, it was not run any test on 2025/01/01, and maybe even earlier.

So it might be really difficult to check , especially we also have the natten / torch version issues etc.

Is it important for XPU to run test with this model?

@ydshieh , does transformers have plan to retire dinat, seems it's out of maintain per your description? For XPU, we want to deliver a solid message to community that XPU has equivalent broad modeling coverage as CUDA in transformers, so we are doing everything we can do to make it happen. dinat and LayoutLMV2 are the last 2 models which don't work on XPU:

  • for dinat, since natten is still actively maintained now, but as you can see the API is no longer back-compatible, so we are submitting PR to natten to add XPU support, and upgrade natten version in dinat to make it work.
  • for LayoutLMV2, since detectronv2 is out-of-maintain now, we waived its support.

That's the reason behind what we are doing, :). If transformers has a retire plan for out-of-maintain models, we can waive it, too.

@ydshieh

ydshieh commented Nov 12, 2025

Copy link
Copy Markdown
Collaborator

Personally, I would like to deprecate it. Let me check some numbers and talk to the core maintainers and come back to you.

Great jobs the XPU team make this amazing progress!

@ydshieh

ydshieh commented Nov 13, 2025

Copy link
Copy Markdown
Collaborator

Hi @kaixuanliu @yao-matrix

Yes, we are going to deprecate this dinat (along with some models).

@kaixuanliu

Copy link
Copy Markdown
Contributor Author

@ydshieh , Thanks for the feedback. Will close this PR. BTW, we want to double check layoutlmV2 will also be deprecated, right?

@ydshieh

ydshieh commented Nov 14, 2025

Copy link
Copy Markdown
Collaborator

Hi @kaixuanliu

I haven't talked about layoutlmV2 with the team (forgot about this). I will have to check.

But I think it's fair that the XPU team not to test it (I have trouble many time with detectron2 too).

@ydshieh

ydshieh commented Nov 14, 2025

Copy link
Copy Markdown
Collaborator

BTW, if XPU team fetch the results of transformers Nvidia CI runs and do the comparison? I mean for this specific dinat, there is actually no test being run, so there is no reason for XPU to run and compare to Nvidia.

I know our artifacts may lack some important information for external to use reliably.

We have recently these file collated_reports_xxx, for example

https://huggingface.co/datasets/hf-internal-testing/transformers_daily_ci/tree/main/2025-11-13/ci_results_run_models_gpu

that might be helpful to you.

Let me know if you have any feedback.

@yao-matrix

Copy link
Copy Markdown
Contributor

BTW, if XPU team fetch the results of transformers Nvidia CI runs and do the comparison? I mean for this specific dinat, there is actually no test being run, so there is no reason for XPU to run and compare to Nvidia.

I know our artifacts may lack some important information for external to use reliably.

We have recently these file collated_reports_xxx, for example

https://huggingface.co/datasets/hf-internal-testing/transformers_daily_ci/tree/main/2025-11-13/ci_results_run_models_gpu

that might be helpful to you.

Let me know if you have any feedback.

Thx @ydshieh , we will do this. And one more question, is the dashboard here https://huggingface.co/spaces/transformers-community/transformers-ci-dashboard generated by the test plan you mentioned as https://huggingface.co/datasets/hf-internal-testing/transformers_daily_ci/tree/main/2025-11-13/ci_results_run_models_gpu? Thx very much.

@ydshieh

ydshieh commented Nov 17, 2025

Copy link
Copy Markdown
Collaborator

@yao-matrix The dashboard is developed by another team member (and I am less engaged in this part), but yes, it's from the files collated_reports_xxx files in the linked repository.

If you need more details, don't hesitate.

@kaixuanliu kaixuanliu closed this Nov 18, 2025
@ydshieh

ghost commented Nov 18, 2025

Copy link
Copy Markdown
Collaborator

@kaixuanliu @yao-matrix

Don't hesitate to reach out (on github or on slack) in the future when you find something that requires more work and not sure about if it is worth doing that .

Apologize again for this not well-commutated hidden states (of not maintained models but not deprecated explicitly)

@kaixuanliu

ghost commented Nov 18, 2025

Copy link
Copy Markdown
Contributor Author

It's OK. Thanks for your kindly reminder! Will do it next time :)

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.

3 participants