Buckets:

rtrm's picture
|
download
raw
10.4 kB
# သင်၏ Annotation လုပ်ထားသော Dataset ကို အသုံးပြုခြင်း[[use-your-annotated-dataset]]
Argilla မှာရှိတဲ့ annotation လုပ်ထားတဲ့ data တွေကို ဘယ်လို export လုပ်ပြီး အသုံးပြုရမလဲဆိုတာ အခု ကျွန်တော်တို့ လေ့လာပါမယ်။
## Dataset ကို Load လုပ်ခြင်း
ပထမဆုံးအနေနဲ့၊ ယခင်အဆင့်တွေအတိုင်း ကျွန်တော်တို့ Argilla instance နဲ့ ချိတ်ဆက်ထားခြင်း ရှိမရှိ သေချာစေဖို့ လိုအပ်ပါလိမ့်မယ်။
```python
import argilla as rg
HF_TOKEN = "..." # private spaces များအတွက်သာ
client = rg.Argilla(
api_url="...",
api_key="...",
headers={"Authorization": f"Bearer {HF_TOKEN}"}, # private spaces များအတွက်သာ
)
```
ပြီးတော့ အခု၊ ကျွန်တော်တို့ အလုပ်လုပ်မယ့် dataset ကို load လုပ်ပါမယ်။
```python
dataset = client.datasets(name="ag_news")
```
dataset ကို load လုပ်ပြီး ၎င်းရဲ့ records တွေကို `dataset.records` နဲ့ ခေါ်ခြင်းက သင်ရဲ့ dataset နဲ့ records တွေကို သင်ကိုယ်တိုင်ရဲ့ ရည်ရွယ်ချက်တွေနဲ့ pipelines တွေအတွက် စတင်အသုံးပြုဖို့ လုံလောက်ပါပြီ။ ဒါပေမယ့်၊ records တွေကို filter လုပ်တာနဲ့ သင့် dataset ကို Hugging Face Hub ကို export လုပ်တာလိုမျိုး optional operations အချို့ကိုလည်း ဘယ်လိုလုပ်ရမလဲဆိုတာ ကျွန်တော်တို့ လေ့လာပါမယ်။
## Dataset ကို Filter လုပ်ခြင်း
တခါတလေ သင်ဟာ ပြီးဆုံးသွားပြီဖြစ်တဲ့ records တွေကိုပဲ အသုံးပြုချင်ပါလိမ့်မယ်။ ဒါကြောင့် ကျွန်တော်တို့ရဲ့ dataset ထဲက records တွေကို ၎င်းတို့ရဲ့ status အပေါ် အခြေခံပြီး အရင်ဆုံး filter လုပ်ပါမယ်။
```python
status_filter = rg.Query(filter=rg.Filter([("status", "==", "completed")]))
filtered_records = dataset.records(status_filter)
```
>[!TIP]
>⚠️ `completed` status ရှိသော records များ (ဆိုလိုသည်မှာ task distribution settings တွင် သတ်မှတ်ထားသော အနည်းဆုံး submitted responses များနှင့် ကိုက်ညီသော records များ) သည် response တစ်ခုထက် ပိုမိုရှိနိုင်ပြီး response တစ်ခုစီတွင် `submitted``draft` သို့မဟုတ် `discarded` စသည့် မည်သည့် status မဆို ရှိနိုင်ကြောင်း မှတ်သားပါ။
records တွေကို querying နဲ့ filtering လုပ်တာနဲ့ ပတ်သက်ပြီး အသေးစိတ်ကို [Argilla docs](https://docs.argilla.io/latest/how_to_guides/query/) မှာ လေ့လာပါ။
## Hub သို့ Export လုပ်ခြင်း
အခု ကျွန်တော်တို့ရဲ့ annotations တွေကို Hugging Face Hub ကို export လုပ်နိုင်ပြီဖြစ်ပါတယ်။ ဒါမှ တခြားသူတွေနဲ့ မျှဝေနိုင်မှာပါ။ ဒါကိုလုပ်ဖို့၊ records တွေကို 🤗 Dataset အဖြစ် ပြောင်းလဲပြီး Hub ကို push လုပ်ဖို့ လိုအပ်ပါလိမ့်မယ်။
```python
filtered_records.to_datasets().push_to_hub("argilla/ag_news_annotated")
```
တနည်းအားဖြင့်၊ ကျွန်တော်တို့ Argilla dataset အပြည့်အစုံ (pending records များ အပါအဝင်) ကို အောက်ပါအတိုင်း တိုက်ရိုက် export လုပ်နိုင်ပါတယ်။
```python
dataset.to_hub(repo_id="argilla/ag_news_annotated")
```
ဒါက အခြားသူတွေက သူတို့ရဲ့ Argilla instances တွေမှာ dataset ကို ဖွင့်ချင်တယ်ဆိုရင် စိတ်ဝင်စားစရာ ရွေးချယ်မှုတစ်ခုပါ။ ဘာလို့လဲဆိုတော့ settings တွေက အလိုအလျောက် save လုပ်ပြီး သူတို့ဟာ code တစ်လိုင်းတည်းနဲ့ full dataset ကို ရိုးရှင်းစွာ import လုပ်နိုင်လို့ပါ။
```python
dataset = rg.Dataset.from_hub(repo_id="argilla/ag_news_annotated")
```
## ဝေါဟာရ ရှင်းလင်းချက် (Glossary)
* **Annotated Dataset**: လူသားများက အဓိပ္ပာယ် သို့မဟုတ် labels များ ထည့်သွင်းပေးထားသော ဒေတာအစုအဝေး (dataset)။
* **Export**: ဒေတာ သို့မဟုတ် ဖိုင်များကို ပရိုဂရမ်တစ်ခု သို့မဟုတ် စနစ်တစ်ခုမှ အခြားတစ်ခုသို့ လွှဲပြောင်းခြင်း။
* **Argilla Instance**: သင်ကိုယ်တိုင် တည်ဆောက်ပြီး run ထားသော Argilla platform ၏ သီးခြား version။
* **`argilla as rg`**: `argilla` library ကို `rg` အဖြစ် alias (နာမည်တို) ပေးခြင်း။
* **`HF_TOKEN`**: Hugging Face Hub တွင် authentication အတွက် အသုံးပြုသော personal access token။
* **Private Spaces**: Hugging Face Spaces တွင် သတ်မှတ်ထားသူများသာ ဝင်ရောက်ကြည့်ရှုနိုင်သော space များ။
* **`client = rg.Argilla(...)`**: Argilla API client ကို initialize လုပ်ခြင်း။
* **`api_url`**: Argilla instance ၏ API URL လိပ်စာ။
* **`api_key`**: Argilla instance သို့ ဝင်ရောက်ရန် လိုအပ်သော API key။
* **`headers`**: HTTP request headers များတွင် authentication token ကို ထည့်သွင်းခြင်း။
* **`dataset = client.datasets(...)`**: Argilla client မှ dataset တစ်ခုကို load လုပ်ခြင်း။
* **`dataset.records`**: dataset မှ records များကို ရယူခြင်း။
* **Pipelines**: Machine Learning လုပ်ငန်းစဉ်တစ်ခုတွင် အဆင့်အမျိုးမျိုးကို ဆက်တိုက်လုပ်ဆောင်ရန် ဒီဇိုင်းထုတ်ထားသော လုပ်ဆောင်ချက်များ စုစည်းမှု။
* **Optional Operations**: မဖြစ်မနေလုပ်ဆောင်ရန် မလိုအပ်သော်လည်း အသုံးဝင်နိုင်သော လုပ်ဆောင်ချက်များ။
* **Filter Records**: dataset ထဲရှိ သတ်မှတ်ထားသော အခြေအနေများနှင့် ကိုက်ညီသော records များကို ရွေးထုတ်ခြင်း။
* **Status**: record တစ်ခု၏ လက်ရှိအခြေအနေ (ဥပမာ- `completed`, `submitted`, `draft`, `discarded`)။
* **`rg.Query`**: Argilla တွင် records များကို query (ရှာဖွေ) ရန် အသုံးပြုသော class။
* **`rg.Filter`**: Argilla တွင် records များကို filter လုပ်ရန် အသုံးပြုသော class။
* **`"status", "==", "completed"`**: status column ၏ တန်ဖိုးသည် "completed" နှင့် ညီမျှသော records များကို ရှာဖွေရန် filter condition။
* **`submitted` Status**: record တစ်ခုကို annotation လုပ်ပြီး တင်ပြပြီးစီးခြင်း။
* **`draft` Status**: record တစ်ခုကို annotation လုပ်နေဆဲဖြစ်ပြီး မပြီးစီးသေးခြင်း။
* **`discarded` Status**: record တစ်ခုကို annotation မှ ဖယ်ရှားခြင်း သို့မဟုတ် ပယ်ချခြင်း။
* **Argilla Docs**: Argilla library ၏ တရားဝင်မှတ်တမ်းများ (documentation)။
* **🤗 Dataset**: Hugging Face Datasets library မှ dataset object။
* **`push_to_hub()` Method**: Hugging Face Hub သို့ dataset ကို upload လုပ်ရန် method။
* **`to_datasets()` Method**: Argilla records များကို 🤗 Dataset object အဖြစ် ပြောင်းလဲပေးသော method။
* **`to_hub()` Method**: Argilla dataset ကို Hugging Face Hub သို့ တိုက်ရိုက် export လုပ်ရန် method (Argilla ၏ settings များပါ အပါအဝင်)။
* **`repo_id`**: Hugging Face Hub ပေါ်ရှိ repository ၏ identifier။
* **`rg.Dataset.from_hub()` Method**: Hugging Face Hub မှ Argilla dataset တစ်ခုကို (၎င်း၏ settings များပါ အပါအဝင်) load လုပ်ရန် method။

Xet Storage Details

Size:
10.4 kB
·
Xet hash:
2e9fbfc6c4543d84100b28fde3c3f7c1cbb4fbcd60d97438aaea14a318e1fea4

Xet efficiently stores files, intelligently splitting them into unique chunks and accelerating uploads and downloads. More info.