-
-
Notifications
You must be signed in to change notification settings - Fork 388
QATestset - push to hub integration #2151
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Changes from all commits
Commits
Show all changes
36 commits
Select commit
Hold shift + click to select a range
8580e8e
first draft
GTimothee 75db905
tmp change for test
GTimothee 9f5e454
tmp change for test
GTimothee 1ebc028
update tags in template, litlle updates in the testset class
GTimothee 1f12a0c
add get_config usage in llmclient
GTimothee f054c3e
fix little inconsistency with get_config
GTimothee bb656bd
add unit tests
GTimothee be6e661
update tests
GTimothee 1d6cc7f
update tests
GTimothee 41acbce
update tests
GTimothee e007e91
test get_config for litellm
GTimothee 1e5a580
fix test get_config for litellm
GTimothee 632b939
fix test get_config for other llm
GTimothee 7b9d58d
fix test get_config for mistralllm
GTimothee 23fe214
add documentation
GTimothee 1c0edea
pdm lock updated
GTimothee 2da300e
add API reference
GTimothee b80d2b4
update method names + add logo to card template
GTimothee 87920d6
merge updated main
GTimothee 7e79f75
fixed test - tests passing
GTimothee b6e5739
update pdm.lock
GTimothee 9893f13
isort - black
GTimothee e4134f8
update pdm.lock
henchaves 0d1638f
small fix for backward compatibility
GTimothee ddf00fb
Merge branch 'main' into qatest_push_to_hub
davidberenstein1957 ce1d60c
Merge branch 'main' into qatest_push_to_hub
davidberenstein1957 4457516
fix workflow for testing pydantic v1
7763077
Update QATestset.md
davidberenstein1957 2f62912
Update build-python.yml
davidberenstein1957 460fd27
Delete pdm.lock
davidberenstein1957 eea7afd
update pdm.lock
henchaves 085abe6
Merge branch 'main' into qatest_push_to_hub
henchaves e7e4aaa
Update testset.py
davidberenstein1957 86ebea5
Update testset.py
davidberenstein1957 dc0596c
Update testset.py
davidberenstein1957 cb74007
Update giskard/rag/testset.py
davidberenstein1957 File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or 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,53 @@ | ||
| # 📤 Push a QATestset to the Hugging Face Hub | ||
|
|
||
| **Learn how to upload and manage your QATestset on the Hugging Face Hub using the `push_to_hf_hub` feature.** | ||
|
|
||
| This tutorial will guide you through the steps to push a dataset to the Hugging Face Hub and load it back for reuse. | ||
|
|
||
| ## Install Required Dependencies | ||
|
|
||
| Before you begin, ensure you have the necessary libraries installed. Run the following command to install the `datasets` and `huggingface_hub` packages: | ||
|
|
||
| ```bash | ||
| pip install datasets huggingface_hub | ||
| ``` | ||
|
|
||
| ## Authenticate with Hugging Face | ||
|
|
||
| To enable access to your account, set your Hugging Face authentication token (`HF_TOKEN`). You can generate your token from your [Hugging Face account settings](https://huggingface.co/settings/tokens). | ||
|
|
||
| ## Push Your Dataset to the Hub | ||
|
|
||
| Use the `push_to_hf_hub` method to upload your dataset to the Hugging Face Hub. Replace `<username>` with your Hugging Face username and `<dataset_name>` with the desired name for your dataset: | ||
|
|
||
| This example demonstrates how to load a `QATestset` from the file `test_set.jsonl` and push it to the Hugging Face Hub: | ||
|
|
||
| ```python | ||
| from giskard.rag.testset import QATestset | ||
| test_set = QATestset.load("test_set.jsonl") | ||
| test_set.push_to_hf_hub("<username>/<dataset_name>") | ||
| ``` | ||
|
|
||
| Once the dataset is successfully pushed, it will be available on your Hugging Face profile. | ||
|
|
||
| ## Load the Dataset from the Hub | ||
|
|
||
| To reuse the dataset, you can load it back using the `load_from_hf_hub` method. This example demonstrates how to load the dataset and convert it to a pandas DataFrame for inspection: | ||
|
|
||
| ```python | ||
| from giskard.rag.testset import QATestset | ||
| dset = QATestset.load_from_hf_hub("<username>/<dataset_name>") | ||
| dset.to_pandas().head() | ||
| ``` | ||
|
|
||
| Replace `<username>` and `<dataset_name>` with the appropriate values. | ||
|
|
||
| ## Benefits of Using the Hugging Face Hub | ||
|
|
||
| By leveraging this integration, you can: | ||
|
|
||
| - Seamlessly share datasets across projects and collaborators. | ||
| - Reuse datasets without the need for manual file transfers. | ||
| - Access datasets directly from the Hugging Face Hub for streamlined workflows. | ||
|
|
||
| Start pushing your datasets today and take advantage of the collaborative power of the Hugging Face Hub! |
This file contains hidden or 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 hidden or 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 hidden or 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 hidden or 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 hidden or 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 hidden or 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 hidden or 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 hidden or 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 hidden or 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,46 @@ | ||
| --- | ||
| tags: | ||
| - giskard | ||
| - synthetic | ||
|
|
||
| task_categories: | ||
| - text-generation | ||
| - text2text-generation | ||
| --- | ||
|
|
||
| # Dataset Card for {repo_id} | ||
| This dataset was created using the [giskard](https://github.com/Giskard-AI/giskard) library, an open-source Python framework designed to evaluate and test AI systems. Giskard helps identify performance, bias, and security issues in AI applications, supporting both LLM-based systems like RAG agents and traditional machine learning models for tabular data. | ||
|
|
||
| This dataset is a QA (Question/Answer) dataset, containing {num_items} pairs. | ||
|
|
||
| ## Usage | ||
|
|
||
| You can load this dataset using the following code: | ||
|
|
||
| ```python | ||
| from giskard.rag.testset import QATestset | ||
| test_set = QATestset.load_from_hub("{repo_id}") | ||
| ``` | ||
|
|
||
| Refer to the following tutorial to use it for evaluating your RAG engine: [RAG evaluation tutorial](https://docs.giskard.ai/en/stable/open_source/testset_generation/rag_evaluation/index.html). | ||
|
|
||
| ## Configuration | ||
|
|
||
| The configuration relative to the dataset generation: | ||
|
|
||
| ```bash | ||
| {config} | ||
| ``` | ||
|
|
||
| --- | ||
|
|
||
| <h2 style="text-align: center;"> | ||
| <span style="display: inline-flex; align-items: center; gap: 8px;"> | ||
| Built with | ||
| <a href="https://giskard.ai" target="_blank" style="display: inline-flex;"> | ||
| <img src="https://cdn.prod.website-files.com/601d6f7d0b9c984f07bf10bc/62983fa8ef716259c397a57d_logo.svg" | ||
| alt="Giskard Logo" | ||
| width="100"> | ||
| </a> | ||
| </span> | ||
| </h2> | ||
This file contains hidden or 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 hidden or 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 hidden or 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.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.