-
Notifications
You must be signed in to change notification settings - Fork 399
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[ENHANCEMENT] improve argilla deployments when running on spaces (#5255)
# 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. --> This is the main feature branch to improve the Argilla deployments when running on spaces. The main features that include this PR are: - The OAUTH client configuration will be automatically read from the HF environment (the `hf_oauth` flag must be set to `true`. See the [docs](https://huggingface.co/docs/hub/en/spaces-oauth#create-an-oauth-app) for more details) - If users want to create a specific owner without using the OAuth flow, `USERNAME` and `PASSWORD` env variables are available for that purpose (By default, `USERNAME` will be filled with the `SPACE_AUTHOR_NAME` value) - The Argilla template will be set to running Argilla with OAuth enabled by default (users don't need to fine-tune anything after cloning the template). - Workspaces defined in `.oauth.yaml` will be created automatically (By default, the template will provide the `argilla` workspace) - When the space author is an HF username, that user will be the argilla `owner` for the Argilla server. - When the space author is an HF organization, user roles will be computed from roles in the ORG -> (for now admin roles in the HF org will be mapped as `owner` roles in Argilla. The rest will be mapped as the `annotator` role). ## Tasks - [X] Update image README.md - [x] [Simplify environment variables](#5256) - [x] [Create a single user providing USERNAME and PASSWORD env variables (temporal solution)](#5256) - [x] [Reading injected `OAUTH_CLIENT_ID` and `OAUTH_CLIENT_SECRET` to avoid the OAuth app configuration step.](#5262) - [x] [Create the user with roles depending on the space privileges (user space VS org space)](#5299) - [x] [Create workspaces configured in `.oauth.yaml::allowed_workspaces` ](#5287) - [ ] Update docs - [x] [Rename quickstart image to `argilla-hf-spaces`](#5307) **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) - Documentation update **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: José Francisco Calvo <[email protected]>
- Loading branch information
1 parent
122a17a
commit 2774686
Showing
36 changed files
with
677 additions
and
364 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
<h1 align="center"> | ||
<a href=""><img src="https://github.com/dvsrepo/imgs/raw/main/rg.svg" alt="Argilla" width="150"></a> | ||
<br> | ||
Argilla | ||
<br> | ||
</h1> | ||
|
||
> This Docker image corresponds to the **Argilla Hugging Face Spaces deployment** and **can only be used to deploy Argilla inside the Hugging Face Hub**. For other type of deployments check the Argilla docs. | ||
|
||
Argilla is a **collaboration tool for AI engineers and domain experts** that require **high-quality outputs, data ownership, and overall efficiency**. | ||
|
||
## Why use Argilla? | ||
|
||
Whether you are working on monitoring and improving complex **generative tasks** involving LLM pipelines with RAG, or you are working on a **predictive task** for things like AB-testing of span- and text-classification models. Our versatile platform helps you ensure **your data work pays off**. |
File renamed without changes.
File renamed without changes.
File renamed without changes.
35 changes: 35 additions & 0 deletions
35
argilla-server/docker/argilla-hf-spaces/scripts/start_argilla_server.sh
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
#!/usr/bin/env bash | ||
|
||
set -e | ||
|
||
# Preset oauth env vars based on injected space variables. | ||
# See https://huggingface.co/docs/hub/en/spaces-oauth#create-an-oauth-app | ||
export OAUTH2_HUGGINGFACE_CLIENT_ID=$OAUTH_CLIENT_ID | ||
export OAUTH2_HUGGINGFACE_CLIENT_SECRET=$OAUTH_CLIENT_SECRET | ||
export OAUTH2_HUGGINGFACE_SCOPE=$OAUTH_SCOPES | ||
|
||
echo "Running database migrations" | ||
python -m argilla_server database migrate | ||
|
||
# Set the space author name as username if no provided. | ||
# See https://huggingface.co/docs/hub/en/spaces-overview#helper-environment-variables for more details | ||
USERNAME="${USERNAME:-$SPACE_AUTHOR_NAME}" | ||
|
||
if [ -n "$USERNAME" ] && [ -n "$PASSWORD" ]; then | ||
echo "Creating owner user with username ${USERNAME}" | ||
python -m argilla_server database users create \ | ||
--first-name "$USERNAME" \ | ||
--username "$USERNAME" \ | ||
--password "$PASSWORD" \ | ||
--role owner | ||
else | ||
echo "No username and password was provided. Skipping user creation" | ||
fi | ||
|
||
# Forcing reindex on restart since elasticsearch data could be allocated in a non-persistent volume | ||
echo "Reindexing existing datasets" | ||
python -m argilla_server search-engine reindex | ||
|
||
# Start Argilla | ||
echo "Starting Argilla" | ||
python -m uvicorn argilla_server:app --host "0.0.0.0" |
This file was deleted.
Oops, something went wrong.
40 changes: 0 additions & 40 deletions
40
argilla-server/docker/quickstart/scripts/start_argilla_server.sh
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.