《測試時訓練對抽象推理的驚人效果》

Ai




驚人的測試時訓練對抽象推理的有效性

這個資料庫是我們論文的官方實現:

驚人的測試時訓練對抽象推理的有效性

作者:Ekin Akyürek、Mehul Damani、Linlu Qiu、Han Guo、Yoon Kim、Jacob Andreas

要求
要安裝所需的依賴,您可以從新建一個conda環境開始,然後使用pip安裝以下內容:

“`bash
git clone –recursive git://github.com/ekinakyurek/marc
cd marc/
# 對於TTT管道,我們使用了一個torchtune庫的分支。
# 您需要先安裝它
conda create -n arc python=3.10
conda activate arc
# 使用我的特定分支安裝torchtune
# 我們需要這個作為可編輯的,因為我們實際上使用了一些文件
# 在third_party/torchtune/recipes/下,這些文件不會在
# 只進行pip安裝時出現
cd third_party/torchtune
pip install -e .
# 安裝torchtune所需的其他庫
pip install torch torchao –pre –upgrade –index-url https://download.pytorch.org/whl/nightly/cu121

# 然後我們可以安裝簡單的要求:
pip install -r requirements.txt
“`

📋 您需要從Kaggle鏈接下載ARC數據集:https://www.kaggle.com/competitions/arc-prize-2024/data

📋 您可以從以下鏈接獲取微調模型和TTT檢查點:

– Llama-3.x檢查點:https://huggingface.co/meta-llama
– 我們的微調Llama-3 8B檢查點:https://huggingface.co/ekinakyurek/marc-8B-finetuned-llama3
– 微調BARC檢查點:https://huggingface.co/barc0/Llama-3.1-ARC-Potpourri-Transduction-8B
– 我們的Lora適配器用於Llama-3 8B模型:https://huggingface.co/ekinakyurek/marc-lora-adapters-8B-finetuned-llama3
– 我們的Lora適配器用於BARC模型:https://huggingface.co/ekinakyurek/marc-lora-adapters-Llama-3.1-ARC-Potpourri-Transduction-8B

測試時訓練
要訓練論文中的模型,執行以下命令:

“`bash
# 指定數據路徑
data_file=/kaggle/input/arc-prize-2024/arc-agi_evaluation_challenges.json
# 指定微調路徑
base_checkpoint_dir=/path/to/finetuned/model/folder/
# 指定TTT適配器應保存的位置
ttt_folder=/path/to/ttt/folder
mkdir -p $ttt_folder

# 您需要顯示一個與torchtune配置兼容的初始配置文件
# 這在此庫中提供
lora_config_file=configs/ttt/8B_lora_single_device.yaml
# lora_config_file=configs/ttt/8.1B_lora_single_device.yaml # 對於barc
# 但是您可以重寫一些變量
batch_size=2
epochs=2
learning_rate=5e-5
lora_rank=128
lora_alpha=16.0
lora_to_output=False # 對於目前的Llama3.2模型不適用。
# 您可以指定要訓練多少任務。
num_tasks=15

# 您可以運行主腳本
python test_time_train.py –lora_config=$lora_config_file
–base_checkpoint_dir=$base_checkpoint_dir
–experiment_folder=$ttt_folder
–data_file=$data_file
–batch_size=$batch_size
–epochs=$epochs
–num_tasks=${num_tasks}
–lora_rank=$lora_rank
–lora_alpha=$lora_alpha
–lora_to_output=$lora_to_output
–new_format # 對於barc使用–barc_format
“`

📋 如果您使用BARC檢查點並且在程序參數中設置unmask_outputs為True,那麼您需要在我的torchtune克隆中取消註釋這些行。

📋 TTT訓練將在您指定的ttt_folder中保存適配器檢查點。

推理
要進行TTT的推理,您需要運行predict.py:

“`bash
# 指定數據路徑
data_file=/kaggle/input/arc-prize-2024/arc-agi_evaluation_challenges.json
# 告訴您微調的(稱為基礎)和TTT檢查點的位置
base_checkpoint_dir=/path/to/finetuned/model/folder/
ttt_folder=/path/to/ttt/folder

# 如果提供了解決方案文件,則預測將評估模型
solution_file=/kaggle/input/arc-prize-2024/arc-agi_evaluation_solutions.json

temperature=0
n_sample=1

# 這應該與您的ttt相同
max_lora_rank=128
# 您需要告訴預測和提交應保存的位置
tti_folder=/path/to/tti/folder
mkdir -p $tti_folder

python predict.py
–experiment_folder=$tti_folder
–pretrained_checkpoint=$base_checkpoint_dir
–lora_checkpoints_folder=$ttt_folder
–temperature=$temperature
–n_sample=$n_sample
–data_file=$data_file
–solution_file=$solution_file
–max_lora_rank=$max_lora_rank
–include_n=1
–new_format
“`

