Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
31 commits
Select commit Hold shift + click to select a range
59f2bea
ssui_components 本地热更新优化;ssui_components 添加css支持
ImSwordTooth May 20, 2025
ef73839
Merge pull request #34 from ImSwordTooth/lh
sunxfancy May 20, 2025
faaee44
update 3d
sunxfancy May 20, 2025
26b4b01
Merge branch 'dev' of https://github.com/sunxfancy/SSUI into dev
sunxfancy May 20, 2025
90821d3
get hf_transfer
sunxfancy May 20, 2025
e755016
修复 ssui_component 中的 React 和外部 React 冲突的 bug;修复 customImport 的 bug
ImSwordTooth May 21, 2025
d9b7f40
添加占位用的css文件
ImSwordTooth May 21, 2025
14f151e
fix a bug in package installing
sunxfancy May 22, 2025
1f99c26
update quicktest
sunxfancy May 22, 2025
0ed2f00
add release
sunxfancy May 22, 2025
dbdcd8d
fix
sunxfancy May 22, 2025
6dd8860
Merge branch 'lh' of github.com:ImSwordTooth/SSUI into lh
ImSwordTooth May 22, 2025
d7df9c5
Merge pull request #35 from ImSwordTooth/lh
sunxfancy May 22, 2025
445a1de
add huggingface download
sunxfancy May 22, 2025
37162e9
新增sd1的lora模型生成图片的功能实现
Sammul40619 May 22, 2025
2c113c2
添加sd1lora图片生成的测试代码
Sammul40619 May 22, 2025
38e55f6
update downloader
sunxfancy May 22, 2025
a34a023
update
sunxfancy May 23, 2025
d151694
update
sunxfancy May 23, 2025
a9a46fc
update settings
sunxfancy May 23, 2025
df6eb37
修改sd1lora这部分代码的type hints问题
Sammul40619 May 23, 2025
39e9214
Implemented a settings page
sunxfancy May 23, 2025
3c5dbd6
add linux & docker
sunxfancy May 23, 2025
afd1241
Merge pull request #36 from Sammul40619/dev
sunxfancy May 23, 2025
1f80785
add diffsynth as deps
sunxfancy May 24, 2025
b7557fe
Merge branches 'dev' and 'dev' of https://github.com/sunxfancy/SSUI i…
sunxfancy May 24, 2025
75a3980
update
sunxfancy May 24, 2025
4d62ea0
diffsynth can not installed in macosx
sunxfancy May 24, 2025
a6f6337
add system dependencies
sunxfancy May 24, 2025
ccbd2c2
update
sunxfancy May 24, 2025
b95b8e6
update
sunxfancy May 24, 2025
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 15 additions & 3 deletions .github/workflows/quicktest.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,11 +15,17 @@ jobs:
runs-on: ${{ matrix.os }}
strategy:
matrix:
os: [windows-latest, macOS-latest]
include:
- os: windows-latest
platform: windows
- os: macOS-latest
platform: macosx
- os: ubuntu-latest
platform: linux

steps:
- uses: actions/checkout@v4

- name: Set Node.js 22.x
uses: actions/setup-node@v4
with:
Expand All @@ -39,7 +45,13 @@ jobs:
activate-environment: true

- name: Install requirements
run: yarn requirements && uv pip install -r .venv/requirements.txt
run: uv pip install -r dependencies/${{ matrix.platform }}.lock

- name: Install system dependencies
if: ${{ matrix.platform == 'linux' }}
run: |
sudo apt-get update
sudo apt-get install -y libwebkit2gtk-4.1-dev libappindicator3-dev librsvg2-dev patchelf libglib2.0-dev pkg-config

