{"id":18764436,"url":"https://github.com/tripplyons/oft","last_synced_at":"2025-04-13T04:33:32.982Z","repository":{"id":196400361,"uuid":"695610280","full_name":"tripplyons/oft","owner":"tripplyons","description":"Diffusers Implementation of Controlling Text-to-Image Diffusion by Orthogonal Finetuning","archived":false,"fork":false,"pushed_at":"2023-09-24T22:42:19.000Z","size":10,"stargazers_count":30,"open_issues_count":4,"forks_count":2,"subscribers_count":4,"default_branch":"main","last_synced_at":"2024-03-15T00:21:38.609Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/tripplyons.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null}},"created_at":"2023-09-23T17:34:03.000Z","updated_at":"2024-02-16T15:22:37.000Z","dependencies_parsed_at":null,"dependency_job_id":"f6a01710-cd8a-436b-9da8-5bf5bcfbf477","html_url":"https://github.com/tripplyons/oft","commit_stats":null,"previous_names":["tripplyons/oft"],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/tripplyons%2Foft","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/tripplyons%2Foft/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/tripplyons%2Foft/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/tripplyons%2Foft/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/tripplyons","download_url":"https://codeload.github.com/tripplyons/oft/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":223567942,"owners_count":17166578,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2024-11-07T18:29:52.352Z","updated_at":"2024-11-07T18:29:52.927Z","avatar_url":"https://github.com/tripplyons.png","language":"Python","readme":"# OFT (Orthogonal Fine-Tuning)\n\nDiffusers Implementation of Controlling Text-to-Image Diffusion by Orthogonal Finetuning ([https://arxiv.org/pdf/2306.07280.pdf](https://arxiv.org/pdf/2306.07280.pdf))\n\n## Setup (tested on Linux with an Nvidia GPU)\n\n1. Install PyTorch\n2. `pip install -r requirements.txt`\n\n## Usage\n\n### Training\n\n1. Create folders `config` and `output` if they don't already exist.\n2. Create a config file at `config/config.json`. See `example.config.json` for an example. Right now it only supports fine-tuning Diffusers models.\n3. Run `python train.py`\n\n### Merging\n\nTo merge the adapter weight with a base model, run `python merge_to_original.py --processor_path /path/to/attn_processors.pt --output_path /path/to/merged_model.ckpt --model_path /path/to/base_model.ckpt`.\n\nRight now this file only supports original Stable Diffusion (non-Diffusers) model as base models.\n\n## Implementation Details\n\n- Parameterized each skew-symmetric matrix as a weight matrix minus its transpose.\n- For constrained orthogonal fine-tuning (COFT), the norm of the weights of each skew-symmetric matrix is given a maximum value.\n- All matrices are kept in the block-diagonal form for as many operations as possible for efficiency.\n","funding_links":[],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ftripplyons%2Foft","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Ftripplyons%2Foft","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ftripplyons%2Foft/lists"}