Skip to content

Conversation

isaacdevlugt
Copy link
Contributor

@isaacdevlugt isaacdevlugt commented Aug 7, 2025

Title: TF warnings in demos

Summary: add warnings to demos that use TF since we are removing support soon

Relevant references:

Possible Drawbacks: none

Related Shortcut Stories:
[sc-92521]

@isaacdevlugt isaacdevlugt requested review from gabrielasd, andrijapau and a user August 7, 2025 15:34
@isaacdevlugt
Copy link
Contributor Author

Do we change this?

tensorflow==2.14.1

@isaacdevlugt
Copy link
Contributor Author

And these?

<input type="radio" class="controls" id="tensorflow" name="categories" value="tensorflow">

qml/conf.py

Line 176 in 2b81e12

"TensorFlow, the TensorFlow logo, and any related marks are trademarks of Google Inc."

@doctorperceptron
Copy link
Collaborator

Do we change this?

tensorflow==2.14.1

Ya if we're removing tensorflow entirely, this can be removed. Note that this is a constraints file, so keeping this won't actually install tensorflow, but it will be a bit confusing to keep a constraint that isn't needed.

@doctorperceptron
Copy link
Collaborator

<input type="radio" class="controls" id="tensorflow" name="categories" value="tensorflow">

Not sure what that is tbh. I don't think we use this file anymore. @rashidnhm do you know what this is for?

qml/conf.py

Line 176 in 2b81e12

"TensorFlow, the TensorFlow logo, and any related marks are trademarks of Google Inc."

Probably doesn't hurt to keep this, in case we reference TensorFlow anywhere in this repo.

Copy link
Contributor

@andrijapau andrijapau left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Metadata for these?

Image

@isaacdevlugt
Copy link
Contributor Author

Metadata for these?
Image

The qnn_module_tf already has a warning there that makes it incompatible with v0.40 or lower 👎. For diffable-mitigation, there's just mention of tensorflow in a paragraph that I deleted. No usage of tensorflow the package :)

@isaacdevlugt isaacdevlugt requested a review from andrijapau August 8, 2025 17:22
Copy link
Contributor

@andrijapau andrijapau left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Changes look good! Although, can you update the date last modified for each of the metadatas ... I'm sorry.

@isaacdevlugt isaacdevlugt requested a review from andrijapau August 8, 2025 18:27
@andrijapau
Copy link
Contributor

Looks like V2 builds are failing @Alan-eMartin , any ideas? I think they might not be up to date with the V1 demos

@doctorperceptron
Copy link
Collaborator

Looks like V2 builds are failing @Alan-eMartin , any ideas? I think they might not be up to date with the V1 demos

This demo is targeting dev, and looks like it is using PL functionality that is being deprecated in v0.43:

