keras-team / keras

Deep Learning for humans
http://keras.io/
Apache License 2.0
61.26k stars 19.37k forks source link

model.compile(jit_compile=True) for PyTorch has no intended effect (Keras 3.3) #19815

Open lseongjoo opened 3 weeks ago

lseongjoo commented 3 weeks ago

Description

When training a model in Keras 3.3 with the jit_compile=True option, a warning is displayed:

UserWarning: Model doesn't support `jit_compile=True`. Proceeding with `jit_compile=False`

PyTorch reports back its backends

assert torch.cuda.is_available()
torch.compiler.list_backends()
# ['cudagraphs', 'inductor', 'onnxrt', 'openxla', 'openxla_eval', 'tvm']

Investigation

Upon reviewing the source code, it appears that the jit_compile option is not implemented for PyTorch models. This feature might be planned but is not yet reflected in the code.

Steps to Reproduce

  1. Define a model using PyTorch.
  2. Compile the model with jit_compile=True.
  3. Observe the warning during training.

Expected Behavior

The model should utilize jit_compile=True without warnings, or the documentation should clarify that this option is not supported for PyTorch models.

Environment

Additional Information

Please provide any updates on the planned implementation of jit_compile for PyTorch models or correct the documentation if this feature is not intended to be supported.

sachinprasadhs commented 3 weeks ago

Hi for the API's or Layers which does not support XLA then the model will not proceed with jit_compile=True, it will instead fallback to jit_compile=False mode.

github-actions[bot] commented 1 week ago

This issue is stale because it has been open for 14 days with no activity. It will be closed if no further activity occurs. Thank you.