Skip to content

batch_size not support list #601

@anxinyf

Description

@anxinyf

1) Confirm the below

  • My Python version is 3.5 or higher
  • I have searched through the issues Issues for a duplicate
  • I've tested that my Keras model works as a stand-alone

2) Include the output of:

talos.__version__
1.4

3) Explain what actually happened

keras version: 2.14.0

params={'batch_size': [10, 20, 30]}

def create_model(x_train, y_train, x_val, y_val, params):
    ...
    out = model.fit(x_train, y_train, batch_size=params['batch_size'])
    return out, model

talos.Scan(x=x_train, y=y_train,
                   model=create_model,
                   params=params,
                   experiment_name='build_model',
                   x_val=x_val, y_val=y_val)

log:

out = model.fit(x_train, y_train,
  File ".../lib/python3.9/site-packages/keras/src/utils/traceback_utils.py", line 70, in error_handler
    raise e.with_traceback(filtered_tb) from None
  File ".../lib/python3.9/site-packages/keras/src/engine/data_adapter.py", line 275, in __init__
    self._size = int(math.ceil(num_samples / batch_size))
TypeError: unsupported operand type(s) for /: 'int' and 'list'
  0%|          | 0/192 [00:00<?, ?it/s]

when model.fit(batch_size=params['batch_size']), then 'batch_size' param not support list, even latest keras version v3.3.3:

batch_size: Integer or `None`.
                Number of samples per gradient update.
                If unspecified, `batch_size` will default to 32.
                Do not specify the `batch_size` if your data is in the
                form of datasets, generators, or `keras.utils.PyDataset`
                instances (since they generate batches).

Is there a problem with my configuration?


Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions