Open In Colab  View Notebook on GitHub

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.

workflow

Table of Contents#

  1. Configure Users

    1. Current active User

    2. Create User

    3. Update User

  2. Conclusion

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:

deploy on spaces

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.