Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions CHANGES.md
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0

### Fixed

- Fix CLI object parsing for string keyword values containing `=`.
- `ValidSplit` now raises a clear error when it receives an `IterableDataset`, instead of an opaque `TypeError` about a missing length (#594)
- `Checkpoint`'s sink message now reports the epoch the checkpoint was actually taken in, instead of the following one
- Fix pickling a net with an `LRScheduler` callback dragging along a reference to the (potentially CUDA-resident) optimizer, which could prevent loading nets trained on CUDA on a CPU-only machine (#1096)
Expand Down
2 changes: 1 addition & 1 deletion skorch/cli.py
Original file line number Diff line number Diff line change
Expand Up @@ -94,7 +94,7 @@ def _parse_args_kwargs(params):
if '=' not in param:
args += (DefaultParseValue(param),)
else:
k, v = param.split('=')
k, v = param.split('=', 1)
kwargs[k.strip()] = DefaultParseValue(v)
return args, kwargs

Expand Down
5 changes: 5 additions & 0 deletions skorch/tests/test_cli.py
Original file line number Diff line number Diff line change
Expand Up @@ -67,6 +67,11 @@ def test_parse_net_kwargs(self, parse_net_kwargs):
assert np.isclose(parsed_kwargs['module__nonlin'].lower, 0.123)
assert np.isclose(parsed_kwargs['module__nonlin'].upper, 0.456)

@pytest.mark.parametrize('label', ['epoch', 'epoch=1', 'epoch=1=best'])
def test_parse_net_kwargs_string_with_equals(self, parse_net_kwargs, label):

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.

This case could be easily integrated into the test above, right?

kwargs = {'module__config': f'builtins.dict(label="{label}")'}
assert parse_net_kwargs(kwargs) == {'module__config': {'label': label}}

@pytest.fixture
def net_cls(self):
from skorch import NeuralNetClassifier
Expand Down