Closed albi3ro closed 3 years ago
Hey there, I just started working on this issue. I'm getting an error trying to use the forest.wavefunction
device:
import pennylane as qml
dev_wfun = qml.device('forest.wavefunction', wires=2)
---------------------------------------------------------------------------
DeviceError Traceback (most recent call last)
<ipython-input-1-40259941cb81> in <module>
1 import pennylane as qml
2
----> 3 dev_wfun = qml.device('forest.wavefunction', wires=2)
~/opt/anaconda3/envs/qml/lib/python3.8/site-packages/pennylane/__init__.py in device(name, *args, **kwargs)
253 return plugin_device_class(*args, **options)
254
--> 255 raise DeviceError("Device does not exist. Make sure the required plugin is installed.")
256
257
DeviceError: Device does not exist. Make sure the required plugin is installed.
However, my pennylane
installation seems to be working fine. For example, running dev = qml.device('default.qubit', wires=2)
raises no errors, and qml.about()
gives
Name: PennyLane
Version: 0.15.0
Summary: PennyLane is a Python quantum machine learning library by Xanadu Inc.
Home-page: https://github.com/XanaduAI/pennylane
Author: None
Author-email: None
License: Apache License 2.0
Location: /Users/ryanhill/opt/anaconda3/envs/qml/lib/python3.8/site-packages
Requires: numpy, scipy, networkx, semantic-version, autograd, appdirs, toml
Required-by: PennyLane-qiskit, PennyLane-Cirq
Platform info: macOS-10.16-x86_64-i386-64bit
Python version: 3.8.5
Numpy version: 1.18.5
Scipy version: 1.5.0
Installed devices:
- default.gaussian (PennyLane-0.15.0)
- default.mixed (PennyLane-0.15.0)
- default.qubit (PennyLane-0.15.0)
- default.qubit.autograd (PennyLane-0.15.0)
- default.qubit.jax (PennyLane-0.15.0)
- default.qubit.tf (PennyLane-0.15.0)
- default.tensor (PennyLane-0.15.0)
- default.tensor.tf (PennyLane-0.15.0)
- qiskit.aer (PennyLane-qiskit-0.16.0.dev0)
- qiskit.basicaer (PennyLane-qiskit-0.16.0.dev0)
- qiskit.ibmq (PennyLane-qiskit-0.16.0.dev0)
- cirq.mixedsimulator (PennyLane-Cirq-0.13.0)
- cirq.pasqal (PennyLane-Cirq-0.13.0)
- cirq.qsim (PennyLane-Cirq-0.13.0)
- cirq.qsimh (PennyLane-Cirq-0.13.0)
- cirq.simulator (PennyLane-Cirq-0.13.0)
Do you have any ideas as to why forest.wavefunction
isn't working here?
Thanks for taking a look :)
It looks like you don't have the "forest.wavefunction"
device installed. We should either:
dev2
to another in-built simulator, like maybe default.mixed
Other "in-built" devices technically still require additional dependencies like jax or tensorflow that aren't required by default.
I favour switching dev2
to "default.mixed"
so all code examples can run without any additional installation.
Think you could do that too?
Agreed @albi3ro, the forest device is notoriously hard to install, so probably not the best example to use
@albi3ro @co9olguy thanks for your input! I'll go ahead and switch dev2
to "default.mixed"
as you suggested.
I have a quick question regarding line 28 of docs/introduction/interfaces/torch:
"The :ref:QNode decorator <intro_vcirc_decorator>
is the recommended way for creating..."
On the webpage, this ref hyperlinks to The QNode decorator section of the Quantum Circuits docs page, but on GitHub, the link points nowhere. So my question is, where did this tag come from and what is it pointing to, exactly? For instance, if I wanted to create another ref that linked to the Creating a quantum node section just above that, where would I find the equivalent to the ".rst
files!
I'm not the best at rst files either, so take what I say with a grain of salt and check the documentation build when you make a PR.
Looks like the reference for "Creating a quantum node" is _intro_vcirc_qnode
, so a link would be :ref: Creating a QNode (or some other text) <intro_vcirc_qnode>
. Check here for more information on :ref:
This way of creating links is much more dynamic, allowing sections to get moved around without destroying links. If you look around the github pages, that's not the only link not going anywhere, just by nature of how sphinx and rst works.
Ok, gotcha. In general where I can find those references? I see for this one it was used at the top of doc/introduction/circuits.rst, but if it hadn't previously been used where could I find it?
Hey @ryanhill1! Just a bit more context for internal linking with ReST files.
Cross references are created by adding a label above section headings, like so:
.. _my-reference-label:
Section to cross-reference
--------------------------
So in order to create a cross-referenced link elsewhere, a label must first be created at the target location. A link can then be created that points towards this section heading as follows:
See here: :ref:`my-reference-label`.
By default, this link will be displayed with the name of the section it links to ("Section to cross-reference"). If you want to provide custom link text, the following syntax is used:
See the :ref:`cross referencing section <my-reference-label>` for more details.
However, that's not the only type of internal linking! There is also internal page links. For example, say that you want to link to the page doc/introduction/circuits.rst
; you can do so like this:
For more details, see the :doc:`quantum circuit quickstart </introduction/circuits.rst>`.
Note the leading forward slash in the filepath -- this means that the file path is always relative to the doc/
directory.
Note that, unless you want to link to a specific subsection of a page, internal page links are always preferred to cross references where possible.
Hi @ryanhill1 just wondering if you're still working on this issue?
We've flagged it for unitaryHACK, which means you'll be eligible for swag if you register and it is merged during next two weeks. (but it also means someone could scoop the issue sooner :wink:)
Hey! Yeah I saw that I got caught up with some other work for a minute there but I'll be submitting a pull request for this sometime tomorrow!
@albi3ro @co9olguy, yesterday I started a draft that addresses this issue. I made revisions to the PyTorch and TensorFlow introductions but held off on the Jax introduction for now until I know the first two look ok. I just had a few questions about some links/references and top-level outputs that were previously there, which I pointed out with a few comments. Could you take a look when you have a chance?
thanks @ryanhill1!
This issue has been tagged for contributions during unitaryHACK
In the interface introduction, the section on converting an existing QNode shows the function
to_torch()
, or respectivelyto_tf()
etc., returning a new QNode instead of altering that QNode in place.What exists now:
What should exist:
This should be checked for all interface options.
We should also update each interface's introduction to show creating a QNode with an interface via the class constructor:
You can find the introduction source at doc/introduction/interfaces/torch.