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

MNT: Update CI, add Python 3.11, fix sklearn issues #990

Merged
merged 11 commits into from
Jul 6, 2023

Conversation

BenjaminBossan
Copy link
Collaborator

@BenjaminBossan BenjaminBossan commented Jun 30, 2023

Updated description

  • Use latest versions of checkout and setup-python GH actions
  • Add Python 3.11 + PyTorch 1.13* to CI
  • Add pytest-pretty to CI when running tests, improves the output when tests fail
  • Make tests pass with new scikit-learn version
    • An error message that we test was changed, tests were adjusted
    • It seems that the classes_ attribute is now required on classifiers for some stuff related to sklearn scoring, where previously it wasn't, which resulted in some errors when we use non-skorch Datasets (which so far didn't set the attribute). There is now a fix in place that extracts y from TensorDatasets, making a failing test pass again. Other datasets could still fail, but I don't think we can write generic code that extracts y from all types of datasets (we want to avoid iterating over the dataset). For those, users would have to either use an older sklearn version or pass y explicitly to fit.

Regarding the last point, I think the change of trying to infer the classes from a dataset should not make existing code break 🤞

*PyTorch 2.0.1 does not work, even though it supposedly should, see comment below

PyTorch 2.0.1 should now run with Python 3.11. As to earlier PyTorch
versions, it's not quite clear to me, let's see and if they don't,
exclude them.
Makes errors from failing tests easier to read.
Something somewhere in sklearn changed that now requires the presence of
the classes_ attribute on classifiers when scoring. That attribute is
not always present. Now, more of an effort is made to infer the classes
when a dataset is passed.

Together with the previous commit that enables extraction of y from
TensorDatasets, this makes a test pass that failed otherwise with the
new sklearn version.
An sklearn error message that we checked was changed, resulting in the
corresponding tests to fail. This commit fixes the error message checked
in the test (which was already quite defensive beforehand).
@BenjaminBossan
Copy link
Collaborator Author

Strange, according to this, PyTorch 2.0.1 should work with Python 3.11 but the CI fails with:

RuntimeError: Python 3.11+ not yet supported for torch.compile

@BenjaminBossan BenjaminBossan requested review from ottonemo and thomasjpfan and removed request for thomasjpfan June 30, 2023 16:02
@kit1980
Copy link

kit1980 commented Jun 30, 2023

Strange, according to this, PyTorch 2.0.1 should work with Python 3.11 but the CI fails with:

@BenjaminBossan I don't believe the person that made that comment works on PyTorch.

@BenjaminBossan
Copy link
Collaborator Author

I don't believe the person that made that comment works on PyTorch.

Yes, I had still hoped they were telling the truth :D

@BenjaminBossan BenjaminBossan changed the title MNT: Update CI, add Python 3.11 MNT: Update CI, add Python 3.11, fix sklearn issues Jul 4, 2023
Explicitly test that when fitting with a TensorDataset, the
NeuralNetClassifier still manages to set the classes_ attribute.
@BenjaminBossan BenjaminBossan merged commit 8c1e66a into master Jul 6, 2023
13 checks passed
@BenjaminBossan BenjaminBossan deleted the MNT-update-ci-python-3.11 branch July 6, 2023 12:31
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