interpretable embeddings
1.0.0
การสร้างการฝังที่ตีความได้โดยถามคำถาม LLMS รหัสสำหรับกระดาษ QA-EMB
QA-EMBS สร้างการฝังตัวที่ตีความได้โดยการถามคำถามใช่ไม่ใช่คำถามที่ไม่ได้รับการฝึกอบรมมาก่อน LLM 
หากคุณต้องการใช้ QA-EMB ในแอปพลิเคชันของคุณเองวิธีที่ง่ายที่สุดคือผ่านแพ็คเกจ IMODELSX ในการติดตั้งเพียงแค่เรียกใช้ pip install imodelsx
จากนั้นคุณสามารถสร้างการฝังตัวที่ตีความได้ของคุณเองโดยการถามคำถามสำหรับโดเมนของคุณ:
from imodelsx import QAEmb
import pandas as pd
questions = [
'Is the input related to food preparation?' ,
'Does the input mention laughter?' ,
'Is there an expression of surprise?' ,
'Is there a depiction of a routine or habit?' ,
'Does the sentence contain stuttering?' ,
'Does the input contain a first-person pronoun?' ,
]
examples = [
'i sliced some cucumbers and then moved on to what was next' ,
'the kids were giggling about the silly things they did' ,
'and i was like whoa that was unexpected' ,
'walked down the path like i always did' ,
'um no um then it was all clear' ,
'i was walking to school and then i saw a cat' ,
]
checkpoint = 'meta-llama/Meta-Llama-3-8B-Instruct'
embedder = QAEmb (
questions = questions , checkpoint = checkpoint , use_cache = False )
embeddings = embedder ( examples )
df = pd . DataFrame ( embeddings . astype ( int ), columns = [
q . split ()[ - 1 ] for q in questions ])
df . index = examples
df . columns . name = 'Question (abbreviated)'
display ( df . style . background_gradient ( axis = None ))
- - - - - - - - DISPLAYS ANSWER FOR EACH QUESTION IN EMBEDDING - - - - - - - -ทิศทางสำหรับการติดตั้งชุดข้อมูลที่จำเป็นสำหรับการทำซ้ำการทดลอง fMRI ในกระดาษ
python experiments/00_load_dataset.pydata DIR ภายใต้ทุกที่ที่คุณเรียกใช้และจะใช้ Datalad เพื่อดาวน์โหลดข้อมูลที่ประมวลผลล่วงหน้ารวมถึงพื้นที่คุณสมบัติที่จำเป็นสำหรับการปรับรูปแบบการเข้ารหัสแบบความหมายneuro1.config.root_dir เป็นที่ที่คุณต้องการจัดเก็บข้อมูล{root_dir}/ds003020/derivative/pycortex-db/em_data จากที่นี่และย้ายเนื้อหาไปที่ {root_dir}/em_dataneuro1.data.response_utils ฟังก์ชั่น load_response{root_dir}/ds003020/derivative/preprocessed_data/{subject} , hwere พวกเขาถูกเก็บไว้ในไฟล์ h5 สำหรับแต่ละเรื่องเช่น wheretheressmoke.h5neuro1.features.stim_utils ฟังก์ชั่น load_story_wordseqs{root_dir}/ds003020/derivative/TextGrids", where each story has a TextGrid file, eg heretheressmoke.textgrid`{root_dir}/ds003020/derivative/respdict.json เพื่อให้ได้ความยาวของแต่ละเรื่องเส้นทางสำหรับการติดตั้งรหัสที่นี่เป็นแพ็คเกจสำหรับการพัฒนาเต็มรูปแบบ
pip install -e . เพื่อติดตั้งแพ็คเกจ neuro1 ในพื้นที่python 01_fit_encoding.py --subject UTS03 --feature eng1000 @ misc { benara2024crafting ,
title = { Crafting Interpretable Embeddings by Asking LLMs Questions },
author = { Vinamra Benara and Chandan Singh and John X. Morris and Richard Antonello and Ion Stoica and Alexander G. Huth and Jianfeng Gao },
year = { 2024 },
eprint = { 2405.16714 },
archivePrefix = { arXiv },
primaryClass = { cs.CL }
}