Skip to content

Instantly share code, notes, and snippets.

View chuanqi129's full-sized avatar

Wang, Chuanqi chuanqi129

View GitHub Profile
@chuanqi129
chuanqi129 / sd_main.py
Last active July 7, 2025 07:10
Run stable diffusion model on PyTorch XPU
import contextlib
import os
import time
import sys
import torch
from diffusers import DPMSolverMultistepScheduler, StableDiffusionPipeline, StableDiffusionImg2ImgPipeline, StableDiffusionXLPipeline, StableDiffusion3Pipeline
import argparse
import numpy as np
from PIL import Image
import pytorch_fid
@chuanqi129
chuanqi129 / docker-pruner.sh
Last active May 29, 2025 03:11 — forked from fayak/docker-pruner.sh
Docker pruner. Deletes docker's overlay2 leftovers that survive 'docker system prune -af --volumes'
#!/usr/bin/env bash
set -eEuo pipefail
MARKER_FILE_NAME="${DOCKER_PRUNER_MARKER:-DOCKER-PRUNER-MARKER-FILE}"
DOCKER_PATH="${DOCKER_PATH:-/var/lib/docker/overlay2}"
function _used_dirs() {
for docker_obj in $(docker ps -aq) $(docker image ls -aq); do
lowerdir="$(docker inspect "$docker_obj" | jq '.[].GraphDriver.Data.LowerDir' -r)"
diff --git a/detect.py b/detect.py
index 8feb07d..d65f3f3 100644
--- a/detect.py
+++ b/detect.py
@@ -74,6 +74,13 @@ def run(
hide_conf=False, # hide confidences
half=False, # use FP16 half-precision inference
dnn=False, # use OpenCV DNN for ONNX inference
+ precision="bfloat16",
+ channels_last=1,
@chuanqi129
chuanqi129 / Dockerfile.dynamo
Last active November 17, 2022 02:07
Dockerfile for original torchdynamo baseline benchmark
# syntax=docker/dockerfile:1
ARG BASE_IMAGE=ubuntu:20.04
FROM ${BASE_IMAGE} AS dev-base
RUN apt-get update && \
DEBIAN_FRONTEND=noninteractive apt-get install --no-install-recommends -y \
build-essential \
ca-certificates \
ccache \
cmake \
curl \
@chuanqi129
chuanqi129 / Dockerfile.ipex
Created November 14, 2022 04:03
Torch Dynamo test with IPEX Dockerfile
# syntax=docker/dockerfile:1
ARG BASE_IMAGE=ubuntu:20.04
FROM ${BASE_IMAGE} AS dev-base
RUN apt-get update && \
DEBIAN_FRONTEND=noninteractive apt-get install --no-install-recommends -y \
build-essential \
ca-certificates \
ccache \
cmake \
curl \
@chuanqi129
chuanqi129 / Dockerfile
Last active November 10, 2022 18:17
Dockerfile to standardize the inductor benchmark tests
# syntax=docker/dockerfile:1
ARG BASE_IMAGE=ubuntu:20.04
FROM ${BASE_IMAGE} AS dev-base
RUN apt-get update && \
DEBIAN_FRONTEND=noninteractive apt-get install --no-install-recommends -y \
build-essential \
ca-certificates \
ccache \
cmake \
curl \