Giter Club home page Giter Club logo

clel's Introduction

Guiding Energy-based Models via Contrastive Latent Variables

PyTorch implementation for "Guiding Energy-based Models via Contrastive Latent Variables" (accepted as a Spotlight presentation in ICLR 2023)

스크린샷 2023-03-02 20 59 24

TL;DR: A simple yet effective framework for improving energy-based models (EBMs) via contrastive representation learning.

Install

conda create -n ebm python=3.9
conda activate ebm
conda install pytorch torchvision cudatoolkit=11.3 -c pytorch
conda install torchmetrics -c conda-forge
conda install ignite -c pytorch-nightly
pip install omegaconf
pip install torch-fidelity
pip install kornia==0.6.3
pip install tensorboard
pip install sklearn

Training

export CUDA_VISIBLE_DEVICES=0
python train.py configs/cifar10.yaml

You can modify options using YAML config files or key=value command-line arguments. See utils.parse_config() and OmegaConf for details.

Generation

python test_fid.py logs/cifar10/resnet_resnet18/ours/config.yaml use_ema=true

This command saves 50k generated samples into samples.pth in the log directory. You can use this file for official pytorch FID evaluation. Note that the FID value obtained from our code is similar to that from the official evaluation.

Out-of-distribution Detection

python test_ood.py logs/cifar10/resnet_resnet18/ours/config.yaml use_ema=true \
    ood_data.name=svhn ood_data.root=/data \
    model.beta=0.1 model.ebm_augmentation=none

clel's People

Contributors

hankook avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar

clel's Issues

The fid which calculated on both resnet and large_resnet on Cifar10 dataset failed to reach the value reported in the paper.

I ran your train.py to train a large resnet on CIFAR10 dataset. In the training procedure, I calculated the fid value with the test dataset, and the best fid value I got is 13.72, which is not so far away from 8.61 which showed in the paper. But when I ran the test _fid.py, I got the best fid value which is about 26.0. It's far away from the desired result. I didn't change the config file and anything. The situation also occured when I ran the code to train the base resnet. I don't know how to solve this problem and get the desired FID result.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.