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

If I use Jupyter or Colab how can I put token API? #14

Open
juanramonua opened this issue Apr 13, 2023 · 1 comment
Open

If I use Jupyter or Colab how can I put token API? #14

juanramonua opened this issue Apr 13, 2023 · 1 comment

Comments

@juanramonua
Copy link

juanramonua commented Apr 13, 2023

D-wave system functions have a parameter called 'token' to pass it. But I don't know how pass this parameter to run the simple example of this web with SelectFromQuadraticModel(num_features=20).fit_transform(X_tmp.values, y.values)

Regards,

@randomir
Copy link
Member

Long-term we might want to introduce **params argument to fit() that we'll pass to LeapHybridCQMSampler(), initializing it on construction.

But as a quick fix, for now, you can leverage environment variables to configure Ocean. In particular, you can set the token via DWAVE_API_TOKEN:

import os
os.environ['DWAVE_API_TOKEN'] = '<token>'

...
SelectFromQuadraticModel(num_features=20).fit_transform(X_tmp.values, y.values)

However, you should never store your secrets/tokens in your code, or commit them.

Instead, on Google Colab, you could use something like colab-env to pull and initialize env vars from your Google Drive.

On Jupyter, depending on your environment/setup, you can set/expose DWAVE_API_TOKEN either in your shell, or container, or similar.

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