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

Make tokenize tests readable #1868

Open
wants to merge 7 commits into
base: main
Choose a base branch
from
Open

Conversation

krammnic
Copy link
Contributor

Context

What is the purpose of this PR? Is it to

  • add a new feature
  • fix a bug
  • update tests and/or documentation
  • clean up

Please link to any issues this PR addresses.

Changelog

What are the changes made in this PR?

Test plan

Please make sure to do each of the following if applicable to your PR. If you're unsure about any one of these just ask and we will happily help. We also have a contributing page for some guidance on contributing.

  • run pre-commit hooks and linters (make sure you've first installed via pre-commit install)
  • add unit tests for any new functionality
  • update docstrings for any new or updated methods or classes
  • run unit tests via pytest tests
  • run recipe tests via pytest tests -m integration_test
  • manually run any new or modified recipes with sufficient proof of correctness
  • include relevant commands and any other artifacts in this summary (pastes of loss curves, eval results, etc.)

UX

If your function changed a public API, please add a dummy example of what the user experience will look like when calling it.
Here is a docstring example
and a tutorial example

  • I did not change any public API
  • I have added an example to docs or docstrings

Will require changes in CI(pre-commit run makes expected_tokens lists unreadable)

Copy link

pytorch-bot bot commented Oct 19, 2024

🔗 Helpful Links

🧪 See artifacts and rendered test results at hud.pytorch.org/pr/pytorch/torchtune/1868

Note: Links to docs will display an error until the docs builds have been completed.

❌ 6 New Failures, 2 Cancelled Jobs, 2 Unrelated Failures

As of commit d6cd349 with merge base 3ca0d30 (image):

NEW FAILURES - The following jobs have failed:

  • Build Docs / build_docs (3.11) (gh)
    sphinx.ext.autosummary.ImportExceptionGroup: no module named torchtune.training
  • GPU tests / gpu_test (3.9, stable) (gh)
    E ImportError: cannot import name 'TensorCoreTiledLayout' from 'torchao.dtypes' (/home/ec2-user/actions-runner/_work/torchtune/torchtune/3/envs/test/lib/python3.9/site-packages/torchao/dtypes/__init__.py)
  • Recipe Tests / recipe_test (3.11) (gh)
    E ImportError: cannot import name 'TensorCoreTiledLayout' from 'torchao.dtypes' (/usr/share/miniconda3/envs/test/lib/python3.11/site-packages/torchao/dtypes/__init__.py)
  • Recipe Tests / recipe_test (3.9) (gh)
    E ImportError: cannot import name 'TensorCoreTiledLayout' from 'torchao.dtypes' (/usr/share/miniconda3/envs/test/lib/python3.9/site-packages/torchao/dtypes/__init__.py)
  • Unit Test / unit_tests (3.10) (gh)
    E ImportError: cannot import name 'TensorCoreTiledLayout' from 'torchao.dtypes' (/usr/share/miniconda3/envs/test/lib/python3.10/site-packages/torchao/dtypes/__init__.py)
  • Unit Test / unit_tests (3.11) (gh)
    E ImportError: cannot import name 'TensorCoreTiledLayout' from 'torchao.dtypes' (/usr/share/miniconda3/envs/test/lib/python3.11/site-packages/torchao/dtypes/__init__.py)

CANCELLED JOBS - The following jobs were cancelled. Please retry:

FLAKY - The following job failed but was likely due to flakiness present on trunk:

BROKEN TRUNK - The following job failed but was present on the merge base:

👉 Rebase onto the `viable/strict` branch to avoid these failures

This comment was automatically generated by Dr. CI and updates every 15 minutes.

@facebook-github-bot facebook-github-bot added the CLA Signed This label is managed by the Facebook bot. Authors need to sign the CLA before a PR can be reviewed. label Oct 19, 2024
@krammnic
Copy link
Contributor Author

cc: @RdoubleA @joecummings What do you think? With current lint formatting working with this tests is really awful. Pretty minor fix

@codecov-commenter
Copy link

codecov-commenter commented Oct 20, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 67.78%. Comparing base (3ca0d30) to head (68cb79f).
Report is 2 commits behind head on main.

Additional details and impacted files
@@            Coverage Diff             @@
##             main    #1868      +/-   ##
==========================================
- Coverage   69.69%   67.78%   -1.92%     
==========================================
  Files         308      309       +1     
  Lines       16147    16291     +144     
==========================================
- Hits        11254    11043     -211     
- Misses       4893     5248     +355     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@krammnic
Copy link
Contributor Author

krammnic commented Oct 20, 2024

Lint CI at this point should be changed, if not the formating will be still really bad in case of expected_tokens

Copy link
Contributor

@joecummings joecummings left a comment

Choose a reason for hiding this comment

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

Looks good - I will look into the linter issue. My naive assumption was that noqa should work.

Couple questions about possibly unintended formatting errors

messages = [
Message(
role="user",
content="Below is an instruction that describes a task. Write a response "
"that appropriately completes the request.\n\n### Instruction:\nGenerate "
"a realistic dating profile bio.\n\n### Response:\n",
"that appropriately completes the request.\n\n### Instruction:\nGenerate "
Copy link
Contributor

Choose a reason for hiding this comment

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

What are these changes?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Or, something change from my local linter changes probably, will fix

@@ -311,21 +147,17 @@ def test_tokenizer_vocab_size(self, tokenizer):
assert tokenizer.vocab_size == 128257

def test_tokenize_text_messages(
self, tokenizer, user_text_message, assistant_text_message
self, tokenizer, user_text_message, assistant_text_message
Copy link
Contributor

Choose a reason for hiding this comment

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

?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Same is here

@krammnic
Copy link
Contributor Author

I assume that fixed

@joecummings
Copy link
Contributor

I assume that fixed

Grr still failing. Mind if I take a look?

@krammnic
Copy link
Contributor Author

Isn't it about lines with # noqa?

@krammnic
Copy link
Contributor Author

Ah, I see:
tests/torchtune/models/llama3/test_llama3_tokenizer.py:226:183: B950 line too long (182 > 120 characters)

@krammnic
Copy link
Contributor Author

Fixed

@krammnic
Copy link
Contributor Author

One more...

@krammnic
Copy link
Contributor Author

fixed with flake

@krammnic
Copy link
Contributor Author

@joecummings Sorry for such lint failures, but I could not able to run pre-commit run --all-files due to current fixes

@krammnic
Copy link
Contributor Author

@joecummings Probably I found solution we need to use both # noqa and # fmt: skip. But I really don't like it

@krammnic
Copy link
Contributor Author

Oh, I broke something...

@krammnic
Copy link
Contributor Author

I don't know what is it, this tests are passing on my local and branch is up to date

@krammnic
Copy link
Contributor Author

Isn't it related too #1886? Some weird fail with torchao

@krammnic
Copy link
Contributor Author

Can we restart CI here? Or I'm not sure how to fix some torchao unrelated stuff

@krammnic
Copy link
Contributor Author

@felipemello1 @RdoubleA Maybe you can comment how to fix this torchao thing? Really strange and probably just CI rerun can't help

@RdoubleA
Copy link
Contributor

@krammnic have you merged from main after this PR was checked in? #1886

@krammnic
Copy link
Contributor Author

@krammnic have you merged from main after this PR was checked in? #1886

Oh, I see. Let me merge it, yes.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
CLA Signed This label is managed by the Facebook bot. Authors need to sign the CLA before a PR can be reviewed.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants