Skip to content

Latest commit

Β 

History

History
76 lines (60 loc) Β· 2.16 KB

File metadata and controls

76 lines (60 loc) Β· 2.16 KB

LAD: LoRA-Adapted Diffusion

Efficiently transforming autoregressive to diffusion models using only LoRA

This repository contains a modular implementation of a diffusion-style language model based on LLaMA, fine-tuned using instruction-following datasets performed by training only with LoRA adapters.

Demo

Check out the demo first: https://huggingface.co/spaces/Ruurd/tini-lad

Or the extensive demo at: https://huggingface.co/spaces/Ruurd/lad

πŸ”§ Features

  • LoRA-based lightweight fine-tuning
  • Diffusion-style corruption and denoising of assistant responses
  • Token-level structural noise (masking, swapping, duplication, span shift)
  • Instruction-tuning with various datasets, such as Alpaca, Alpaca-GPT4, and Clean-Instruct datasets

πŸ—‚οΈ Project Structure

diffusion-llama 
β”œβ”€β”€ configs
| └── model_config.py
β”œβ”€β”€ models
| └── custom_transformer.py
β”œβ”€β”€ data
β”‚ β”œβ”€β”€ datasets.py
β”‚ └── noise.py
β”œβ”€β”€ training
β”‚ β”œβ”€β”€ train.py
β”‚ β”œβ”€β”€ collator.py
β”‚ └── callbacks.py
β”œβ”€β”€ notebooks
| └── demo_instruction_tuned.ipynb
| └── demo_unconditional.ipynb
β”œβ”€β”€ utils
| └── tokens.py
β”œβ”€β”€ requirements.txt
└── README.md
└── model_card.md

πŸš€ Quickstart

  1. Install dependencies pip install -r requirements.txt

  2. Run training python training/train.py

  3. Run inference Try the Jupyter Notebooks: notebooks/demo_instruction_tuned.ipynb notebooks/demo_unconditional.ipynb

πŸ“¦ Datasets

This project uses data from:

tatsu-lab/alpaca
vicgalle/alpaca-gpt4
crumb/Clean-Instruct-3M (streamed + filtered) and more...

πŸ§ͺ Sample Output

Question : User: What is the capital of France?
Input : Assistant: MASK MASK MASK MASK MASK MASK
Iteration 1 : Assistant: The MASK of Lyon MASK is.
Iteration 2 : Assistant: MASK capital of France MASK MASK.
Iteration 3 : Assistant: The capital of MASK is Paris.
Final : Assistant: The capital of France is Paris.

πŸ“œ License

MIT License. Feel free to use, modify, and cite.