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

batch_size not support list #601

Open
3 tasks done
anxinyf opened this issue Apr 29, 2024 · 1 comment
Open
3 tasks done

batch_size not support list #601

anxinyf opened this issue Apr 29, 2024 · 1 comment
Assignees

Comments

@anxinyf
Copy link

anxinyf commented Apr 29, 2024

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?


@mikkokotila
Copy link
Contributor

@anxinyf there is nothing apparent from what you have shared above. Is it possible to share a google colab notebook which reproduce this issue?

@mikkokotila mikkokotila self-assigned this Apr 30, 2024
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

No branches or pull requests

2 participants