Questions tagged [chainer]
Chainer is an open source deep learning framework written in Python.
197
questions
0
votes
0
answers
30
views
Chainer.grad() how to implement this function in Pytorch
I am writing to migrate code from chainer framework to pytorch. I came across the below code:
chainer.grad(
[loss_func(F.clipped_relu(X2, z=1.0), Yp)],
[X2],
set_grad=True,
retain_grad=...
0
votes
0
answers
6
views
Chainerrl : Divide by zero encountered in xp.log(batch_probs) + xp.random.gumbel(size=batch_probs.shape) when I have 4 actions
I am using Chainerrl to run an A3C agent on a discrete action space. I have 4 actions that act on an observation space of shape (1,2500). However, I get this runtime warning and I think because of ...
0
votes
1
answer
136
views
How to check the model's parameters number in chainer
How to check my chainer model's parameters number? Is it something similar to model.count_params() in Keras.
0
votes
1
answer
58
views
How can I increase the number of mini-batch using the Standard Updater class in Chainer substantially?
How can I increase the number of mini-batch using the Standard Updater class in Chainer substantially?
In case of PyTorch,
I can increase the number of mini-batch substantially.
Execute loss.backward(...
0
votes
1
answer
879
views
Chainer: No module named 'cupy.util'`
I am getting desperate with Chainer because I'm not able to use it with GPU for about a week now. The error I am getting:
RuntimeError: CUDA environment is not correctly set up (see https://github.com/...
4
votes
0
answers
2k
views
AttributeError: module 'typing_extensions' has no attribute 'Protocol'
I am trying to run the following code: https://github.com/silviazuffi/smalst. However, I am using Python 3 instead of Python 2 because it does not seem to be possible to use Python 2 anymore with new ...
0
votes
1
answer
26
views
How to extend an agent class in ChainerRL in Python
I want to extend the PPO agent class in ChainerRL. I did the following:
class exPPO(chainerrl.agents.PPO):
def act_and_train(self, obs, reward):
action = chainerrl.agents.PPO(self, ...
0
votes
1
answer
339
views
incompatible array types are mixed in the forward input (LinearFunction) in machine learning
I have trained a deep Q-Learning model using Chanier:
class Q_Network (chainer.Chain):
def __init__(self, input_size, hidden_size, output_size):
super (Q_Network, self).__init__ (
...
1
vote
1
answer
234
views
How to read the image data from different folders?
I have 4 folders: Cat, Dog, Tiger and Kangaroo, each with 100 images save in the respective folders.
When I use chainer library to import mnist dataset, I get tuple of images and their corresponding ...
0
votes
1
answer
115
views
Loading a pre-trained model in Chainer Deep Learning Framework
I need to load a pre-trained model in Chainer framework, but as I understood, the saved (.npz) file only contains the weights and I have to reconstruct the model then load the weights into it, and ...
0
votes
1
answer
47
views
Define a number of learnable parameters in Chainer
I want to define a number of learnable parameters in my model that are multiplied by the feature map in feedforward and updated when backpropagation.
How can i implement this in the chainer framework?...
0
votes
1
answer
161
views
Converting .npz model from ChainerRL to Keras model, or alternative methods?
I have a DQN reinforcement learning model which was trained using ChainerRL's built-in DQN experiment on the Ms Pacman Atari game environment, let's call this file model.npz. I have some analysis ...
1
vote
0
answers
29
views
Chainer: custom extension for early stopping based on time limit
I have a trainer that already has a stop trigger based on the total number of epochs:
trainer = training.Trainer(updater, (epochs, 'epoch'))
Now I would like to add a stopping condition based on the ...
1
vote
1
answer
262
views
How to load Chainer training checkpoint from npz?
I am using Chainer to train (fine-tune) a Resnet model and then use the checkpoint for evaluation. The checkpoint is a npz file with the following structure:
When I am loading the model for ...
0
votes
0
answers
41
views
how to save figure in vis_bbox without white background, when plotting with matplotlib?
i'm trying to save the image after vis_bbox prediction with its original image dimension.
my code:
from PIL import Image, ImageChops
import cv2
img = utils.read_image('/home/ubuntu/ui.jpg', color=...
1
vote
1
answer
34
views
Is "chainer.functions.sigmoid_cross_entropy" a second-order differentiable function?
I am a student studying machine learning.
For my study, we need to differentiate the loss function by second order, we use "chainer.functions.sigmoid_cross_entropy".
A similar function is "chainer....
0
votes
2
answers
96
views
How do I print layers in a Chainer model?
I have a chainer model. For example something like this:
import chainer.links as L
c0=L.Convolution2D(3, 32, 3, 1, 1),
c1=L.Convolution2D(32, 64, 4, 2, 1),
c2=L.Convolution2D(64, 64, 3, 1, 1),
I ...
0
votes
2
answers
1k
views
Passing structure to raw kernel in cupy
I have CUDA kernels that take structures such as float3, int2, etc. as arguments. I seem to be unable to properly pass an argument to these kernels through the cupy rawkernel interface. I have tried ...
1
vote
1
answer
1k
views
How to solve "cuDNN is not enabled"
I'm using cupy with Spyder3.3.6 and Python 3.7.5 in Windows machine(Win10 Pro 64bit, i7-7700, 8GBMemory, GTX-1060-6GB).
Version of cupy, chainer, cuda and cuDNN are 6.0.0, 5.3.0, 10.1.243, and 7.6.4,...
0
votes
0
answers
685
views
Cupy error : cudaErrorIllegalAddress - an illegal memory access was encountered
Training a feed forward network on GPU using Chainer. After training some batches, getting aerror "CUDARuntimeError: cudaErrorIllegalAddress: an illegal memory access was encountered".
only 1.5GB out ...
1
vote
1
answer
37
views
Add extra output to existing Chainer network
Let's say I create a simple fully connected network:
import chainer
import chainer.functions as F
import chainer.links as L
from chainer import Sequential
model = Sequential(
L.Linear(n_in, ...
-1
votes
1
answer
117
views
How can I fix dimension i got the same error even i edit dtype with int32 or float32?
How can I fix this problem please?
dtype_attr = getattr(initializer, 'dtype', None)
if dtype is not None and dtype_attr is not None \
and numpy.dtype(dtype) != numpy.dtype(dtype_attr):
...
0
votes
1
answer
20
views
Increased Global Batch in Data Parallelism size Causes OOM Error
I am increasing the batch size as I increase the number of GPUs when training the AlexNet Model on ImageNet dataset. It works fine up to 4096 when I get OOM errors. I start with a batch size of 1024 ...
1
vote
1
answer
49
views
How to measure time per layer in Chainer
How can I measure the time taken by each layer? This should include both forward and backward pass.
For instance, in the case of VGG, I wanna know the time each of the layers takes. Part of the code ...
0
votes
1
answer
95
views
How to get the value of loss in the update rule of chainer
I am trying to modify a class, SGDRule(optimizer.UpdateRule) of chainer, to make my original optimizer.
To achieve what I want, I need to get not only the gradient but also the loss.
Before ...
0
votes
0
answers
44
views
chainer build to test chainerx failing
Hello I'm having an issue where building chainer is failing on Windows 10. I have all the appropriate environment variables set as specified in the chainerx installation documentation. It seems to be ...
0
votes
1
answer
50
views
Updater does not work with dictionary of optimizers
I have been trying to modify the cifer example code of Chainer so that it works with multiple optimizers.
As written in page 946 of Chainer Documentation (Release 7.0.0b3), I thought that the ...
1
vote
1
answer
172
views
A gradient clipping in Chainer
Can I get a Gradient Clipping function in Chainer?
I found some codes in Pytorch Documentation : https://pytorch.org/docs/stable/_modules/torch/nn/utils/clip_grad.html
Is there anything like ...
0
votes
0
answers
585
views
AttributeError: 'numpy.float32' object has no attribute 'to_cpu'
Good day,
I'm developing a deep learning model for wireless signal detection. Below is the snippet of the function that computes the model accuracy and bit error rate (BER):
from chainer.datasets ...
1
vote
1
answer
53
views
Chainerui via internet
I'm developing my deep learning program on the Google Cloud Platform (GCP) and want to visualize the results using chainerui, but it's not been successful yet. Has anybody suceeded in it?
Since I ...
0
votes
1
answer
43
views
Multi-dimensional inputs in Chainer
I'm trying to build a neural network with Chainer that takes a 4-dimensional numpy array as an input.
I know that, according to this publication, that is feasible. However, I don't see the way to ...
0
votes
1
answer
97
views
Why does Chainer Batchnormalization not work well with mnist_nn
Chainer batchnormalization does not work well with my code although batch normalization of tensorflow works. I use the dataset mnist the code below shows.
Using chainer(version=6.1.0), without ...
5
votes
1
answer
3k
views
How to use CUDA pinned "zero-copy" memory for a memory mapped file?
Objective/Problem
In Python, I am looking for a fast way to read/write data from a memory mapped file to a GPU.
In a previous SO overflow post [ Cupy OutOfMemoryError when trying to cupy.load ...
1
vote
2
answers
461
views
TypeError: numpy.ndarray or cuda.ndarray are expected
I want to train Convolution3d model in chainer. In my training roop, I have this error.
TypeError: numpy.ndarray or cuda.ndarray are expected.
I thought the reason for the error was that the input ...
1
vote
1
answer
2k
views
TypeError: Argument 'x' has incorrect type (expected cupy.core.core.ndarray, got numpy.ndarray)
Executing the following minimal example in cupy.
import numpy, cupy, cupyx
print( cupyx.get_runtime_info() )
mydata = numpy.empty((3,), dtype='f')
#gpu = False
gpu = True
if not gpu:
xp = ...
0
votes
1
answer
2k
views
Cupy error - disk quota exceeded [Minimal example included]
Executing the following minimal example in cupy.
import cupy, cupyx
x = cupy.array([1., 2., 3.])
y = cupy.arange(10)
print(cupyx.get_runtime_info())
in the following manner
(venv) user@ailx216:/...
0
votes
1
answer
732
views
cupy map_coordinates gives out shape is mismatched error
I am trying to use the scipy compatible finction of cupy namely the map_coordinates function. However, after a lot of tinkering I am unable to get it to work. So, I do something as follows:
import ...
0
votes
1
answer
99
views
Error while handling chainer.function.max_pooling_2d in python
I am using max_pooling function using chainer for maxpooling operation in CNN.
I am getting the following error. i have placed the code which i used for max_pooling operation.what i need to do to ...
0
votes
0
answers
185
views
GPU RAM Memory fragmentation using cupy?
I am Training VAE Model on CPU it works well for 1 epoch, since I need to train it more to get good result using GPU is required, I tried training on GPU but it goes Out of Memory. Since, CPU takes 25....
0
votes
0
answers
139
views
How to free the consumption of memory from Memory Pool for Training on GPU?
Allocation of Memory using cupy throws an Out of Memory allocation problem.Consumption of memory out of 12 GB gets almost completed before even starting training. Now,during training all the memory is ...
0
votes
2
answers
50
views
Chainer: custome sigmoid activation function
I want to implement the following sigmoid function with a custom slope parameter k.
y = f(x)= 1/ ( 1+exp(-1*k*x))
gradient gy = k * f(x)*(1-f(x))
I want to use this in my autoencoder. How do I ...
0
votes
0
answers
211
views
Chainer : Exception in main training loop: out of memory to allocate 2097152000 bytes (total 13850445312 bytes)
Chainer Training code:
I am using --
Chainer: 6.0.0
NumPy: 1.15.4
CuPy:
CuPy Version : 6.0.0
CUDA Root : /usr/local/cuda-10.0
CUDA Build Version : 10000
...
0
votes
1
answer
838
views
Chainer: AttributeError: module 'chainer.distributions' has no attribute 'Independent'
Problem on using API named Independent.
I am using --
Chainer: 5.4.0
NumPy: 1.15.4
CuPy:
CuPy Version : 5.4.0
CUDA Root : /usr/local/cuda-10.0
CUDA Build Version : ...
1
vote
0
answers
38
views
Chainer and float64 support
I want to know how to make chainer support float64 precision calculations. Below is my simple Autoencoder code I wrote in chainer. Initially I was running it with float32 dtype but now I want to test ...
0
votes
0
answers
2k
views
Chainer : object __array__ method not producing an array
After training the VAE Model,i got the trained model.And also,save images is expected to be in each epoch folder but images are not saved.No idea where is the problem? and how to fix it ?
...
0
votes
1
answer
121
views
Shift from single gpu to multiple gpu.Throws an error TypeError: '<' not supported between instances of 'list' and 'int'
I had shifted from using single gpu to multiple gpu. The Code throws an error
epoch main/loss validation/main/loss elapsed_time
Exception in main training loop: '<' not supported ...
0
votes
1
answer
1k
views
VAE does not learn when I change reconstruction loss functions F.bernoulli_nll to F.mean_squared_error in Chainer
I want use mean_squared_error instead of F.bernoulli_nll as Reconstruct Loss function in my VAE using chainer5.0.0.
I am a Chainer5.0.0 user.
I have implemented VAE(Variational Autoencoder). I used ...
1
vote
1
answer
55
views
Creating a Dataset to input only Images
I need a dataset object that contains only images for unsupervised learning in Chainer framework. I am trying to use DatasetMixin for this purpose.
Images is a list containing images.
class ...
2
votes
0
answers
267
views
Use Raspberry's VideoCore IV GPU for chainer model. Requires cupy? cuda?
I am trying to run Idein/chainer-pose-proposal-net on a Raspberry Pi 3 B+. This is a pose estimation model (specifically Pose Proposal Networks
by Taiki Sekii) in Chainer.
In the README it is ...
1
vote
1
answer
44
views
Calculating number and size of filters for given input size
I have an autoencoder to regenerate input images. The image shape is (10, 1308608). 1308608 is 4*644*508.
class AutoEncoder(chainer.Chain):
def __init__(self, input_size, n_filters, n_units, ...