mirror of
https://github.com/leejet/stable-diffusion.cpp.git
synced 2026-07-23 11:20:53 -05:00
chore: move utility scripts under scripts (#1746)
This commit is contained in:
@@ -27,7 +27,7 @@ PRs should include:
|
|||||||
|
|
||||||
Format code according to the repository style before submitting changes.
|
Format code according to the repository style before submitting changes.
|
||||||
|
|
||||||
Formatting follows `.clang-format` (Chromium base, 4-space indent, no tabs). Run `format-code.sh` before opening a PR. Keep C++ standard at C++17-compatible patterns used in this repo.
|
Formatting follows `.clang-format` (Chromium base, 4-space indent, no tabs). Run `scripts/format-code.sh` or `scripts/format-code.ps1` before opening a PR. Keep C++ standard at C++17-compatible patterns used in this repo.
|
||||||
|
|
||||||
Naming conventions:
|
Naming conventions:
|
||||||
|
|
||||||
|
|||||||
@@ -52,7 +52,7 @@ to a `.pulidembd` binary file (about 131 KB). Run it once per source
|
|||||||
person; the same file is reused for any number of generations.
|
person; the same file is reused for any number of generations.
|
||||||
|
|
||||||
A reference Python script is provided alongside this docs file at
|
A reference Python script is provided alongside this docs file at
|
||||||
[`script/pulid_extract_id.py`](../script/pulid_extract_id.py). It
|
[`scripts/pulid_extract_id.py`](../scripts/pulid_extract_id.py). It
|
||||||
requires:
|
requires:
|
||||||
- A working CUDA / CPU PyTorch stack
|
- A working CUDA / CPU PyTorch stack
|
||||||
- `insightface`, `facexlib`, `eva-clip`, `torchvision`, `opencv-python`,
|
- `insightface`, `facexlib`, `eva-clip`, `torchvision`, `opencv-python`,
|
||||||
|
|||||||
@@ -13,8 +13,8 @@ The SeFi-Image family ships in three scales (1B / 2B / 5B) and three families (B
|
|||||||
Convert the transformer and text encoder to sd.cpp safetensors:
|
Convert the transformer and text encoder to sd.cpp safetensors:
|
||||||
|
|
||||||
```bash
|
```bash
|
||||||
python3 script/convert_sefi.py <hf_repo_dir> <out_dir>/sefi_<scale>_<family>.safetensors
|
python3 scripts/convert_sefi.py <hf_repo_dir> <out_dir>/sefi_<scale>_<family>.safetensors
|
||||||
python3 script/convert_qwen3_vl.py <hf_repo_dir>/Qwen3-VL-XB-Instruct <out_dir>/qwen3_vl_<X>b.safetensors
|
python3 scripts/convert_qwen3_vl.py <hf_repo_dir>/Qwen3-VL-XB-Instruct <out_dir>/qwen3_vl_<X>b.safetensors
|
||||||
```
|
```
|
||||||
|
|
||||||
## Variant defaults
|
## Variant defaults
|
||||||
|
|||||||
@@ -9,7 +9,7 @@ the text side; the vision side is converted by sd.cpp's own
|
|||||||
Operates on raw safetensors bytes so any dtype (BF16/F16/F32) is preserved.
|
Operates on raw safetensors bytes so any dtype (BF16/F16/F32) is preserved.
|
||||||
|
|
||||||
Usage:
|
Usage:
|
||||||
python3 script/convert_qwen3_vl.py <hf_qwen3_vl_dir_or_safetensors> <output.safetensors>
|
python3 scripts/convert_qwen3_vl.py <hf_qwen3_vl_dir_or_safetensors> <output.safetensors>
|
||||||
"""
|
"""
|
||||||
|
|
||||||
import argparse
|
import argparse
|
||||||
@@ -5,7 +5,7 @@ Operates on raw safetensors bytes so any dtype (BF16, F32, ...) is preserved exa
|
|||||||
No numpy or torch dependency required.
|
No numpy or torch dependency required.
|
||||||
|
|
||||||
Usage:
|
Usage:
|
||||||
python3 script/convert_sefi.py <sefi_diffusers_dir> <output.safetensors>
|
python3 scripts/convert_sefi.py <sefi_diffusers_dir> <output.safetensors>
|
||||||
"""
|
"""
|
||||||
|
|
||||||
import argparse
|
import argparse
|
||||||
@@ -31,24 +31,30 @@ $patterns = @(
|
|||||||
"examples/common/*.cpp"
|
"examples/common/*.cpp"
|
||||||
)
|
)
|
||||||
|
|
||||||
$root = (Get-Location).Path
|
Push-Location (Join-Path $PSScriptRoot "..")
|
||||||
|
|
||||||
foreach ($pattern in $patterns) {
|
try {
|
||||||
$files = Get-ChildItem -Path $pattern -File -ErrorAction SilentlyContinue | Sort-Object FullName
|
$root = (Get-Location).Path
|
||||||
|
|
||||||
foreach ($file in $files) {
|
foreach ($pattern in $patterns) {
|
||||||
$relativePath = $file.FullName.Substring($root.Length).TrimStart('\', '/') -replace '\\', '/'
|
$files = Get-ChildItem -Path $pattern -File -ErrorAction SilentlyContinue | Sort-Object FullName
|
||||||
|
|
||||||
if ($relativePath -like "vocab*") {
|
foreach ($file in $files) {
|
||||||
continue
|
$relativePath = $file.FullName.Substring($root.Length).TrimStart('\', '/') -replace '\\', '/'
|
||||||
|
|
||||||
|
if ($relativePath -like "vocab*") {
|
||||||
|
continue
|
||||||
|
}
|
||||||
|
|
||||||
|
Write-Host "formatting '$relativePath'"
|
||||||
|
|
||||||
|
# if ($relativePath -ne "stable-diffusion.h") {
|
||||||
|
# clang-tidy -fix -p build_linux/ "$relativePath"
|
||||||
|
# }
|
||||||
|
|
||||||
|
& clang-format -style=file -i $relativePath
|
||||||
}
|
}
|
||||||
|
|
||||||
Write-Host "formatting '$relativePath'"
|
|
||||||
|
|
||||||
# if ($relativePath -ne "stable-diffusion.h") {
|
|
||||||
# clang-tidy -fix -p build_linux/ "$relativePath"
|
|
||||||
# }
|
|
||||||
|
|
||||||
& clang-format -style=file -i $relativePath
|
|
||||||
}
|
}
|
||||||
|
} finally {
|
||||||
|
Pop-Location
|
||||||
}
|
}
|
||||||
@@ -1,3 +1,10 @@
|
|||||||
|
#!/usr/bin/env bash
|
||||||
|
|
||||||
|
set -e
|
||||||
|
|
||||||
|
repo_root="$(cd "$(dirname "$0")/.." && pwd)"
|
||||||
|
cd "$repo_root"
|
||||||
|
|
||||||
for f in src/*.cpp src/*.h src/*.hpp \
|
for f in src/*.cpp src/*.h src/*.hpp \
|
||||||
src/conditioning/*.cpp src/conditioning/*.h src/conditioning/*.hpp \
|
src/conditioning/*.cpp src/conditioning/*.h src/conditioning/*.hpp \
|
||||||
src/core/*.cpp src/core/*.h src/core/*.hpp \
|
src/core/*.cpp src/core/*.h src/core/*.hpp \
|
||||||
@@ -13,7 +13,7 @@ packaging quirks):
|
|||||||
- numpy, Pillow
|
- numpy, Pillow
|
||||||
|
|
||||||
Usage:
|
Usage:
|
||||||
python script/pulid_extract_id.py \\
|
python scripts/pulid_extract_id.py \\
|
||||||
--portrait /path/to/source-photo.jpg \\
|
--portrait /path/to/source-photo.jpg \\
|
||||||
--pulid-weights /path/to/pulid_flux_v0.9.1.safetensors \\
|
--pulid-weights /path/to/pulid_flux_v0.9.1.safetensors \\
|
||||||
--out /path/to/source.pulidembd
|
--out /path/to/source.pulidembd
|
||||||
Reference in New Issue
Block a user