Traceback (most recent call last):
      File "/home/runner/work/qml/qml/_build/demonstrations/tutorial_diffable-mitigation.py", line 50, in <module>
        from pennylane.transforms import mitigate_with_zne
      File "<frozen importlib._bootstrap>", line 1229, in _handle_fromlist
      File "/home/runner/work/qml/qml/.venv-build/lib/python3.11/site-packages/pennylane/transforms/__init__.py", line 358, in __getattr__
        warnings.warn(
    pennylane.exceptions.PennyLaneDeprecationWarning: pennylane.mitigate_with_zne is no longer accessible from the transforms module                 and must be imported as pennylane.noise.mitigate_with_zne.                     Support for access through this module will be removed in v0.44.

@doctorperceptron
Copy link
Collaborator

Looks like V2 builds are failing @Alan-eMartin , any ideas? I think they might not be up to date with the V1 demos

The other failure is because the lock file has not been updated.

@andrijapau
Copy link
Contributor

Looks like V2 builds are failing @Alan-eMartin , any ideas? I think they might not be up to date with the V1 demos

This demo is targeting dev, and looks like it is using PL functionality that is being deprecated in v0.43:

Traceback (most recent call last):
      File "/home/runner/work/qml/qml/_build/demonstrations/tutorial_diffable-mitigation.py", line 50, in <module>
        from pennylane.transforms import mitigate_with_zne
      File "<frozen importlib._bootstrap>", line 1229, in _handle_fromlist
      File "/home/runner/work/qml/qml/.venv-build/lib/python3.11/site-packages/pennylane/transforms/__init__.py", line 358, in __getattr__
        warnings.warn(
    pennylane.exceptions.PennyLaneDeprecationWarning: pennylane.mitigate_with_zne is no longer accessible from the transforms module                 and must be imported as pennylane.noise.mitigate_with_zne.                     Support for access through this module will be removed in v0.44.

Yup, that demo was updated on V1 but not V2

@Alan-eMartin
Copy link
Collaborator

Alan-eMartin commented Aug 8, 2025

Looks like V2 builds are failing @Alan-eMartin , any ideas? I think they might not be up to date with the V1 demos

This demo is targeting dev, and looks like it is using PL functionality that is being deprecated in v0.43:

Traceback (most recent call last):
      File "/home/runner/work/qml/qml/_build/demonstrations/tutorial_diffable-mitigation.py", line 50, in <module>
        from pennylane.transforms import mitigate_with_zne
      File "<frozen importlib._bootstrap>", line 1229, in _handle_fromlist
      File "/home/runner/work/qml/qml/.venv-build/lib/python3.11/site-packages/pennylane/transforms/__init__.py", line 358, in __getattr__
        warnings.warn(
    pennylane.exceptions.PennyLaneDeprecationWarning: pennylane.mitigate_with_zne is no longer accessible from the transforms module                 and must be imported as pennylane.noise.mitigate_with_zne.                     Support for access through this module will be removed in v0.44.

Yup, that demo was updated on V1 but not V2

would the logical update be transfering the contents of those files in v1 to v2?

I see the following demos with this change. If so, I think that the best course of action would be to do this.

Screenshot 2025-08-08 at 3 30 11 PM

CC: @isaacdevlugt, @andrijapau @doctorperceptron

@Alan-eMartin
Copy link
Collaborator

Also, could you confirm that this was renamed to prevent the execution? If so we can update them be tutorial again (in v2 only) and change "executable_latest" false

@andrijapau
Copy link
Contributor

Also, could you confirm that this was renamed to prevent the execution? If so we can update them be tutorial again (in v2 only) and change "executable_latest" false

Sorry, which demo do you think was renamed?

@justinpickering
Copy link
Contributor

justinpickering commented Aug 13, 2025

Linking to this ticket to track the change in marking demos non-executable: [sc-97632]

github-merge-queue bot pushed a commit to PennyLaneAI/pennylane that referenced this pull request Aug 14, 2025
**Context:**

We are deprecating `tensorflow` maintenance support and promoting user
migration to `jax` and `torch` interfaces.

**Description of the Change:**

- Add deprecation warning to `QNode` execution. This will capture
majority of user workflows and ensure deprecation visibility.
- Add deprecation warning to
https://docs.pennylane.ai/en/stable/introduction/interfaces/tf.html
- Add deprecation warning in changelog (which will be promoted to
release notes).
- Cleaned up necessary tests to un-block work (this involved deleting TF
specific `all_interfaces` tests).
- Add no cover to TF logic branches

Here's an example,

```python
import pennylane as qml
import tensorflow as tf

dev = qml.device("default.qubit", wires=1)
params = tf.Variable(0.1)

@qml.qnode(dev)
def circuit(x):
    qml.RX(x, wires=0)
    return qml.expval(qml.PauliZ(0))

circuit(params)
```
```
PennyLaneDeprecationWarning: Support for the TensorFlow interface is deprecated and will be removed in v0.44. Future versions of PennyLane are not guaranteed to work with TensorFlow. Please migrate your workflows to JAX or torch to benefit from enhanced support and features.
  circuit(params)
  
<tf.Tensor: shape=(), dtype=float64, numpy=0.9950041833264242>
```

**Benefits:** No longer have to deal with maintaining TF.

**Possible Drawbacks:**

This could have impact on our eco-system:

Catalyst: N/A
Lightning: PennyLaneAI/pennylane-lightning#1225

QML: Some
[demos](https://github.com/search?q=repo%3APennyLaneAI%2Fqml%20import%20tensorflow&type=code)
need changes. Being taken care of by product here
PennyLaneAI/qml/pull/1505.

Plug-ins: N/A 

[sc-92521]

---------

Co-authored-by: Pietropaolo Frisoni <[email protected]>
Co-authored-by: Mudit Pandey <[email protected]>
Co-authored-by: Isaac De Vlugt <[email protected]>
Co-authored-by: Isaac De Vlugt <[email protected]>
@Alan-eMartin
Copy link
Collaborator

@isaacdevlugt — you may close this now. The changes from this branch have been merged along with the python fixes, etc.

@andrijapau
Copy link
Contributor

Closing as these changes were addressed in https://github.com/PennyLaneAI/qml/pull/1516/files

@andrijapau andrijapau closed this Aug 15, 2025
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

Successfully merging this pull request may close these issues.

5 participants