Skip to content
FramesField
SKILL.md Beginner Setup (1 Command) SKILL.md
Verified Dec 1, 2026

FLUX LoRA Training & Wan VACE 14B fal.ai Skill

How to install this SKILL.md

Drop into .claude/skills/, .cursor/skills/, or .agents/skills/ so your coding agent handles dataset ZIP checks, async queue.fal.run polling, .safetensors archiving, and dilated-mask Wan VACE 14B video editing safely.

Executable SKILL.md playbook teaching Claude Code, Cursor, and Codex to run long-running fal.ai GPU pipelines cleanly via queue.fal.run (zero 504 timeouts): train custom FLUX LoRAs ($2.00/1,000 steps) and archive .safetensors locally, run calibrated fal-ai/flux-lora inference ($0.035/MP, CFG 3.5), and execute masked Alibaba Wan VACE 14B video object removal ($0.08/s) with +12px FFmpeg mask dilation.

Compatible agent hosts
Claude Code Cursor Codex
Target tool: fal.ai Queue API / FLUX LoRA / Wan VACE 14B / FFmpeg · License: MIT
  1. STEP 01
    Install pure SKILL.md from /raw/skills/

    Copy the Claude Code, Cursor, or Codex command below—targets /raw/skills/ directly with valid YAML frontmatter.

  2. STEP 02
    Enforce queue.fal.run + pre-flight cost estimate

    Agent prints exact dollars ($2.00 train, $0.035/MP inference, $0.08/s VACE), submits async, and never hits 504 timeouts.

  3. STEP 03
    Archive .safetensors & dilate SAM 2 masks automatically

    Downloads trained LoRA files permanently and applies verified FFmpeg -fps_mode cfr + 12px mask dilation before Wan VACE.

1. Install for your tool

Pick the app you use below for the exact verified command or config—zero manual guessing.

Direct raw file (SKILL.md) ↓
Claude Code bash
Installs pure SKILL.md bytes directly into Claude Code:
mkdir -p .claude/skills/flux-lora-wan-vace-fal
curl -fsSL https://framesfield.com/raw/skills/flux-lora-training-and-wan-vace-fal-skill \
  -o .claude/skills/flux-lora-wan-vace-fal/SKILL.md

2. Inspect or download the full SKILL.md file

This is the exact raw file served at /raw/skills/flux-lora-training-and-wan-vace-fal-skill.

FLUX LoRA Training & Wan VACE 14B fal.ai Skill SKILL.md
---
name: flux-lora-wan-vace-fal
description: Run asynchronous fal.ai custom FLUX LoRA training (fal-ai/flux-lora-fast-training at $2.00 per 1,000 steps), calibrated FLUX LoRA inference (fal-ai/flux-lora at $0.035/MP), and mask-guided Alibaba Wan VACE 14B video editing (fal-ai/wan-vace-14b at $0.08/sec 720p) via queue.fal.run. Use when training brand/character LoRAs, archiving .safetensors for ComfyUI, or executing surgical video object removal with FFmpeg CFR prep and mask dilation.
---

# FLUX LoRA Training & Wan VACE 14B fal.ai Skill

## 1. Mandatory Pre-Flight Guardrails (Always Print Estimate First)
- **NEVER use synchronous `https://fal.run` for LoRA training or Wan VACE 14B**—both take 60–240s and trigger HTTP 504 timeouts while billing continues. Always submit to `https://queue.fal.run/<endpoint>`, log `request_id`, and poll `status_url` every 8–10s.
- **Verified Rates (2026-12-01):**
  - `fal-ai/flux-lora-fast-training`: **`$2.00` per 1,000 steps** (scales linearly with steps).
  - `fal-ai/flux-lora`: **`$0.035` per output megapixel** (or `$0` local ComfyUI after downloading `.safetensors`).
  - `fal-ai/wan-vace-14b`: **`$0.08` per output video second** at 720p (`$0.40` per 5s; or `$0` local Apache-2.0 ComfyUI).
- **FFmpeg Modern Flag Rule:** Use `-fps_mode cfr` (NEVER removed `-vsync cfr` on FFmpeg 7–9).

