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

Add embedding_renorm code | feat(torchlib) #1098

Merged
merged 7 commits into from
Oct 24, 2023

Conversation

xiaowuhu
Copy link
Contributor

No description provided.

@xiaowuhu xiaowuhu changed the title add embedding_renorm code add embedding_renorm code | torchlib(feat) Oct 23, 2023
@codecov
Copy link

codecov bot commented Oct 23, 2023

Codecov Report

Merging #1098 (49fbcc6) into main (2a610c4) will increase coverage by 0.06%.
The diff coverage is 100.00%.

@@            Coverage Diff             @@
##             main    #1098      +/-   ##
==========================================
+ Coverage   78.03%   78.10%   +0.06%     
==========================================
  Files         115      115              
  Lines       14895    14932      +37     
  Branches     1581     1585       +4     
==========================================
+ Hits        11623    11662      +39     
+ Misses       2901     2900       -1     
+ Partials      371      370       -1     
Files Coverage Δ
onnxscript/function_libs/torch_lib/ops/core.py 79.69% <100.00%> (+0.16%) ⬆️
...ript/tests/function_libs/torch_lib/extra_opinfo.py 98.76% <100.00%> (+0.03%) ⬆️
...ipt/tests/function_libs/torch_lib/ops_test_data.py 96.13% <ø> (ø)

... and 1 file with indirect coverage changes

@github-actions
Copy link

github-actions bot commented Oct 23, 2023

Test Results

         18 files  ±  0         18 suites  ±0   1h 17m 30s ⏱️ + 1m 0s
  11 001 tests +  6    8 269 ✔️ +  5      2 713 💤 ±0       18 ±0  1 🔥 +1 
155 901 runs  +54  35 797 ✔️ +53  118 636 💤 ±0  1 467 ±0  1 🔥 +1 

For more details on these failures and errors, see this check.

Results for commit 49fbcc6. ± Comparison against base commit 2a610c4.

This pull request removes 147 and adds 153 tests. Note that renamed tests count towards both.
onnxscript.tests.function_libs.torch_lib.ops_test.TestFunctionValidity ‑ test_function_has_op_schema_161_aten_embedding
onnxscript.tests.function_libs.torch_lib.ops_test.TestFunctionValidity ‑ test_function_has_op_schema_162_aten_hardtanh
onnxscript.tests.function_libs.torch_lib.ops_test.TestFunctionValidity ‑ test_function_has_op_schema_163_aten_leaky_relu
onnxscript.tests.function_libs.torch_lib.ops_test.TestFunctionValidity ‑ test_function_has_op_schema_164_aten_log_sigmoid
onnxscript.tests.function_libs.torch_lib.ops_test.TestFunctionValidity ‑ test_function_has_op_schema_165_aten_mish
onnxscript.tests.function_libs.torch_lib.ops_test.TestFunctionValidity ‑ test_function_has_op_schema_166_aten_nll_loss_weight
onnxscript.tests.function_libs.torch_lib.ops_test.TestFunctionValidity ‑ test_function_has_op_schema_167_aten_nll_loss
onnxscript.tests.function_libs.torch_lib.ops_test.TestFunctionValidity ‑ test_function_has_op_schema_168_aten_reflection_pad2d
onnxscript.tests.function_libs.torch_lib.ops_test.TestFunctionValidity ‑ test_function_has_op_schema_169_aten_relu
onnxscript.tests.function_libs.torch_lib.ops_test.TestFunctionValidity ‑ test_function_has_op_schema_170_aten_relu6
…
onnxscript.function_libs.tools.torch_lib.deduce_type_constraints_test.TestDeduceTypeConstraints ‑ test_deduce_type_constraints_does_not_crash_for_onnx_function_aten_embedding_renorm_onnx
onnxscript.tests.function_libs.torch_lib.ops_test.TestFunctionValidity ‑ test_function_has_op_schema_161_aten_embedding_renorm
onnxscript.tests.function_libs.torch_lib.ops_test.TestFunctionValidity ‑ test_function_has_op_schema_162_aten_embedding
onnxscript.tests.function_libs.torch_lib.ops_test.TestFunctionValidity ‑ test_function_has_op_schema_163_aten_hardtanh
onnxscript.tests.function_libs.torch_lib.ops_test.TestFunctionValidity ‑ test_function_has_op_schema_164_aten_leaky_relu
onnxscript.tests.function_libs.torch_lib.ops_test.TestFunctionValidity ‑ test_function_has_op_schema_165_aten_log_sigmoid
onnxscript.tests.function_libs.torch_lib.ops_test.TestFunctionValidity ‑ test_function_has_op_schema_166_aten_mish
onnxscript.tests.function_libs.torch_lib.ops_test.TestFunctionValidity ‑ test_function_has_op_schema_167_aten_nll_loss_weight
onnxscript.tests.function_libs.torch_lib.ops_test.TestFunctionValidity ‑ test_function_has_op_schema_168_aten_nll_loss
onnxscript.tests.function_libs.torch_lib.ops_test.TestFunctionValidity ‑ test_function_has_op_schema_169_aten_reflection_pad2d
…

♻️ This comment has been updated with latest results.

unique_indices = op.Unique(indices)
unique_indices_Y = op.SequenceAt(unique_indices, 0)
# using _onnx private function because op.SrquenceAt(unique_indices, 0) cannot pass module checker
# The error message is:
Copy link
Collaborator

Choose a reason for hiding this comment

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

Should we report this to ONNX?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Filed an issue: onnx/onnx#5698

@justinchuby justinchuby changed the title add embedding_renorm code | torchlib(feat) Add embedding_renorm code | feat(torchlib) Oct 23, 2023
@justinchuby justinchuby added the module: torchlib Related to the torch/aten function lib in development label Oct 23, 2023
@xiaowuhu xiaowuhu requested a review from justinchuby October 24, 2023 01:28
Copy link
Collaborator

@justinchuby justinchuby left a comment

Choose a reason for hiding this comment

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

🎆 Thank you!

@justinchuby justinchuby merged commit 0035390 into main Oct 24, 2023
@justinchuby justinchuby deleted the xiaowu/AddOp(embedding_renorm) branch October 24, 2023 02:28
"""embedding_renorm(Tensor weight, Tensor indices, float max_norm, float norm_type) -> Tensor"""

unique_indices = op.Unique(indices)
unique_indices_Y = op.SequenceAt(unique_indices, 0)
Copy link
Collaborator

Choose a reason for hiding this comment

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

Should we use slice here?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Nop. It is an unequal length list.

Copy link
Collaborator

Choose a reason for hiding this comment

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

Fixed in #1123. The output is not a Sequence. That’s why the checker complained

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
module: torchlib Related to the torch/aten function lib in development
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants