Pytorch implementation of DeepMind's differentiable neural computer paper.

Overview
Comments
  • Serialise and save the `DNC` at checkpoints

    Serialise and save the `DNC` at checkpoints

    Hi,

    I think the training progresses well, and there does'nt seem to be any improvement after 10,000 iterations. Sometimes I get nan s very early on, and have to restart, and I also got nans after 40,000 iterations.

    May I ask how to serialise and save the DNC at checkpoints? I set a check point after 100 iterations, and got the following error,

    Using CUDA.
    Iteration 0/50000
    	Avg. Logistic Loss: 0.6931
    Iteration 50/50000
    	Avg. Logistic Loss: 0.6674
    Iteration 100/50000
    	Avg. Logistic Loss: 0.4560
    
    Saving Checkpoint ... Traceback (most recent call last):
      File "train.py", line 183, in <module>
        torch.save(ncomputer, f)
      File "/home/ajay/anaconda3/envs/rllab3/lib/python3.5/site-packages/torch/serialization.py", line 120, in save
        return _save(obj, f, pickle_module, pickle_protocol)
      File "/home/ajay/anaconda3/envs/rllab3/lib/python3.5/site-packages/torch/serialization.py", line 186, in _save
        pickler.dump(obj)
    _pickle.PicklingError: Can't pickle <class 'memory.mem_tuple'>: attribute lookup mem_tuple on memory failed
    

    PS - Sometimes I get nan s very early on, and have to restart, and I also got nans after 40,000 iterations. I've seen this very often with Neural Turing Machines, so I guess it's inherent with these type of things?

    opened by AjayTalati 15
  • Error running copy example

    Error running copy example

    Using CPU.                   
    Iteration 0/100000Traceback (most recent call last):
      File "train.py", line 177, in <module>
        output, _ = ncomputer(input_data)
      File "/home/jramapuram/.venv/lib/python2.7/site-packages/torch/nn/modules/module.py", line 206, in __call__
        result = self.forward(*input, **kwargs)
      File "../../neucom/dnc.py", line 108, in forward
        interface['erase_vector']
      File "../../neucom/memory.py", line 398, in write
        allocation_weight = self.get_allocation_weight(sorted_usage, free_list)
      File "../../neucom/memory.py", line 144, in get_allocation_weight
        flat_unordered_allocation_weight.cpu()
      File "/home/jramapuram/.venv/lib/python2.7/site-packages/torch/autograd/variable.py", line 629, in scatter_
        return Scatter(dim, True)(self, index, source)
    RuntimeError: a leaf Variable that requires grad has been used in an in-place operation.
    
    opened by jramapuram 6
  • AssertionError: leaf variable was used in an inplace operation

    AssertionError: leaf variable was used in an inplace operation

    Hi thanks for sharing this, it's really cool that you managed to get it working :+1:

    I got an error though when trying to run the repo,

    Iteration 0/100000Traceback (most recent call last):
      File "train.py", line 155, in <module>
        loss.backward()
      File "/home/ajay/anaconda3/envs/pyphi/lib/python3.6/site-packages/torch/autograd/variable.py", line 158, in backward
        self._execution_engine.run_backward((self,), (gradient,), retain_variables)
      File "/home/ajay/anaconda3/envs/pyphi/lib/python3.6/site-packages/torch/autograd/variable.py", line 201, in _do_backward
        "leaf variable was used in an inplace operation"
    AssertionError: leaf variable was used in an inplace operation
    

    I've seen this before but I can't remember how to fix it? Can you suggest anything please?

    Also maybe there's a typo on the "how to run" part of the cover page for the repo, I think it should be ,

    python tasks/Copy/train.py

    Thanks a lot for your help :+1:

    opened by AjayTalati 4
  • Error,,which pytorch  version?

    Error,,which pytorch version?

    mldl@mldlUB1604:~/ub16_prj/pytorch-NeuCom/tasks/Copy$ python train.py Using CUDA. Iteration 0/100000Traceback (most recent call last): File "train.py", line 177, in output, _ = ncomputer(input_data) File "/usr/local/lib/python2.7/dist-packages/torch/nn/modules/module.py", line 206, in call result = self.forward(*input, **kwargs) File "../../neucom/dnc.py", line 108, in forward interface['erase_vector'] File "../../neucom/memory.py", line 384, in write lookup_weight = self.get_content_address(memory_matrix, key, strength) File "../../neucom/memory.py", line 78, in get_content_address cos_dist = cosine_distance(memory_matrix, query_keys) File "../../neucom/utils.py", line 154, in cosine_distance memory_norm = torch.norm(memory_matrix, 2, 2, keepdim=True) TypeError: norm() got an unexpected keyword argument 'keepdim' mldl@mldlUB1604:~/ub16_prj/pytorch-NeuCom/tasks/Copy$

    opened by loveJasmine 1
  • TypeError: norm received an invalid combination of arguments - got (int, bool), but expected one of:

    TypeError: norm received an invalid combination of arguments - got (int, bool), but expected one of:

    (VENVpytorch2) mldl@mldlUB1604:~/ub16_prj/pytorch-NeuCom/tasks/Copy$ python train.py Using CUDA. Iteration 0/100000Traceback (most recent call last): File "train.py", line 177, in output, _ = ncomputer(input_data) File "/home/mldl/ub16_prj/VENV_host/VENV_pytorch2/VENVpytorch2/local/lib/python2.7/site-packages/torch/nn/modules/module.py", line 206, in call result = self.forward(*input, **kwargs) File "../../neucom/dnc.py", line 108, in forward interface['erase_vector'] File "../../neucom/memory.py", line 384, in write lookup_weight = self.get_content_address(memory_matrix, key, strength) File "../../neucom/memory.py", line 78, in get_content_address cos_dist = cosine_distance(memory_matrix, query_keys) File "../../neucom/utils.py", line 154, in cosine_distance memory_norm = torch.norm(memory_matrix, 2, dim=True) File "/home/mldl/ub16_prj/VENV_host/VENV_pytorch2/VENVpytorch2/local/lib/python2.7/site-packages/torch/autograd/variable.py", line 596, in norm return Norm(p, dim)(self) File "/home/mldl/ub16_prj/VENV_host/VENV_pytorch2/VENVpytorch2/local/lib/python2.7/site-packages/torch/autograd/_functions/reduce.py", line 192, in forward output = input.norm(self.norm_type, self.dim) TypeError: norm received an invalid combination of arguments - got (int, bool), but expected one of:

    • no arguments
    • (float p)
    • (float p, int dim) didn't match because some of the arguments have invalid types: (int, bool)

    (VENVpytorch2) mldl@mldlUB1604:~/ub16_prj/pytorch-NeuCom/tasks/Copy$

    opened by loveJasmine 2
  • backward through cumprod

    backward through cumprod

    Hey, In function get_allocation_weight() in memory.py, cumprod is used, but as far as I know, this operation does not have autograd support yet and is still in PR: https://github.com/pytorch/pytorch/pull/1439, so I'm really confused as how is the backward passed through this operation for you? Is the resulting variables not in the computation graph? Thanks in advance! Really nice repository:)

    opened by jingweiz 12
  • Compare with DeepMind's implementation

    Compare with DeepMind's implementation

    Hi @ypxie,

    I just saw DeepMind released their Tensorflow/Sonnet implementation of the DNC,

    https://github.com/deepmind/dnc

    I was wondering if you're interested in re-looking at this project to see if we can compare it with DMs code? I spent quite a lot of time previously on your implementation, be a lot of fun to start working on it again :+1:

    Kind regards,

    Ajay

    opened by AjayTalati 2
