Skip to content

Commit 83996fe

Browse files
feat: set CREATOR_USER_ID to avoid difficulties with creation in orga… (#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]>
1 parent 6c5d5e9 commit 83996fe

File tree

3 files changed

+10
-18
lines changed

3 files changed

+10
-18
lines changed

argilla-server/docker/argilla-hf-spaces/Dockerfile

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,9 @@ RUN \
4444
apt-get remove -y wget gnupg && \
4545
apt-get clean && \
4646
rm -rf /var/lib/apt/lists/* && \
47-
rm -rf /packages
47+
rm -rf /packages && \
48+
# Install pwgen curl and jq
49+
apt-get update && apt-get install -y curl jq pwgen
4850

4951
COPY config/elasticsearch.yml /etc/elasticsearch/elasticsearch.yml
5052

argilla-server/docker/argilla-hf-spaces/scripts/start.sh

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,8 +8,11 @@ export OAUTH2_HUGGINGFACE_CLIENT_ID=$OAUTH_CLIENT_ID
88
export OAUTH2_HUGGINGFACE_CLIENT_SECRET=$OAUTH_CLIENT_SECRET
99
export OAUTH2_HUGGINGFACE_SCOPE=$OAUTH_SCOPES
1010

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

1518
honcho start

argilla/docs/getting_started/how-to-configure-argilla-on-huggingface.md

Lines changed: 2 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -82,10 +82,7 @@ Creating an Argilla Space within an organization is useful for several scenarios
8282
- **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.
8383
- **More generally, you want to make available your space under an organization/community umbrella**.
8484

85-
The steps are very similar the [Quickstart guide](quickstart.md) with two important differences:
86-
87-
!!! tip "Setup USERNAME"
88-
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.
85+
The steps are very similar the [Quickstart guide](quickstart.md) with one important difference:
8986

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

119116
## Space Secrets overview
120117

121-
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.
122-
123-
The `USERNAME` and `PASSWORD` are only useful in a couple of scenarios:
124-
125-
- You have [disabled Hugging Face OAuth](#how-to-configure-and-disable-oauth-access).
126-
- 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.
118+
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.
127119

128-
In summary, when setting up a Space:
129-
!!! info "Creating a Space under your personal account"
130-
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.
131120

132-
!!! info "Creating a Space under an organization"
133-
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 commit comments

Comments
 (0)