Beejay
October 26, 2023, 8:02pm
1
I’m already stuk in the very first step.
Working in Colab.
I created an account on Lamini and got an API key.
I also installed Lamini (with !pip install).
I copy/pasted the code snippet as on their installation guide (Authentication - ):
def authenticate_powerml():
auth.authenticate_user()
gcloud_token = !gcloud auth print-access-token
powerml_token_response = requests.get(‘https://api.powerml.co/data_studio/auth/verify_gcloud_token?token= ’ + gcloud_token[0])
return powerml_token_response.json()[‘token’]
production_token = authenticate_powerml()
!pip install --upgrade --force-reinstall --ignore-installed lamini
keys_dir_path = ‘/root/.powerml’
os.makedirs(keys_dir_path, exist_ok=True)
keys_file_path = keys_dir_path + ‘/configure_llama.yaml’
with open(keys_file_path, ‘w’) as f:
yaml.dump(config, f, default_flow_style=False)
But when I run this, I immediately get an error: JSONDecodeError: Expecting value: line 1 column 1 (char 0).
The configure_llama.yaml file is right there in my file tree.
Error is on this line:
return powerml_token_response.json()[‘token’]
Seems he can’t read the variable or something…
Hi @Beejay
The first thing that I can point out here is if you have seen if the indentation is correct. What I see is that there is no indentation where it should be, but it might be the result of pasting the code here in the forum.
TMosh
October 26, 2023, 10:45pm
3
If you’re posting code, please use the </> “Preformatted text” tool. That will preserve the indentation and spacing, so it’s easier to read via the forum.
Beejay
October 27, 2023, 6:29pm
4
I doublechecked but the indentation is correct.
Here’s the code again:
# @title Setup: Authenticate with Google & install the open-source [Lamini library](https://pypi.org/project/lamini) to use LLMs easily
from google.colab import auth
import requests
import os
import yaml
def authenticate_powerml():
auth.authenticate_user()
gcloud_token = !gcloud auth print-access-token
powerml_token_response = requests.get('https://api.powerml.co/data_studio/auth/verify_gcloud_token?token=' + gcloud_token[0])
return powerml_token_response.json()['token']
production_token = authenticate_powerml()
!pip install --upgrade --force-reinstall --ignore-installed lamini
keys_dir_path = '/root/.powerml'
os.makedirs(keys_dir_path, exist_ok=True)
keys_file_path = keys_dir_path + '/configure_llama.yaml'
with open(keys_file_path, 'w') as f:
yaml.dump(config, f, default_flow_style=False)
It’s a literal copy from the Lamini website: Authentication -
The only I got rid of is the %%capture
at the beginning.
Getting an error there too: UsageError: Line magic function %%capture
not found.
Beejay
October 27, 2023, 6:47pm
5
[UPDATE]
Got it working.
Seems that whole chunk of code isn’t even necessary.
Started from scratch as explained here:Introduction - .
Ticket closed