📋 對於Llama-3和Llama-3.2模型,我們使用了不同版本的VLLM,這些版本與我們使用的torchtune版本不兼容。因此,我們為Llama3和Llama3-2提供VLLM的設置說明以確保可重現性。我們為推理管道使用單獨的conda環境。

# 對於Llama3和3.1模型
“`bash
conda create -n vllm python=3.10
conda activate vllm
pip install vllm@git+https://github.com/ekinakyurek/vllm.git@ekin/torchtunecompat
pip install -r requirements
“`

# 對於Llama3.2模型
“`bash
conda create -n vllmnew python=3.10
conda activate vllmnew
pip install vllm@git+https://github.com/ekinakyurek/vllm.git@ekin/ekin/newvllm
pip install -r requirements
“`

模型預測
對於我們的微調Llama-3 8B + TTT預測:https://huggingface.co/ekinakyurek/marc-predictions-8B-finetuned-ttted/
對於微調BARC + TTT預測:https://huggingface.co/ekinakyurek/marc-predictions-Llama-3.1-ARC-Potpourri-Transduction-8B-tted/

關於
這是《驚人的測試時訓練對抽象推理的有效性》的公共資料庫。

在這篇文章中,我們可以看到測試時訓練(TTT)對於抽象推理的有效性。這種方法的驚人之處在於,它能夠在模型測試階段進行即時學習,這使得模型可以根據當前的數據動態調整其推理過程。這種靈活性不僅提高了模型的準確性,也為未來的研究提供了新的視角。

從實際應用的角度來看,這一技術可以顯著改善人工智能在解決複雜問題時的表現,尤其是在需要快速適應新情況的場景中。隨著技術的進步,未來我們或許能看到TTT被廣泛應用於更廣泛的領域,如醫療診斷、金融風險評估等,這些領域都需要高效的推理能力和靈活的應對策略。

然而,TTT的實施也不無挑戰,尤其是在數據質量和模型訓練的穩定性方面。未來的研究應著重於如何優化這些過程,以確保TTT能夠在實際應用中發揮其最佳效果。

以上文章由特價GPT API KEY所翻譯及撰寫。而圖片則由FLUX根據內容自動生成。

發佈留言

發佈留言必須填寫的電子郵件地址不會公開。 必填欄位標示為 *

🎨 Nano Banana Pro 圖像生成器|打幾句說話就出圖

想畫人像、產品圖、插畫?SSFuture 圖像生成器支援 Flux Gemini Nano Banana Pro 改圖 / 合成, 打廣東話都得,仲可以沿用上一張圖繼續微調。

🆓 Flux 模型即玩,不用登入
🤖 登入後解鎖 Gemini 改圖
📷 支援上載參考圖再生成
⚡ 每天免費額度任你玩
✨ 即刻玩 AI 畫圖
Create a hyper-realistic 8K close-up body portrait of a female model, using the uploaded photo as the exact facial reference. Maintain 100% accuracy of the facial features — do not alter or modify any aspect of the face. Render the skin texture, lighting, and overall composition with photo-realistic detail, ensuring lifelike color tones and natural depth of field. A man with his original hair is sitting casually on a white cube, smiling warmly at the camera. He is wearing a cream-colored cable-knit sweater, blue jeans, and brown loafers. His legs are crossed, with one hand resting on his knee.
The background reveals a cozy and festive living room. A large, beautifully decorated Christmas tree with numerous warm lights and gold ornaments stands prominently behind him. Several wrapped gift boxes are visible at the base of the tree. To his left, another smaller decorated Christmas tree and a wreath on the wall further enhance the holiday atmosphere. The lighting is soft and inviting, creating a warm and welcoming scene. A cinematic top-down portrait of a young woman standing on a solid deep green floor, captured from an extreme overhead angle. She looks up directly at the camera with wide, expressive eyes, creating an intimate and slightly surreal mood. She wears a soft white bucket hat, a cozy oversized green-and-beige checkered sweater, blue jeans, and white sneakers. Minimalist composition with vast negative space surrounding her, emphasizing isolation and calm. Soft diffused studio lighting, natural skin tones, subtle shadows, clean color grading with earthy greens, editorial fashion photography style, ultra-sharp focus, high resolution, modern aesthetic, cinematic framing, shot on a professional DSLR, shallow depth of field, Instagram poster vibe Prompt:
Use my image in Ultra-realistic, hyper-detailed, 8K cinematic portrait of a young stylish man, using the uploaded image for exact face and hairstyle.
Outfit: An oversized red knit sweater with white hearts, exactly as described in the prompt.
Pose: A hyper-realistic close-up portrait with a messy, cropped framing showing only the boy holding the book. His left hand rests on the wooden table and covers part of his cheek, with a subtle smile on his lips. His other hand holds the book titled "Something I Never Told You" with the word "YOU" written in pink, exactly as
described in the prompt. Background: Not specified.