You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Update test pipeline to latest software versions - #281
Update several parts of the testing pipeline to latest software versions.
Test pipeline runs again, except the windows tests, which are due to an actual bug in a plotting test. I will open a separate PR for that particular issue.
sklearn
A "minimally invasive" update to the parametrize_with_checks_slow function. In sklearn.utils.estimator_checks.check_estimator, the generate_only was deprecated after sklearn 1.6.
Bumped python (3.13) and torch (2.9.1) for the main test workflows.
Bumped legacy python version from 3.9 to 3.10 as 3.9 reached eol.
Added a new build workflow (latest.yml) to check compatibility with the very latest packages (python 3.14 and latest torch). In this workflow cebra is installed without datasets/integrations to minimize the cross-dependencies (e.g. tables does not install currently on 3.14).
other fixes in the build pipline
removed excessive deprecation warnings in the reference transform() implementation
self = <pytest_sphinx.SphinxDocTestRunner object at 0x7f9524357750>
test = <DocTest usage.rst from usage.rst:0 (39 examples)>, compileflags = 0
out = []
def _DocTestRunner__run(
self, test: doctest.DocTest, compileflags: int, out: "_Out"
) -> doctest.TestResults:
"""
Run the examples in `test`.
Write the outcome of each example with one of the
`DocTestRunner.report_*` methods, using the writer function
`out`. `compileflags` is the set of compiler flags that should
be used to execute examples. Return a tuple `(f, t)`, where `t`
is the number of examples tried, and `f` is the number of
examples that failed. The examples are run in the namespace
`test.globs`.
"""
# Keep track of the number of failures and tries.
failures = tries = 0
# Save the option flags (since option directives can be used
# to modify them).
original_optionflags = self.optionflags
SUCCESS, FAILURE, BOOM = range(3) # `outcome` state
check = self._checker.check_output
# Process each example.
for examplenum, example in enumerate(test.examples):
# If REPORT_ONLY_FIRST_FAILURE is set, then suppress
# reporting after the first failure.
quiet = (
self.optionflags & doctest.REPORT_ONLY_FIRST_FAILURE and failures > 0
)
# Merge in the example's options.
self.optionflags = original_optionflags
if example.options:
for optionflag, val in example.options.items():
if val:
self.optionflags |= optionflag
else:
self.optionflags &= ~optionflag
# If 'SKIP' is set, then skip this example.
if self.optionflags & doctest.SKIP:
continue
# Record that we started this example.
tries += 1
if not quiet:
self.report_start(out, test, example)
# Use a special filename for compile(), so we can retrieve
# the source code during interactive debugging (see
# __patched_linecache_getlines).
filename = "<doctest %s[%d]>" % (test.name, examplenum)
# Run the example in the given context (globs), and record
# any exception that gets raised. (But don't intercept
# keyboard interrupts.)
try:
# Don't blink! This is where the user's code gets run.
exec(
compile(example.source, filename, "exec", compileflags, 1),
test.globs,
)
self.debugger.set_continue() # ==== Example Finished ====
exception = None
except KeyboardInterrupt:
raise
except Exception:
exception = sys.exc_info()
self.debugger.set_continue() # ==== Example Finished ====
got = self._fakeout.getvalue() # the actual output
self._fakeout.truncate(0)
outcome = FAILURE # guilty until proved innocent or insane
# If the example executed without raising any exceptions,
# verify its output.
if exception is None:
if check(example.want, got, self.optionflags):
outcome = SUCCESS
# The example raised an exception: check if it was expected.
else:
exc_msg = traceback.format_exception_only(*exception[:2])[-1]
if not quiet:
got += doctest._exception_traceback(exception) # type:ignore
# If `example.exc_msg` is None, then we weren't expecting
# an exception.
if example.exc_msg is None:
outcome = BOOM
# We expected an exception: see whether it matches.
elif check(example.exc_msg, exc_msg, self.optionflags):
outcome = SUCCESS
# Another chance if they didn't care about the detail.
elif self.optionflags & doctest.IGNORE_EXCEPTION_DETAIL:
if check(
doctest._strip_exception_details( # type:ignore
example.exc_msg,
),
doctest._strip_exception_details(exc_msg), # type:ignore
self.optionflags,
):
outcome = SUCCESS
# Report the outcome.
if outcome is SUCCESS:
if not quiet:
self.report_success(out, test, example, got)
elif outcome is FAILURE:
if not quiet:
self.report_failure(out, test, example, got)
failures += 1
elif outcome is BOOM:
if not quiet:
assert exception is not None
assert out is not None
self.report_unexpected_exception(
out,
test,
example,
exception, # type:ignore
)
failures += 1
else:
assert False, ("unknown outcome", outcome)
if failures and self.optionflags & doctest.FAIL_FAST:
break
# Restore the option flags (in case they were modified)
self.optionflags = original_optionflags
# Record and return the number of failures and tries.
> self._DocTestRunner__record_outcome(test, failures, tries) # type:ignore
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
E TypeError: DocTestRunner.__record_outcome() missing 1 required positional argument: 'skips'
Onwards --- remaining issue is with windows tests, due to a change starting in torch 2.6:
Weights only load failed. In PyTorch 2.6, we changed the default value of the weights_only argument in torch.load from False to True. Re-running torch.load with weights_only set to False will likely succeed, but it can result in arbitrary code execution. Do it only if you got the file from a trusted source.
Please file an issue with the following so that we can make weights_only=True compatible with your use case: WeightsUnpickler error: Can only build Tensor, Parameter, OrderedDict or types allowlisted via add_safe_globals, but got <class 'numpy.dtypes.Int32DType'>"
This is likely because the numpy types are named slightly different on windows. Root cause
cebra\grid_search.py:293: in load
model = cebra_sklearn_cebra.CEBRA.load(filename)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
cebra\integrations\sklearn\cebra.py:1460: in load
checkpoint = _safe_torch_load(filename, weights_only, **kwargs)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
cebra\integrations\sklearn\cebra.py:75: in _safe_torch_load
checkpoint = torch.load(filename, weights_only=True, **kwargs)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Update several parts of the testing pipeline to latest software versions.
Test pipeline runs again, except the windows tests, which are due to an actual bug in a plotting test. I will open a separate PR for that particular issue.
sklearn
A "minimally invasive" update to the
parametrize_with_checks_slowfunction. Insklearn.utils.estimator_checks.check_estimator, thegenerate_onlywas deprecated after sklearn 1.6.This PR upgrades to the new estimator_checks_generator function, added in 1.6.
python and torch versions
latest.yml) to check compatibility with the very latest packages (python 3.14 and latest torch). In this workflow cebra is installed without datasets/integrations to minimize the cross-dependencies (e.g. tables does not install currently on 3.14).other fixes in the build pipline
Fix #280
Fix #283
Close #275