# g2d2
**Repository Path**: mirrors_sony/g2d2
## Basic Information
- **Project Name**: g2d2
- **Description**: No description available
- **Primary Language**: Unknown
- **License**: Apache-2.0
- **Default Branch**: main
- **Homepage**: None
- **GVP Project**: No
## Statistics
- **Stars**: 0
- **Forks**: 0
- **Created**: 2025-08-29
- **Last Updated**: 2026-10-26
## Categories & Tags
**Categories**: Uncategorized
**Tags**: None
## README
# G2D2: Gradient-Guided Discrete Diffusion for Inverse Problem Solving
- arXiv: https://arxiv.org/abs/2410.14710
- TMLR (OpenReview): https://openreview.net/forum?id=fj23qnVifX
Abstract
Recent literature has effectively leveraged diffusion models trained on continuous variables as priors for solving inverse problems. Notably, discrete diffusion models with discrete latent codes have shown strong performance, particularly in modalities suited for discrete compressed representations, such as image and motion generation. However, their discrete and non-differentiable nature has limited their application to inverse problems formulated in continuous spaces. This paper presents a novel method for addressing linear inverse problems by leveraging generative models based on discrete diffusion as priors. We overcome these limitations by approximating the true posterior distribution with a variational distribution constructed from categorical distributions and continuous relaxation techniques. Furthermore, we employ a star-shaped noise process to mitigate the drawbacks of traditional discrete diffusion models with absorbing states, demonstrating that our method performs comparably to continuous diffusion techniques with less GPU memory consumption.
Authors
**Naoki Murata**1, Chieh-Hsin Lai1, Yuhta Takida1, Toshimitsu Uesaka1, Bac Nguyen1, Stefano Ermon2, Yuki Mitsufuji1,31 Sony AI, 2 Stanford University, 3 Sony Group Corporation
Contact: naoki.murata@sony.com
This repository provides code to reproduce the paper experiments (Gaussian deblurring and super-resolution) for the datasets used in the paper. It includes the exact experiment presets used in the paper and minimal wrapper code to run inference and reproduce the reported results.
Supported experiments in this repository
- Gaussian Deblur on ImageNet (val-1k)
- Super Resolution on ImageNet (val-1k)
- Gaussian Deblur on FFHQ (val-1k)
- Super Resolution on FFHQ (val-1k)
See below for usage, dataset layout, and environment setup.
## Repository structure (relevant parts)
- `main.py` — entry point. Selects experiment preset, reads dataset CSV and runs inference.
- `configs/` — example task configs. Use `experiment_preset` in a config YAML to choose a preset.
- `pipelines/` — implementation of the inference pipeline used to run the experiments.
- `util/experiments.py` — experiment presets and helper mappings used by `main.py`.
- `dataset/` — expected location of datasets and CSVs (see below).
- `docker/` — container setup.
## Environment setup
Use the provided Dockerfile to prepare a reproducible environment (recommended).
Build the image from the repository root:
```
docker build -f docker/Dockerfile -t g2d2:latest .
```
Run the container with GPU access and mount the repository:
```
docker run --gpus all -v "$(pwd)":/workspace -w /workspace -it g2d2:latest /bin/bash
```
(Optional) Manually clone BKSE if you need blur-kernel-space-exploring tools or models:
```
# from the repository root on the host
git clone https://github.com/VinAIResearch/blur-kernel-space-exploring bkse
```
## Dataset preparation
This repository expects the user to provide dataset image directories. We provide one ready CSV for FFHQ; ImageNet CSV can be generated from an image directory using the helper script.
CSV format
- Required columns: `image_path`, `caption`
- `image_path` can be absolute or relative to the repository root
- `caption` is the text prompt used by the pipeline (e.g. "a photo of a