## 2. FLUX LoRA Training (`queue.fal.run/fal-ai/flux-lora-fast-training`)
1. Verify local dataset folder first: `12–20` sharp (`>=768px`) varied stills for characters/SKUs (`is_style: false`, `create_masks: true`) OR `15–25` diverse subjects for house art styles (`is_style: true`, `create_masks: false`). Reject blurry `<768px` frames.
2. Enforce a rare synthetic `trigger_word` (e.g., `ff_brand_v1`, never an English dictionary word).
3. Queue training asynchronously:
```bash
curl -sS -X POST "https://queue.fal.run/fal-ai/flux-lora-fast-training" \
  -H "Authorization: Key $FAL_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "images_data_url": "'"$ZIP_URL"'",
    "trigger_word": "'"$TRIGGER"'",
    "steps": 1000,
    "is_style": false,
    "create_masks": true
  }'
```
4. Poll `status_url` until `COMPLETED`, fetch `response_url`, and **immediately download `diffusers_lora_file.url`** via `curl -fsSL` into local permanent storage / `ComfyUI/models/loras/` (NEVER `models/checkpoints/`).
5. Run a 4-image calibration strip (`$0.14`) on `fal-ai/flux-lora` locking `seed: 4096` and `guidance_scale: 3.5` across `scale` `[0.65, 0.78, 0.88, 1.00]`. Production sweet spot is almost always `0.78–0.88`.

## 3. Wan VACE 14B Video Object Removal (`queue.fal.run/fal-ai/wan-vace-14b`)
1. Conform raw phone/VFR footage to constant 24fps CFR and save 48 kHz WAV audio first:
```bash
ffmpeg -v warning -y -i raw.mov -r 24 -fps_mode cfr -pix_fmt yuv420p -c:v libx264 -crf 16 -an plate_cfr24.mp4
ffmpeg -v warning -y -i raw.mov -vn -c:a pcm_s16le -ar 48000 original_audio_48k.wav
```
2. Dilate any Meta SAM 2 binary mask video by `+11–12px` radially so cast shadows sit inside the white inpaint area:
```bash
ffmpeg -v warning -y -i sam2_mask.mp4 \
  -vf "format=gray,boxblur=12:1,lut=y='if(gt(val,18),255,0)',boxblur=2:1,format=yuv420p" \
  -r 24 -fps_mode cfr -c:v libx264 -crf 18 -an mask_dilated.mp4
```
3. **Prompt Rule:** NEVER name the deleted object in `prompt`! Describe strictly the revealed clean background; put unwanted items in `negative_prompt`.
4. Submit async to `queue.fal.run/fal-ai/wan-vace-14b` with `match_input_frames_per_second: true` and `match_input_num_frames: true`, download result MP4, and re-mux `original_audio_48k.wav`.

3. Test it right away (sample prompt & result)

Sample prompt / input
Train a custom FLUX LoRA for our ceramic bottle from ./bottle_shots (trigger ff_bottle_v1, 1,000 steps), download the .safetensors file permanently, and run a 4-scale calibration strip at CFG 3.5.
What happens when it runs
Pre-flight estimate: $2.00 training (1,000 steps) + $0.14 calibration (4 × $0.035/MP) = $2.14.
1) Audited ./bottle_shots -> 16 valid >=1024px stills packed into lora_dataset.zip (0 skipped).
2) Queued fal-ai/flux-lora-fast-training via queue.fal.run (is_style=false, create_masks=true) -> COMPLETED in 168s.
3) Archived ff_bottle_v1.safetensors (84 MB) locally -> ready for cloud or ComfyUI/models/loras/.
4) Generated 4-scale strip (0.65 / 0.78 / 0.88 / 1.00, seed 4096, guidance_scale 3.5) -> scale 0.82 cleanest.

What you need & known limits

Requirements

  • FAL_KEY exported in environment, plus curl, jq, Python 3 + Pillow, and FFmpeg 5.1–9.x
  • Claude Code, Cursor, or Codex agent workspace

Watch out for

  • Verify local FLUX base checkpoint commercial rights if loading downloaded .safetensors offline in ComfyUI
  • Wan VACE 14B outputs native 720p—chain Topaz Video Upscale API ($0.08/s) or composite inside a feathered mask over untouched 4K plates

Automate async fal.ai LoRA training & Wan VACE 14B editing safely

This skill teaches your coding agent the exact queue architecture, dataset quality checks, FFmpeg 9.x -fps_mode cfr conform commands, and +12px binary matte dilation required to run FLUX LoRA Fast Trainer ($2.00) and Alibaba Wan VACE 14B ($0.08/s) reliably under one FAL_KEY without hitting 504 gateway timeouts or ghost shadow artifacts.

Explore all fal.ai agent workflows on our fal.ai Skills Directory, or pair with Workflow 51 and Workflow 52.

Frequently Asked Questions

Why does this SKILL.md forbid synchronous fal.run calls?
Both 1,000-step FLUX LoRA training (2–4 min) and multi-second Wan VACE 14B video inpainting (60–180s) outlive standard 60-second HTTP client timeouts. Routing through queue.fal.run guarantees durable request_id tracking and zero orphaned bills.
Where should my coding agent save the downloaded .safetensors file for local ComfyUI?
Always place trained LoRA weights inside ComfyUI/models/loras/ (never models/checkpoints/) and wire them via LoraLoaderModelOnly attached to a FLUX diffusion model.
Use this page in AI tools or notes
raw .md