- name: Setup Rust
uses: actions-rust-lang/setup-rust-toolchain@v1
Expand Down
4 changes: 3 additions & 1 deletion .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -18,11 +18,13 @@ jobs:
matrix:
include:
- os: windows-latest
platform: windows
artifacts: |
desktop/src-tauri/target/release/bundle/msi/*.msi
desktop/src-tauri/target/release/bundle/nsis/*.exe

- os: macOS-latest
platform: macosx
artifacts: |
desktop/src-tauri/target/release/bundle/dmg/*.dmg

Expand All @@ -48,7 +50,7 @@ jobs:
activate-environment: true

- name: Install requirements
run: yarn requirements && uv pip install -r .venv/requirements.txt
run: uv pip install -r dependencies/${{ matrix.platform }}.lock

- name: Setup Rust
uses: actions-rust-lang/setup-rust-toolchain@v1
Expand Down
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ dist/
test_env/
resources/
log/
models/

*.safetensors
*.pt
Expand Down
103 changes: 103 additions & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,103 @@
# 构建阶段
FROM nvidia/cuda:12.4.1-cudnn-runtime-ubuntu22.04 as builder

# 设置环境变量
ENV DEBIAN_FRONTEND=noninteractive
ENV PYTHONUNBUFFERED=1
ENV PYTHONDONTWRITEBYTECODE=1

# 安装 Python 3.12
RUN apt update && apt install -y software-properties-common \
&& add-apt-repository ppa:deadsnakes/ppa \
&& apt update \
&& apt install -y \
python3.12 \
python3-pip \
python3.12-venv \
curl \
&& rm -rf /var/lib/apt/lists/*

# 安装 Node.js 22
ENV NVM_DIR /usr/local/nvm
RUN mkdir -p $NVM_DIR \
&& curl -o- https://raw.githubusercontent.com/nvm-sh/nvm/v0.40.3/install.sh | bash \
&& . $NVM_DIR/nvm.sh && nvm install 22 && nvm use 22 \
&& corepack enable yarn && node -v && yarn -v

# 设置工作目录
WORKDIR /app

# 创建 .dockerignore 文件
RUN echo "__pycache__\n*.pyc\n*.pyo\n*.pyd\n.Python\nenv\npip-log.txt\npip-delete-this-directory.txt\n.tox\n.coverage\n.coverage.*\n.cache\nnosetests.xml\ncoverage.xml\n*.cover\n*.log\n.pytest_cache\n.env\n.venv\nvenv\nENV\nnode_modules\ndist\nbuild\n*.egg-info\n.installed.cfg\n*.egg" > .dockerignore

# 复制必要的项目文件
COPY ssui/ ssui/
COPY ss_executor/ ss_executor/
COPY server/ server/
COPY frontend/ frontend/
COPY extension_builder/ extension_builder/
COPY extensions/ extensions/
COPY dependencies/ dependencies/
COPY backend/ backend/
COPY package.json package.json
COPY yarn.lock yarn.lock


# 创建并激活 Python 虚拟环境
RUN python3.12 -m venv /app/.venv
ENV PATH="/app/.venv/bin:$PATH"

# 安装 Python 依赖
RUN pip install uv
RUN uv pip install --no-cache-dir -r /app/dependencies/requirements-linux.txt


# 安装 Node.js 依赖
ENV SSUI_CI_SKIP_INSTALL=1
RUN . $NVM_DIR/nvm.sh && yarn

# 构建前端
RUN . $NVM_DIR/nvm.sh && yarn build:frontend

# 运行阶段
FROM nvidia/cuda:12.4.1-cudnn-runtime-ubuntu22.04

# 设置环境变量
ENV DEBIAN_FRONTEND=noninteractive
ENV PYTHONUNBUFFERED=1
ENV PYTHONDONTWRITEBYTECODE=1

# 安装运行时依赖
RUN apt update && apt install -y software-properties-common \
&& add-apt-repository ppa:deadsnakes/ppa \
&& apt update \
&& apt install -y \
python3.12 \
python3-pip \
python3.12-venv \
&& rm -rf /var/lib/apt/lists/*

# 设置工作目录
WORKDIR /app

# 从构建阶段复制虚拟环境
COPY --from=builder /app/.venv /app/.venv
ENV PATH="/app/.venv/bin:$PATH"

# 从构建阶段复制必要的目录
COPY --from=builder /app/ssui /app/ssui
COPY --from=builder /app/ss_executor /app/ss_executor
COPY --from=builder /app/server /app/server
COPY --from=builder /app/frontend/functional_ui/dist /app/frontend/functional_ui/dist
COPY --from=builder /app/extensions /app/extensions
COPY --from=builder /app/dependencies /app/dependencies
COPY --from=builder /app/backend /app/backend

RUN apt update && apt install -y ffmpeg libsm6 libxext6


# 暴露端口
EXPOSE 7422

# 设置启动命令
CMD ["bash", "-c", "python -m ss_executor & exec python -m server --host 0.0.0.0"]
10 changes: 10 additions & 0 deletions backend/patches/layers/lora_layer_base.py
Original file line number Diff line number Diff line change
Expand Up @@ -71,6 +71,16 @@ def get_parameters(self, orig_parameters: dict[str, torch.Tensor], weight: float
params[param_name] = param_weight.reshape(get_param_shape(orig_param))

return params

@classmethod
def warn_on_unhandled_keys(cls, values: dict[str, torch.Tensor], handled_keys: set[str]):
"""Log a warning if values contains unhandled keys."""
unknown_keys = set(values.keys()) - handled_keys
if unknown_keys:
# logger.warning(
# f"Unexpected keys found in LoRA/LyCORIS layer, model might work incorrectly! Unexpected keys: {unknown_keys}"
# )
pass

def calc_size(self) -> int:
return calc_tensors_size([self.bias])
Expand Down
2 changes: 1 addition & 1 deletion backend/stable_diffusion/extensions/lora.py
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ def __init__(

@contextmanager
def patch_unet(self, unet: UNet2DConditionModel, original_weights: OriginalWeightsStorage):
lora_model = self._lora_model
lora_model = self._lora_model.lora.model
assert isinstance(lora_model, ModelPatchRaw)
LayerPatcher.apply_smart_model_patch(
model=unet,
Expand Down
16 changes: 8 additions & 8 deletions dependencies/install.cmd
Original file line number Diff line number Diff line change
@@ -1,16 +1,16 @@
@echo off
@setlocal enabledelayedexpansion

rem 创建.build文件夹并将Python放入其中
rem Create .build folder and put Python in it
if not exist ".venv" mkdir .venv

rem 检查Python是否已经存在
rem Check if Python already exists
if not exist ".venv\python\python.exe" (
rem 检查操作系统类型
rem Check operating system type
set PYTHON_VERSION=3.12.8
set RELEASE_DATE=20241219

rem 检查处理器架构
rem Check processor architecture
if /I "!PROCESSOR_ARCHITECTURE!"=="x86" (
set ARCH=i686-pc-windows-msvc
) else if /I "!PROCESSOR_ARCHITECTURE!"=="AMD64" (
Expand All @@ -20,11 +20,11 @@ if not exist ".venv\python\python.exe" (
exit /b
)

rem 设置下载链接
rem Set download URLs
set DOWNLOAD_URL=https://github.com/astral-sh/python-build-standalone/releases/download/!RELEASE_DATE!/cpython-!PYTHON_VERSION!+!RELEASE_DATE!-!ARCH!-install_only_stripped.tar.gz
set CHINA_MIRROR=https://gitee.com/Swordtooth/ssui_assets/releases/download/v0.0.2/cpython-!PYTHON_VERSION!%!RELEASE_DATE!-!ARCH!-install_only_stripped.tar.gz

rem 尝试从GitHub下载Python
rem Try to download Python from GitHub
echo "Trying to download Python from GitHub..."
curl -L !DOWNLOAD_URL! -o .venv\python.tar.gz
if errorlevel 1 (
Expand All @@ -40,9 +40,9 @@ if not exist ".venv\python\python.exe" (
powershell -Command "Remove-Item -Path '.venv\python.tar.gz' -Force"
)

rem 检查虚拟环境是否已经存在
rem Check if virtual environment already exists
if not exist ".venv\Scripts\python.exe" (
rem 使用virtualenv创建虚拟环境
rem Create virtual environment using venv
echo "Creating virtual environment..."
.venv\python\python.exe -m venv .venv
)
Expand Down
22 changes: 11 additions & 11 deletions dependencies/install.sh
Original file line number Diff line number Diff line change
@@ -1,19 +1,19 @@
#!/bin/bash

# 创建.venv文件夹
# Create .venv folder
mkdir -p .venv

# 检查Python是否已经存在
# Check if Python already exists
if [ ! -f ".venv/python/bin/python3" ]; then
# 设置Python版本和发布日期
# Set Python version and release date
PYTHON_VERSION="3.12.8"
RELEASE_DATE="20241219"

# 检查操作系统类型
# Check operating system type
OS_TYPE=$(uname -s)
ARCHITECTURE=$(uname -m)

# 根据操作系统和架构设置下载参数
# Set download parameters based on OS and architecture
if [ "$OS_TYPE" = "Darwin" ]; then
# macOS
if [ "$ARCHITECTURE" = "x86_64" ]; then
Expand All @@ -40,11 +40,11 @@ if [ ! -f ".venv/python/bin/python3" ]; then
fi
https://github.com/astral-sh/python-build-standalone/releases/download/20241219/cpython-3.12.8+20241219-${ARCH}-install_only_stripped.tar.gz

# 设置下载链接
# Set download URLs
DOWNLOAD_URL="https://github.com/astral-sh/python-build-standalone/releases/download/${RELEASE_DATE}/cpython-${PYTHON_VERSION}+${RELEASE_DATE}-${ARCH}-install_only_stripped.tar.gz"
CHINA_MIRROR="https://gitee.com/Swordtooth/ssui_assets/releases/download/v0.0.2/cpython-${PYTHON_VERSION}%${RELEASE_DATE}-${ARCH}-install_only_stripped.tar.gz"

# 下载并解压Python
# Download and extract Python
echo "Downloading Python from ${DOWNLOAD_URL}..."
if ! curl -L "${DOWNLOAD_URL}" -o .venv/python.tar.gz; then
echo "Failed to download from primary source, trying Chinese mirror..."
Expand All @@ -54,19 +54,19 @@ if [ ! -f ".venv/python/bin/python3" ]; then
fi
fi

# 解压文件
# Extract files
tar -xzf .venv/python.tar.gz -C .venv
rm .venv/python.tar.gz
fi

# 检查虚拟环境是否已经存在
# Check if virtual environment already exists
if [ ! -f ".venv/bin/python" ]; then
# 创建虚拟环境
# Create virtual environment
echo "Creating virtual environment..."
.venv/python/bin/python3 -m venv .venv
fi

# 检查并安装uv工具
# Check and install uv tool
if [ ! -f ".venv/bin/uv" ]; then
echo "Installing uv tool..."
.venv/bin/python -m pip install uv==0.6.11
Expand Down
31 changes: 31 additions & 0 deletions dependencies/install_requirements.cjs
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
const { platform } = require('os');
const { execSync } = require('child_process');
const path = require('path');

function getRequirementsFile() {
const os = platform();
if (os === 'win32') {
return path.join(__dirname, 'windows.lock');
} else if (os === 'darwin') {
return path.join(__dirname, 'macosx.lock');
} else if (os === 'linux') {
return path.join(__dirname, 'linux.lock');
} else {
throw new Error(`Unsupported operating system: ${os}`);
}
}

try {
const requirementsFile = getRequirementsFile();
console.log(`Installing requirements from: ${requirementsFile}`);

// 使用 venv.cjs 来执行 uv pip 命令
execSync(`node ${path.join(__dirname, 'venv.cjs')} uv pip install -r "${requirementsFile}"`, {
stdio: 'inherit'
});

console.log('Requirements installed successfully!');
} catch (error) {
console.error('Error installing requirements:', error.message);
process.exit(1);
}
Loading
Loading