minsky-01-videogen / ENTERPRISE.md
krishgolcha's picture
Create ENTERPRISE.md
90097a8 verified
|
Raw History Blame Contribute Delete
5.15 kB
# Minsky enterprise customization
This release adds original workflow code, not newly trained foundation weights.
The presets are starting points for HR onboarding, recruiting and marketing B-roll.
Company names and exact copy are kept as editing metadata; generation cannot guarantee readable text or brand accuracy.
## Install and test
Use a separate Python environment. Install a suitable PyTorch build for your GPU first.
The validation environment used Python 3.12.14, torch 2.15.0+cpu, transformers 5.22.2,
peft 0.21.2 and Diffusers commit f598e6e6a99528858b962c1399c45b59a6c25484.
```bash
pip install -r requirements-enterprise.txt
pytest -q test_enterprise.py
python finetune_lora.py --smoke
python enterprise.py plan --company 'Example Enterprise' --use-case recruiting --caption 'Build with us'
```
The smoke test creates a tiny random transformer. It checks a real LoRA optimizer
step, unchanged frozen parameters and adapter state reload. It does not train or
validate the published model and does not save random weights.
## Generate on your GPU
```bash
python enterprise.py generate --company 'Example Enterprise' --use-case onboarding --style 'warm orange accents, natural daylight' --caption 'Welcome to the team' --output outputs/welcome.mp4
```
The runner pins the published checkpoint revision and uses its 10-step PiFlow
settings. It writes an MP4 and a JSON record with the prompt, seed and editing
caption. It refuses to overwrite those files. Review the clip, then add approved
logos, captions and exact policy wording in your video editor. The runner has not
been tested with a full GPU checkpoint load; VRAM requirements are unmeasured.
## Private enterprise training data
Keep customer footage and caches outside this public repository. Example JSONL
schema (these are illustrative paths, not included training clips):
```json
{"id":"office-01","video":"clips/office-01.mp4","caption":"A team collaborates in a bright office","split":"train","rights_confirmed":true}
{"id":"office-02","video":"clips/office-02.mp4","caption":"A colleague enters a reception area","split":"validation","rights_confirmed":true}
```
```bash
python enterprise.py validate-data /private/project/manifest.jsonl
```
This checks fields, file presence, declared rights and exact-byte duplicates.
It does not inspect video decodability, verify rights or detect near-duplicates.
Separate shoots, people and locations between train and validation where possible.
## Experimental video-only LoRA
`finetune_lora.py` implements a minimal flow-matching LoRA optimizer for the
non-distilled `kandinskylab/Kandinsky-6.0-Lite-5s-Diffusers` transformer. It is a
research starting point, not a validated enterprise trainer. The published
distilled model has 160 output video channels for 16 latent channels; ordinary
velocity loss is incompatible. The trainer explicitly rejects that configuration.
Do not load its resulting adapter onto this distilled checkpoint.
The current trainer requires pre-encoded `.safetensors` caches. Raw video decoding
and cache extraction are not implemented here. Prepare them with the matching
base pipeline's VAE and text encoders, using the same frozen revision:
| Tensor key | Shape and meaning |
| --- | --- |
| `latents` | `[B,T,H,W,16]`, clean video VAE latents multiplied by the pipeline VAE scaling factor |
| `prompt_embeds` | `[B,S,3584]`, pipeline Qwen prompt embeddings, matching pipeline padding |
| `pooled_prompt_embeds` | `[B,768]`, matching CLIP pooled embeddings |
Use a batch per file, spatial latent sizes divisible by the transformer patch
size, and train-only clips. The script samples uniform flow times and optimizes
video velocity MSE. Audio is not trained. It uses float32, which is expensive;
GPU memory use and training quality have not been measured.
```bash
python finetune_lora.py --cache /private/project/train_cache --output /private/project/adapter --revision FULL_40_CHARACTER_BASE_COMMIT --steps 100 --rank 4 --lr 0.0001
```
This saves PEFT adapter tensors/config and a loss log. It does not automatically
upload anything, merge weights, resume training or evaluate quality. Load with
`transformer.add_adapter(LoraConfig.from_pretrained(adapter_dir))`, then
`set_peft_model_state_dict(transformer, load_file(adapter_dir + '/adapter_model.safetensors'))`
on the same non-distilled base revision. Use that base's normal 50-step,
guidance-5 pipeline for evaluation, not the distilled generation runner above.
Before an enterprise release, evaluate held-out prompts and clips for visual
quality, brand consistency, factual text, audio and runtime. A decreasing training
loss is not evidence of better videos. No customer dataset, GPU generation,
enterprise fine-tuning or quality evaluation was performed for this release.
## Licensing and provenance
Original helper code in enterprise.py, finetune_lora.py and test_enterprise.py is
Copyright 2026 Minsky Machines, released under MIT (LICENSE-MINSKY).
The Kandinsky weights remain credited to their original authors. Dependency and
component licenses continue to apply independently; these helpers do not relicense them.