### Install Text-to-LoRA Dependencies with uv Source: https://github.com/sakanaai/text-to-lora/blob/main/README.md This script clones the Text-to-LoRA repository, navigates into it, updates the `uv` package manager, creates a Python 3.10 virtual environment, synchronizes project dependencies, and installs specific pre-compiled wheels for `flash-attention` and the `fishfarm` library. Users may need to adjust the `flash_attn` wheel for hardware compatibility. ```bash git clone https://github.com/SakanaAI/text-to-lora.git cd text-to-lora uv self update uv venv --python 3.10 --seed uv sync uv pip install https://github.com/Dao-AILab/flash-attention/releases/download/v2.6.3/flash_attn-2.6.3+cu123torch2.3cxx11abiFALSE-cp310-cp310-linux_x86_64.whl uv pip install src/fishfarm ``` -------------------------------- ### Run Text-to-LoRA Web UI Locally Source: https://github.com/sakanaai/text-to-lora/blob/main/README.md This command starts the local web user interface for the Text-to-LoRA demo. The web UI runs the `Mistral-7B-Instruct-v0.2` model locally in conjunction with a T2L model, providing an interactive demonstration environment. ```bash uv run python webui/app.py ``` -------------------------------- ### Start Watcher Process for Asynchronous Evaluation Source: https://github.com/sakanaai/text-to-lora/blob/main/README.md This command initiates a `watcher.py` script designed for asynchronous validation evaluation during training. The script continuously checks for new checkpoints as they are saved, evaluates them, and keeps track of the best performing checkpoint found so far. ```bash uv run watcher.py ``` -------------------------------- ### Train Text-to-LoRA Model via Reconstruction Training Source: https://github.com/sakanaai/text-to-lora/blob/main/README.md This command initiates the training of a hyper-LoRA model using a reconstruction objective. It specifies the base model directory (e.g., Mistral-7B-Instruct-v0.2), an embedding model (e.g., gte-large-en-v1.5), learning rate, epochs, and various hyper-parameters for the LoRA adaptation and training setup. WANDB logging is disabled for this run. ```bash WANDB_MODE=disabled uv run python scripts/train_hyper_recon.py configs/hyper_lora_decontam_lol_tasks.yaml \ --model_dir=mistralai/Mistral-7B-Instruct-v0.2/ \ --emb_model=Alibaba-NLP/gte-large-en-v1.5 \ --warmup_frac=0.1 --lr=1e-3 --epochs=10000 \ --n_train_ds=479 --exp_setup=hyper_lora --encoder_type=linear \ --pred_z_score=True --n_descs_per_ds=128 --n_embs_per_sampled_task=1 \ --n_tasks_per_batch=4 --factorized=False --delta_w_scaling=10000 --shared_AB_head=True ``` -------------------------------- ### Generate LoRA from CLI using Llama-based T2L Source: https://github.com/sakanaai/text-to-lora/blob/main/README.md This script generates a LoRA adapter based on a provided task description using a Llama-based T2L model. The first execution will take longer as the base model needs to be downloaded and cached. The example demonstrates generating a LoRA for mathematical reasoning tasks. ```bash uv run python scripts/generate_lora.py \ trained_t2l/llama_8b_t2l \ "This task challenges your problem-solving abilities through mathematical reasoning. You must carefully read each scenario and systematically work through the data to compute the final outcome." ``` -------------------------------- ### Generate LoRA from CLI using Gemma-based T2L Source: https://github.com/sakanaai/text-to-lora/blob/main/README.md This script generates a LoRA adapter based on a provided task description using a Gemma-based T2L model. This variant might be suitable for systems with smaller GPUs. The example demonstrates generating a LoRA for mathematical reasoning tasks. ```bash uv run python scripts/generate_lora.py \ trained_t2l/gemma_2b_t2l \ "This task challenges your problem-solving abilities through mathematical reasoning. You must carefully read each scenario and systematically work through the data to compute the final outcome." ``` -------------------------------- ### Evaluate Trained Text-to-LoRA Checkpoint Source: https://github.com/sakanaai/text-to-lora/blob/main/README.md This command evaluates a specific trained Text-to-LoRA (T2L) model checkpoint, such as one trained for 'gemma-2-2b-it'. The `--checkpoint_path` argument specifies the model to evaluate. The `--use-icl` flag enables the inclusion of 3-shot in-context examples in the evaluation queries to assess performance with few-shot capabilities. WANDB logging is disabled for this run. ```bash WANDB_MODE=disabled uv run python scripts/eval_hypermod_checkpoint.py --checkpoint_path trained_t2l/gemma_2b_t2l/hypermod.pt --full_eval --use-icl ``` -------------------------------- ### Download Trained T2L Checkpoints from Hugging Face Source: https://github.com/sakanaai/text-to-lora/blob/main/README.md This command sequence logs into the Hugging Face CLI and then downloads pre-trained Text-to-LoRA checkpoints from the 'SakanaAI/text-to-lora' repository to the current local directory. A GPU with more than 16GB of memory is required to run the demos that utilize these checkpoints. ```bash uv run huggingface-cli login uv run huggingface-cli download SakanaAI/text-to-lora --local-dir . --include "trained_t2l/*" ``` -------------------------------- ### Run SFT Training Scripts for T2L Models Source: https://github.com/sakanaai/text-to-lora/blob/main/README.md These commands execute shell scripts to train Text-to-LoRA (T2L) models using Supervised Fine-Tuning (SFT) for different base architectures: Mistral, Llama, and Gemma. Each script is resource-intensive, typically requiring around 5 days to complete on a single H100 GPU. ```bash ./scripts/train_t2l_mistral.sh ./scripts/train_t2l_llama.sh ./scripts/train_t2l_gemma.sh ``` -------------------------------- ### Evaluate Generated LoRA with Llama-3.1-8B-Instruct Source: https://github.com/sakanaai/text-to-lora/blob/main/README.md This command evaluates a previously generated LoRA adapter against the `gsm8k` task using the `meta-llama/Llama-3.1-8B-Instruct` as the base model. It requires the path to the generated LoRA and saves the evaluation results. ```bash uv run python scripts/run_eval.py \ --model-dir meta-llama/Llama-3.1-8B-Instruct \ --lora-dirs {PATH_TO_GENERATED_LORA} \ --save-results --tasks gsm8k ``` -------------------------------- ### Evaluate Generated LoRA with Gemma-2-2b-it Source: https://github.com/sakanaai/text-to-lora/blob/main/README.md This command evaluates a previously generated LoRA adapter against the `gsm8k` task using the `google/gemma-2-2b-it` as the base model. This option might be suitable for systems with smaller GPUs. It requires the path to the generated LoRA and saves the evaluation results. ```bash uv run python scripts/run_eval.py \ --model-dir google/gemma-2-2b-it \ --lora-dirs {PATH_TO_GENERATED_LORA} \ --save-results --tasks gsm8k ``` -------------------------------- ### Train Oracle LoRA Baselines for Reconstruction Training Source: https://github.com/sakanaai/text-to-lora/blob/main/README.md This script trains 'oracle' adapters for all tasks, which serve as baselines for the subsequent reconstruction training of T2L. This process involves training hundreds of LoRAs and can run for many hours due to its extensive nature. ```bash ./scripts/train_lora_baselines.sh ``` -------------------------------- ### Evaluate Pre-trained Base Models Source: https://github.com/sakanaai/text-to-lora/blob/main/README.md This simple bash script executes the evaluation process for the pre-trained base models. It is typically used to establish a baseline performance before evaluating models fine-tuned with Text-to-LoRA. ```bash ./scripts/eval_base_models.sh ``` -------------------------------- ### BibTeX Entry for Text-to-LoRA Publication Source: https://github.com/sakanaai/text-to-lora/blob/main/README.md A standard BibTeX entry for citing the 'Text-to-LoRA: Instant Transformer Adaption' research paper. This entry includes authors, title, booktitle, year, and a URL for academic referencing. ```bibtex @inproceedings{ charakorn2025texttolora, title={Text-to-Lo{RA}: Instant Transformer Adaption}, author={Rujikorn Charakorn and Edoardo Cetin and Yujin Tang and Robert Tjarko Lange}, booktitle={Forty-second International Conference on Machine Learning}, year={2025}, url={https://openreview.net/forum?id=zWskCdu3QA} } ``` === COMPLETE CONTENT === This response contains all available snippets from this library. No additional content exists. Do not make further requests.