Owner
Yuanpu Xie
Yuanpu Xie
Neural Turing Machine (NTM) & Differentiable Neural Computer (DNC) with pytorch & visdom

Neural Turing Machine (NTM) & Differentiable Neural Computer (DNC) with pytorch & visdom Sample on-line plotting while training(avg loss)/testing(writ

Jingwei Zhang 269 Nov 15, 2022
Open Source Differentiable Computer Vision Library for PyTorch

Kornia is a differentiable computer vision library for PyTorch. It consists of a set of routines and differentiable modules to solve generic computer

kornia 7.6k Jan 4, 2023
Official implementation of GraphMask as presented in our paper Interpreting Graph Neural Networks for NLP With Differentiable Edge Masking.

GraphMask This repository contains an implementation of GraphMask, the interpretability technique for graph neural networks presented in our ICLR 2021

Michael Schlichtkrull 29 Sep 2, 2022
Pytorch Implementation of Google's Parallel Tacotron 2: A Non-Autoregressive Neural TTS Model with Differentiable Duration Modeling

Parallel Tacotron2 Pytorch Implementation of Google's Parallel Tacotron 2: A Non-Autoregressive Neural TTS Model with Differentiable Duration Modeling

Keon Lee 170 Dec 27, 2022
Official PyTorch implementation of the ICRA 2021 paper: Adversarial Differentiable Data Augmentation for Autonomous Systems.

Adversarial Differentiable Data Augmentation This repository provides the official PyTorch implementation of the ICRA 2021 paper: Adversarial Differen

Manli 3 Oct 15, 2022
Official code release for ICCV 2021 paper SNARF: Differentiable Forward Skinning for Animating Non-rigid Neural Implicit Shapes.

Official code release for ICCV 2021 paper SNARF: Differentiable Forward Skinning for Animating Non-rigid Neural Implicit Shapes.

null 235 Dec 26, 2022
PyTorch implementation of Soft-DTW: a Differentiable Loss Function for Time-Series in CUDA

Soft DTW Loss Function for PyTorch in CUDA This is a Pytorch Implementation of Soft-DTW: a Differentiable Loss Function for Time-Series which is batch

Keon Lee 76 Dec 20, 2022
an implementation of softmax splatting for differentiable forward warping using PyTorch

softmax-splatting This is a reference implementation of the softmax splatting operator, which has been proposed in Softmax Splatting for Video Frame I

Simon Niklaus 338 Dec 28, 2022
EdMIPS: Rethinking Differentiable Search for Mixed-Precision Neural Networks

EdMIPS is an efficient algorithm to search the optimal mixed-precision neural network directly without proxy task on ImageNet given computation budgets. It can be applied to many popular network architectures, including ResNet, GoogLeNet, and Inception-V3.

Zhaowei Cai 47 Dec 30, 2022
OptNet: Differentiable Optimization as a Layer in Neural Networks

OptNet: Differentiable Optimization as a Layer in Neural Networks This repository is by Brandon Amos and J. Zico Kolter and contains the PyTorch sourc

CMU Locus Lab 428 Dec 24, 2022
Code for the ECCV2020 paper "A Differentiable Recurrent Surface for Asynchronous Event-Based Data"

A Differentiable Recurrent Surface for Asynchronous Event-Based Data Code for the ECCV2020 paper "A Differentiable Recurrent Surface for Asynchronous

Marco Cannici 21 Oct 5, 2022
Repository for the paper "PoseAug: A Differentiable Pose Augmentation Framework for 3D Human Pose Estimation", CVPR 2021.

PoseAug: A Differentiable Pose Augmentation Framework for 3D Human Pose Estimation Code repository for the paper: PoseAug: A Differentiable Pose Augme

Pyjcsx 328 Dec 17, 2022
The official code for paper "R2D2: Recursive Transformer based on Differentiable Tree for Interpretable Hierarchical Language Modeling".

R2D2 This is the official code for paper titled "R2D2: Recursive Transformer based on Differentiable Tree for Interpretable Hierarchical Language Mode

Alipay 49 Dec 17, 2022
This repository contains the code for the CVPR 2020 paper "Differentiable Volumetric Rendering: Learning Implicit 3D Representations without 3D Supervision"

Differentiable Volumetric Rendering Paper | Supplementary | Spotlight Video | Blog Entry | Presentation | Interactive Slides | Project Page This repos

null 697 Jan 6, 2023
Official Repo for ICCV2021 Paper: Learning to Regress Bodies from Images using Differentiable Semantic Rendering

[ICCV2021] Learning to Regress Bodies from Images using Differentiable Semantic Rendering Getting Started DSR has been implemented and tested on Ubunt

Sai Kumar Dwivedi 83 Nov 27, 2022
The official codes of our CVPR2022 paper: A Differentiable Two-stage Alignment Scheme for Burst Image Reconstruction with Large Shift

TwoStageAlign The official codes of our CVPR2022 paper: A Differentiable Two-stage Alignment Scheme for Burst Image Reconstruction with Large Shift Pa

Shi Guo 32 Dec 15, 2022
This repository contains notebook implementations of the following Neural Process variants: Conditional Neural Processes (CNPs), Neural Processes (NPs), Attentive Neural Processes (ANPs).

The Neural Process Family This repository contains notebook implementations of the following Neural Process variants: Conditional Neural Processes (CN

DeepMind 892 Dec 28, 2022
An implementation demo of the ICLR 2021 paper Neural Attention Distillation: Erasing Backdoor Triggers from Deep Neural Networks in PyTorch.

Neural Attention Distillation This is an implementation demo of the ICLR 2021 paper Neural Attention Distillation: Erasing Backdoor Triggers from Deep

Yige-Li 84 Jan 4, 2023
Differentiable Optimizers with Perturbations in Pytorch

Differentiable Optimizers with Perturbations in PyTorch This contains a PyTorch implementation of Differentiable Optimizers with Perturbations in Tens

Jake Tuero 54 Jun 22, 2022