Skip to content

Commit

Permalink
feat: set CREATOR_USER_ID to avoid difficulties with creation in orga… (
Browse files Browse the repository at this point in the history
#5556)

…nisation

# Description
<!-- Please include a summary of the changes and the related issue.
Please also include relevant motivation and context. List any
dependencies that are required for this change. -->

User `CREATOR_USER_ID` with this API
https://huggingface.co/api/users/davidberenstein1957/overview

**Type of change**
<!-- Please delete options that are not relevant. Remember to title the
PR according to the type of change -->

- Improvement (change adding some improvement to an existing
functionality)

**How Has This Been Tested**
<!-- Please add some reference about how your feature has been tested.
-->

**Checklist**
<!-- Please go over the list and make sure you've taken everything into
account -->

- I added relevant documentation
- I followed the style guidelines of this project
- I did a self-review of my code
- I made corresponding changes to the documentation
- I confirm My changes generate no new warnings
- I have added tests that prove my fix is effective or that my feature
works
- I have added relevant notes to the CHANGELOG.md file (See
https://keepachangelog.com/)

---------

Co-authored-by: Paco Aranda <[email protected]>
  • Loading branch information
davidberenstein1957 and frascuchon authored Oct 7, 2024
1 parent 6c5d5e9 commit 83996fe
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 18 deletions.
4 changes: 3 additions & 1 deletion argilla-server/docker/argilla-hf-spaces/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,9 @@ RUN \
apt-get remove -y wget gnupg && \
apt-get clean && \
rm -rf /var/lib/apt/lists/* && \
rm -rf /packages
rm -rf /packages && \
# Install pwgen curl and jq
apt-get update && apt-get install -y curl jq pwgen

COPY config/elasticsearch.yml /etc/elasticsearch/elasticsearch.yml

Expand Down
7 changes: 5 additions & 2 deletions argilla-server/docker/argilla-hf-spaces/scripts/start.sh
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,11 @@ export OAUTH2_HUGGINGFACE_CLIENT_ID=$OAUTH_CLIENT_ID
export OAUTH2_HUGGINGFACE_CLIENT_SECRET=$OAUTH_CLIENT_SECRET
export OAUTH2_HUGGINGFACE_SCOPE=$OAUTH_SCOPES

# Set the space author name as username if no provided.
# Set the space creator name as username if no name is provided, if the user is not found, use the provided space author name
# See https://huggingface.co/docs/hub/en/spaces-overview#helper-environment-variables for more details
export USERNAME="${USERNAME:-$SPACE_AUTHOR_NAME}"
DEFAULT_USERNAME=$(curl -L -s https://huggingface.co/api/users/${SPACES_CREATOR_USER_ID}/overview | jq -r '.user' || echo "${SPACE_AUTHOR_NAME}")
export USERNAME="${USERNAME:-$DEFAULT_USERNAME}"
DEFAULT_PASSWORD=$(pwgen -s 16 1)
export PASSWORD="${PASSWORD:-$DEFAULT_PASSWORD}"

honcho start
Original file line number Diff line number Diff line change
Expand Up @@ -82,10 +82,7 @@ Creating an Argilla Space within an organization is useful for several scenarios
- **You want manage the Space together with other users** (e.g., Space settings, etc.). Note that if you just want to manage your Argilla datasets, workspaces, you can achieve this by adding other Argilla `owner` roles to your Argilla Server.
- **More generally, you want to make available your space under an organization/community umbrella**.

The steps are very similar the [Quickstart guide](quickstart.md) with two important differences:

!!! tip "Setup USERNAME"
You need to **set up the `USERNAME` Space Secret with your Hugging Face username**. This way, the first time you enter with the `Hugging Face Sign in` button, you'll be granted the `owner` role.
The steps are very similar the [Quickstart guide](quickstart.md) with one important difference:

!!! tip "Enable Persistent Storage `SMALL`"
Not setting persistent storage to `Small` means that **you will loose your data when the Space restarts**.
Expand Down Expand Up @@ -118,16 +115,6 @@ client = rg.Argilla(

## Space Secrets overview

There's two optional secrets to set up the `USERNAME` and `PASSWORD` of the `owner` of the Argilla Space. Remember that, by default Argilla Spaces are configured with a *Sign in with Hugging Face* button, which is also used to grant an `owner` to the creator of the Space for personal spaces.

The `USERNAME` and `PASSWORD` are only useful in a couple of scenarios:

- You have [disabled Hugging Face OAuth](#how-to-configure-and-disable-oauth-access).
- You want to [set up Argilla under an organization](#how-to-deploy-argilla-under-a-hugging-face-organization) and want your Hugging Face username to be granted the `owner` role.
Remember that, by default, Argilla Spaces are configured with a *Sign in with Hugging Face* button, which is also used to grant an `owner` to the creator of the Space. There are two optional secrets to set up the `USERNAME` and `PASSWORD` of the `owner` of Argilla Space. Those are useful when you want to create a different owner user to login into Argilla.

In summary, when setting up a Space:
!!! info "Creating a Space under your personal account"
If you are creating the Space under your personal account, **don't insert any value for `USERNAME` and `PASSWORD`**. Once you launch the Space you will be able to Sign in with your Hugging Face username and the `owner` role.

!!! info "Creating a Space under an organization"
If you are creating the Space under an organization **make sure to insert your Hugging Face username in the secret `USERNAME`**. In this way, you'll be able to Sign in with your Hugging Face user.

0 comments on commit 83996fe

Please sign in to comment.