Configuring Users
and Workspaces
#
This tutorial is part of a series in which we will get to know the FeedbackDataset
. In this step, we will show how to configure Users
and Workspaces
. If you need additional context, consult user management and workspace management.
Table of Contents#
Running Argilla#
For this tutorial, you will need to have an Argilla server running. There are two main options for deploying and running Argilla:
Deploy Argilla on Hugging Face Spaces: If you want to run tutorials with external notebooks (e.g., Google Colab) and you have an account on Hugging Face, you can deploy Argilla on Spaces with a few clicks:
For details about configuring your deployment, check the official Hugging Face Hub guide.
Launch Argilla using Argillaโs quickstart Docker image: This is the recommended option if you want Argilla running on your local machine. Note that this option will only let you run the tutorial locally and not with an external notebook service.
For more information on deployment options, please check the Deployment section of the documentation.
Tip
This tutorial is a Jupyter Notebook. There are two options to run it:
Use the Open in Colab button at the top of this page. This option allows you to run the notebook directly on Google Colab. Donโt forget to change the runtime type to GPU for faster model training and inference.
Download the .ipynb file by clicking on the View source link at the top of the page. This option allows you to download the notebook and run it on your local machine or on a Jupyter notebook tool of your choice.
First letโs install our dependencies and import the necessary libraries:
[ ]:
!pip install "argilla[server]"
[1]:
import argilla as rg
from argilla._constants import DEFAULT_API_KEY
In order to run this notebook we will need some credentials to push and load datasets from Argilla
and ๐คhub
, letโs set them in the following cell:
[54]:
# Argilla credentials
api_url = "http://localhost:6900" # "https://<YOUR-HF-SPACE>.hf.space"
api_key = DEFAULT_API_KEY # admin.apikey
hf_token = None # not used in this tutorial
Log to argilla:
[ ]:
rg.init(
api_url=api_url,
api_key=api_key
)
Alternatively, we can use the CLI
to run the argilla login
command and pass the api_url
and api_key
there.
[ ]:
!python -m argilla login --api-url {api_url} --api-key {api_key}
Enable Telemetry#
We gain valuable insights from how you interact with our tutorials. To improve ourselves in offering you the most suitable content, using the following lines of code will help us understand that this tutorial is serving you effectively. Though this is entirely anonymous, you can choose to skip this step if you prefer. For more info, please check out the Telemetry page.
[ ]:
try:
from argilla.utils.telemetry import tutorial_running
tutorial_running()
except ImportError:
print("Telemetry is introduced in Argilla 1.20.0 and not found in the current installation. Skipping telemetry.")
Configure Users
#
Current active User
#
For this tutorial, weโll start with exploring the currently active user weโve configured during the initialization. We can do this using our Python
client or CLI
.
[14]:
user = rg.User.me()
user
[14]:
User(id=f3cc0d01-5129-41a6-a722-6c51b097abd0, username=argilla, role=owner, api_key=argilla.apikey, first_name=, last_name=None, inserted_at=2023-10-28 11:26:52.618074, updated_at=2023-10-28 11:26:52.618074)
[13]:
!python -m argilla whoami
โญโ Current User โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโฎ
โ โ
โ โข Username: argilla โ
โ โข Role: owner โ
โ โข First name: โ
โ โข Last name: None โ
โ โข API Key: argilla.apikey โ
โ โข Workspaces: ['argilla', 'awesome-argilla-datasets'] โ
โฐโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโฏ
As we can see, we are logged into the default User
called argilla
, which has the owner
role. This role
is allowed to create new Users
and configure workspaces.
Create User
#
Next, we will create two new users with the role of admin
and annotator
to configure our first small team. For convenience and reproducibility, we will call them admin
and annotator
, and weโll set their password
to the default argilla.apikey
. Their api_key
will be randomly generated according to safety standards. We will first create the admin
user with our Python
client.
[ ]:
try:
user = rg.User.from_name("admin")
except Exception:
user = rg.User.create(
username="admin",
password=api_key,
role="admin",
)
user
[ ]:
!python -m argilla users create --username owner --role owner --password {api_key}
Update User
#
At the moment we can only update User
role and this can only be done using the CLI
.
[55]:
!python -m argilla server database users update owner --role admin
User with username 'owner' does not exists in database. Skipping...
Now, letโs quickly change this back to avoid having wrong access in our organization.
[ ]:
list(rg.User.list())
[58]:
!python -m argilla server database users update owner --role owner
User with username 'owner' does not exists in database. Skipping...
Conclusion#
In this tutorial, we created some Argilla Users
and Workspaces
, and created some annotation team configurations.
If you need additional context, consult user management and workspace management.
Alternatively, you can go to the next step and create a FeedbackDataset.