เล่นกับวิธีการ SetFit สำหรับการถ่ายโอนไม่กี่นัดสำหรับการจำแนกข้อความ
แก้ไข: ฉันได้ทำการทดลองด้วยการเรียนรู้ที่ใช้งานอยู่ตอนนี้ฉันก็มีการใช้งานเช่นกัน ฉันจะจัดระเบียบให้ดีขึ้นวันที่มีแดด
$ ~/Dev/projects/setfit$ python main.py --help
Usage: main.py [OPTIONS]
Options:
-d, --dataset-name TEXT The name of the dataset as it appears on the
HuggingFace hub e.g. SetFit/SentEval-CR |
SetFit/bbc-news | SetFit/enron_spam ...
-c, --case INTEGER 0, 1, 2, or 3: which experiment are we
running. See readme or docstrings to know
more but briefly: **0**: SentTF ->
Constrastive Pretrain -> +LogReg on task.
**1**: SentTF -> +Dense on task. **2**:
SentTF -> +LogReg on task. **3**:
FewShotPrompting based Clf over Flan-t5-xl
[required]
-r, --repeat INTEGER The number of times we should run the entire
experiment (changing the seed).
-bs, --batch-size INTEGER ... you know what it is.
-ns, --num-sents INTEGER Size of our train set. Set short values
(under 100)
-e, --num-epochs INTEGER Epochs for fitting Clf+SentTF on the main
(classification) task.
-eft, --num-epochs-finetune INTEGER
Epochs for both contrastive pretraining of
SentTF.
-ni, --num-iters INTEGER Number of text pairs to generate for
contrastive learning. Values above 20 can
get expensive to train.
-tot, --test-on-test If true, we report metrics on testset. If
not, on a 20% split of train set. Off by
default.
-ft, --full-test We truncate the testset of every dataset to
have 100 instances. If you know what you're
doing, you can test on the full dataset.NOTE
that if you're running this in case 3 you
should probably be a premium member and not
be paying per use.
--help Show this message and exit.
หมายเหตุ : หากคุณต้องการสอบถาม LLMS ที่โฮสต์ที่ HuggingFace (กรณีที่ 3) คุณต้องสร้างบัญชีของคุณบน HuggingFace Hub และสร้างโทเค็นการเข้าถึงหลังจากนั้นคุณควรวางไว้ในไฟล์
./hf_token.keyPS: ไม่ต้องกังวลฉันได้เพิ่มไฟล์นี้เป็น. gitignore
$ python active.py --help
Usage: active.py [OPTIONS]
Options:
-d, --dataset-name TEXT The name of the dataset as it appears on the
HuggingFace hub e.g. SetFit/SentEval-CR |
SetFit/bbc-news | SetFit/enron_spam | imdb ...
-ns, --num-sents INTEGER Size of our train set. I.e., the dataset at the
END of AL. Not the start of it.
-nq, --num-queries INTEGER Number of times we query the unlabeled set and
pick some labeled examples. Set short values
(under 10)
-ft, --full-test We truncate the testset of every dataset to have
100 instances. If you know what you're doing,
you can test on the full dataset.NOTE that if
you're running this in case 3 you should
probably be a premium member and not be paying
per use.
--help Show this message and exit.
หรือคุณสามารถรัน ./run.sh หลังจากติดตั้งไลบรารีที่ต้องการ (ดู requirements.txt )
หลังจากนั้นคุณสามารถเรียกใช้ Notebook summarise.ipynb เพื่อสรุปและแสดงภาพ (ถ้าฉันได้รับการเพิ่มรหัสนี้) ผลลัพธ์
PS: ให้ความสนใจกับ
--full-testโดยค่าเริ่มต้นเราตัดทอนการทดสอบทุกชุดเป็น 100 อินสแตนซ์แรก
พวกเขาเป็นชุดข้อมูลการจำแนกประเภททั้งหมดที่ได้รับการทำความสะอาดโดยคนที่ดีและใจดีที่สร้าง lib setfit แต่คุณสามารถใช้ชุดข้อมูล HF ใด ๆ ที่มีให้มันมีสามฟิลด์นี้: (i) ข้อความ (str), (ii) ฉลาก (int) และ (iii) label_text (str)
นี่คือผลลัพธ์ของฉัน:
ตารางนี้แสดงผลลัพธ์ของการตั้งค่าการเรียนรู้ที่ใช้งานอยู่นี้ เว้นแต่จะระบุไว้เป็นอย่างอื่นเราทำซ้ำการทดลองแต่ละครั้ง 5 ครั้ง ตัวเลขเหล่านี้รายงานความถูกต้องของงานเมื่อเรามีเพียง 100 อินสแตนซ์ในชุดรถไฟ
| BBC-News | SST2 | senteval-cr | IMDB | enron_spam | |
|---|---|---|---|---|---|
| setFit ft | 0.978 ± 0.004 | 0.860 ± 0.018 | 0.882 ± 0.029 | 0.924 ± 0.026 | 0.960 ± 0.017 |
| ไม่มี setFit ft contrastive | 0.932 ± 0.015 | 0.854 ± 0.019 | 0.886 ± 0.005 | 0.902 ± 0.019 | 0.942 ± 0.020 |
| Ft ปกติ | 0.466 ± 0.133 | 0.628 ± 0.098 | 0.582 ± 0.054 | 0.836 ± 0.166 | 0.776 ± 0.089 |
| การแจ้งเตือน LLM | 0.950 ± 0.000 | 0.930 ± 0.000 | 0.900 ± 0.000 | 0.930 ± 0.000 | 0.820 ± 0.000 |
| constrastive al | 0.980 ± 0.000 | 0.910 ± 0.000 | 0.910 ± 0.000 | 0.870 ± 0.000 | 0.980 ± 0.000 |
[1]: การแจ้งเตือน LLM ทำได้เฉพาะกับ 10 อินสแตนซ์ (พรอมต์จริงอาจมีน้อยกว่าขึ้นอยู่กับความยาว) มันไม่ได้ทำซ้ำสำหรับเมล็ดที่แตกต่างกัน
[2]: ความคมชัดอัลไม่ได้ทำซ้ำสำหรับเมล็ดที่แตกต่างกัน