Giter Club home page Giter Club logo

Comments (5)

davage avatar davage commented on July 30, 2024 1

So for the DWaveSampler, every time you run sample() or sample_ising(), you are actually sending the problem to the QPU and the result returned is the sample taken from the QPU.

The first part of the code with the client, is probably unnecessary.
Once you have run the dwave config create command, set up your information, and the dwave ping command works, you should be able to create a DWaveSampler without any parameters.

You should be able to just run the second block of code as is, without the client set up.
The client is for more advanced functionality that most users will likely not need.
At least not to start out with.
The functionality is similar, and some of it is used by DWaveSampler if I'm not mistaken.

The dwave ping command will work as long as your virtual environment is activated and your config is set up properly, and as long as dwave ping works, you should be able to send problems to the QPU.

from dwave-ocean-sdk.

Bhaney44 avatar Bhaney44 commented on July 30, 2024 1

That makes a lot of sense, thanks. You explained that very clearly, I sincerely appreciate it.

from dwave-ocean-sdk.

davage avatar davage commented on July 30, 2024

Hi @Bhaney44,

Were you able to set up your virtualenv?

After setting it up, did you install the dwave-ocean-sdk?

The networkx library should be installed as a dependency with dwave-ocean-sdk.

Are you able to import dimod?
import dimod

Best regards,

Dave.

from dwave-ocean-sdk.

Bhaney44 avatar Bhaney44 commented on July 30, 2024

Yeah I'm all good. Thanks @davage.

from dwave-ocean-sdk.

Bhaney44 avatar Bhaney44 commented on July 30, 2024

I was wrong, I tried tonight and had the same problem. The issue is I can run dwave ping and get a fine response. I can also run a random problem. However, the problem is I cannot send python scripts to the QPU. The Docs skip over how to actually send a problem to the QPU. So, here in the docs is the problem. While I can set up a config, but the docs say

Alternatively, from within your code or a Python interpreter you can query solvers available for a SAPI URL and API token using dwave-cloud-client get_solvers() function.

But, I'm struggling to accomplish this. The code says:

from dwave.cloud import Client
client = Client.from_config(token='ABC-123456789123456789123456789')
client.get_solvers()

But, that returns an error for me. Traditionally, if you type python in the command line you can code in python, but that doesn't work with the QPU. Similarly, you can type Python file_name.py to run a file from the command line on the CPU. I want to get to here:

from dwave.system.samplers import DWaveSampler
from dwave.system.composites import EmbeddingComposite
sampler = EmbeddingComposite(DWaveSampler())
response = sampler.sample_ising({'a': -0.5, 'b': 1.0}, {('a', 'b'): -1})
response.data_vectors['energy']  

Either directly from the command line or even better if I can save this as a .py file and simply send it to the QPU. But, with the QPU, there isn't an intuitive way to send or run scripts. In short, I have scripts written - how do I send those python scripts to the QPU? In other words how do you get from sending a dwave ping to sending a Python script.

I hope this makes sense. Thanks again for your help. I sincerely appreciate it.

Brian

from dwave-ocean-sdk.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.