用 Codex 或 Claude 帮你安装 复制这段 Prompt,粘贴到 Codex、Claude 或其他助手里,让它检查 Skill 页面并帮你完成安装。
直接命令不会经过审查 Prompt;运行前请先检查来源。
npx skills add https://github.com/fabioc-aloha/Alex_Plug_In --skill flux-brand-finetune命令会保持在同一行。复制前请横向滚动并检查完整内容。
想先保存到本地?可下载 SkillsMP 当前能够提供的文件。
Create and maintain ASCII visual dashboards for project tracking with parallel lane progress bars
Store and manage voice samples for TTS cloning — portable, version-controlled audio references
Clear documentation through visual excellence
正在显示 SKILL.md
基于 SOC 职业分类
| name | flux-brand-finetune |
| description | Train and manage custom FLUX LoRA fine-tunes on Replicate for consistent brand character imagery |
| tier | extended |
| applyTo | **/*lora*,**/*finetune*,**/*fine-tune*,**/*flux* |
| metadata | {"inheritance":"inheritable"} |
Train custom LoRA models on FLUX Dev for consistent Alex (or any character) imagery across all generated content.
Pattern: Train once with 10–20 curated images → get a trigger-word-activated LoRA → generate unlimited consistent images at ~$0.003–0.04/image.
| Approach | Consistency | Cost/Image | Setup Cost | Best For |
|---|---|---|---|---|
| Nano-Banana Pro (reference images) | Good | $0.025 | Free | Quick one-off sets |
| Flux 2 Pro (input_images) | Good | ~$0.05 | Free | Multi-ref scenes |
| FLUX LoRA Fine-Tune | Excellent | $0.003–0.04 | ~$1.50 | Brand-scale consistency |
Fine-tuning wins when you need hundreds of images across marketing, docs, presentations, and social media — all with the same character looking exactly the same without passing reference images every time.
| Trainer | Replicate ID | Hardware | Cost | Training Time | Notes |
|---|---|---|---|---|---|
| Fast FLUX Trainer (recommended) | replicate/fast-flux-trainer | 8× H100 | ~2 min | Newer, faster, subject/style selector | |
| FLUX Dev LoRA Trainer | ostris/flux-dev-lora-trainer | H100 | ~10 min | Original trainer, more parameters |
Recommendation: Use replicate/fast-flux-trainer for most use cases — faster, cheaper, simpler.
| Spec | Recommendation |
|---|---|
| Quantity | 10–20 images (minimum 10, sweet spot 15–20) |
| Resolution | 1024×1024 or higher (will be scaled down) |
| Formats | WebP, JPG, PNG |
| Variety | Different angles, lighting, expressions, settings, clothing |
| Consistency | Same character/subject across all images — same age, same identity |
Place a .txt file alongside each image with the same name:
alex-front.jpg → alex-front.txt
alex-profile.jpg → alex-profile.txt
alex-outdoor.jpg → alex-outdoor.txt
If captions aren't provided, the trainer auto-generates them using LLaVA.
The trigger word activates your LoRA concept in prompts.
Rules:
TOK (clashes with other fine-tunes)Examples:
ALEXFNCH — Alex Finch characterCXRBRAND — CorreaX brand styleALEXCOG — Alex cognitive architecture style# Create a training data folder
New-Item -ItemType Directory -Path "training-data" -Force
# Optionally resize images to 1024px (if oversized)
# Requires ImageMagick:
# macOS: brew install imagemagick
# Windows: winget install ImageMagick.ImageMagick
Get-ChildItem training-data/*.jpg, training-data/*.png | ForEach-Object {
magick $_.FullName -resize "1024x1024>" $_.FullName
}
# Zip the training data
Compress-Archive -Path "training-data/*" -DestinationPath "training-data.zip" -Force
Upload the zip to a publicly accessible URL, or use the Replicate web UI to upload directly.
import { readFileSync } from "fs";
// Option A: Use Replicate's file upload
const replicate = new Replicate({ auth: process.env.REPLICATE_API_TOKEN });
// Upload via the web UI at https://replicate.com/replicate/fast-flux-trainer/train
// Option B: Use any file hosting (S3, Azure Blob, etc.)
// The URL must be publicly accessible during training
import Replicate from "replicate";
const replicate = new Replicate({ auth: process.env.REPLICATE_API_TOKEN });
const training = await replicate.trainings.create(
"replicate", // model owner
"fast-flux-trainer", // model name
"8b10794665aed907bb98a1a5324cd1d3a8bea0e9b31e65210967fb9c9e2e08ed", // version
{
destination: "your-username/alex-brand", // your model destination
input: {
input_images: "https://your-storage.com/training-data.zip",
trigger_word: "ALEXFNCH",
lora_type: "subject", // "subject" or "style"
// training_steps: 1000, // default 1000, range 500–4000
}
}
);
console.log("Training started:", training.id);
console.log("Status URL:", training.urls.get);
curl -X POST \
-H "Authorization: Bearer $REPLICATE_API_TOKEN" \
-H "Content-Type: application/json" \
-d '{
"destination": "your-username/alex-brand",
"input": {
"input_images": "https://your-storage.com/training-data.zip",
"trigger_word": "ALEXFNCH",
"lora_type": "subject"
}
}' \
https://api.replicate.com/v1/models/replicate/fast-flux-trainer/versions/8b10794665aed907bb98a1a5324cd1d3a8bea0e9b31e65210967fb9c9e2e08ed/trainings
// Poll for status
const status = await replicate.trainings.get(training.id);
console.log("Status:", status.status); // starting → processing → succeeded/failed
# Or via curl
curl -s \
-H "Authorization: Bearer $REPLICATE_API_TOKEN" \
https://api.replicate.com/v1/trainings/<training_id>
Training typically completes in ~2 minutes with the fast trainer.
Once training succeeds, your model is live at the destination:
const output = await replicate.run(
"your-username/alex-brand", // your trained model
{
input: {
prompt: "ALEXFNCH standing in a modern office, wearing a casual blue shirt, " +
"confident smile, natural lighting, professional photography, 8k detail",
aspect_ratio: "3:4",
output_format: "png",
}
}
);
// Save immediately — output URLs expire after 1 hour
import { writeFile } from "node:fs/promises";
await writeFile("alex-office.png", output);
| Parameter | Default | Range | Notes |
|---|---|---|---|
steps | 1000 | 3–6000 | 500–4000 recommended |
lora_rank | 16 | 1–128 | Higher = more complex features, slower training |
autocaption | true | — | Uses LLaVA v1.5 13B for auto-captioning |
autocaption_prefix | — | — | e.g., "a photo of ALEXFNCH, " |
autocaption_suffix | — | — | e.g., " in the style of ALEXFNCH" |
hf_repo_id | — | — | Optional: also push to HuggingFace |
| Parameter | Default | Notes |
|---|---|---|
trigger_word | "TOK" | Your unique trigger word |
lora_type | — | "subject" or "style" |
training_steps | 1000 | Adjust for dataset size |
input_images | — | Zip file URL or direct upload |
Your trained LoRA weights can be used with any Flux model that supports LoRA:
// Use with Flux Dev (good quality, $0.025/image)
const output = await replicate.run("black-forest-labs/flux-dev", {
input: {
prompt: "ALEXFNCH in a coffee shop, reading a book",
extra_lora: "your-username/alex-brand",
extra_lora_scale: 1.0, // 0.0–1.5, default 1.0
}
});
// Use with Flux Schnell (fast iteration, $0.003/image)
const output = await replicate.run("black-forest-labs/flux-schnell", {
input: {
prompt: "ALEXFNCH giving a presentation",
extra_lora: "your-username/alex-brand",
}
});
| Scale | Effect |
|---|---|
| 0.5 | Subtle influence — blends with base model |
| 0.8 | Moderate — recognizable but flexible |
| 1.0 | Full — strong character likeness (default) |
| 1.2–1.5 | Over-fitted — may reduce prompt adherence |
| Operation | Cost | Notes |
|---|---|---|
| Training (fast-flux-trainer) | ~$1.50 | One-time, ~2 minutes |
| Training (ostris) | ~$0.98 | One-time, ~10 minutes |
| Generation (Flux Schnell + LoRA) | $0.003/image | Best for iteration |
| Generation (Flux Dev + LoRA) | $0.025/image | Best for quality |
| Generation (Flux 1.1 Pro) | $0.04/image | Highest quality |
Break-even vs Nano-Banana Pro: After ~70 images ($0.025 × 70 = $1.75 > $1.50 training), the fine-tune pays for itself and every subsequent image costs only $0.003–0.025 without needing reference photos.
TRIGGER_WORD [description of scene], [clothing], [expression], [lighting], [style]
ALEXFNCH standing in a park not A person standing in a park named ALEXFNCHALEXFNCH headshot, professional business attire, confident smile, studio lighting, corporate portrait photography
ALEXFNCH sitting at a desk with multiple monitors, coding, casual hoodie, night time, ambient screen glow, documentary photography
ALEXFNCH presenting at a tech conference, standing on stage, gesturing toward a screen, audience in background, event photography
ALEXFNCH in a cozy library, reading a leather-bound book, warm lamplight, bokeh background, editorial photography
After generating with your LoRA, use view_image to evaluate output quality:
When iterating on LoRA scale or prompt structure, compare outputs side-by-side via the image carousel.
If you have a visual-memory.json with reference photos, extract the base64 images back to files for training:
import { readFileSync, writeFileSync } from "fs";
import { join } from "path";
const vmPath = ".github/skills/<skill>/visual-memory/visual-memory.json";
const vm = JSON.parse(readFileSync(vmPath, "utf8"));
// Extract images from visual memory for training
Object.entries(vm.subjects).forEach(([name, subject]) => {
subject.images.forEach((img, i) => {
const base64 = img.dataUri.split(",")[1];
const buffer = Buffer.from(base64, "base64");
writeFileSync(join("training-data", `${name}-${i}.jpg`), buffer);
});
});
REPLICATE_API_TOKEN in VS Code SecretStorage, not in code| Issue | Cause | Fix |
|---|---|---|
| Character doesn't look consistent | Too few training images | Use 15–20 images with varied angles |
| LoRA overfitting (ignores prompts) | Steps too high | Reduce to 500–1000 steps |
| Trigger word doesn't activate | Word too common | Choose a unique non-word like ALEXFNCH |
| Training fails | Images too small | Use 1024×1024+ resolution |
| Output looks nothing like training | Caption mismatch | Add manual captions with trigger word |
extra_lora not working | Wrong model format | Use Replicate model ID: username/model-name |