Closed akshatvishu closed 1 year ago
I'm sure this is a bug of implementation, we will fix this as soon as possible. Thanks for the issue!
Hey @zhwesky2010 @luotao1 Can I raise a PR to correct this bug?
Anyways, I have tried to setup developer environment for paddle( for linux ) but the instructions were not very clear on how to use docker container or run a test etc.. hence, I am posting the correction here itself:
# this is make the loss cond. on `label/taget` like torch and tensorflow
# the same will needed to be modified at test location for poisson nll loss
loss_out = loss_out + paddle.where(
label > 1,
stirling_approx,
paddle.zeros_like(stirling_approx),
)
@LyndonKong Could you help see this issue? @ZzSean already reproduces the problem.
Thanks for your issue @akshatvishu. It is a bug of implementation and I believe your fix should work. It would be nice if you could open a PR to correct this bug : )
Thanks for your issue @akshatvishu. It is a bug of implementation and I believe your fix should work. It would be nice if you could open a PR to correct this bug : )
Can you please clarify on how to build and test paddle by compiling it locally via using docker as shown here specifically for linux Debian using docker.
If I already cloned my fork of main repo (as shown under contributing guideline ) , do I need to clone the main repo again as mentioned in the first of building from source for linux via docker? Specifically , I skipped these two steps as I already clone the fork at my local machine:
First select the path where you want to store PaddlePaddle, then use the following command to clone PaddlePaddle’s source code from github to a folder named Paddle in the local current directory:
git clone https://github.com/PaddlePaddle/Paddle.git
2. Go to the Paddle directory:
cd Paddle
If not then when I run docker container via executing the command -> docker exec -it paddle-test /bin/bash
then it shows me this, I am confused on whether my setup is correctly installed or not. :
(base) vishu@aja:~/Paddle$ docker exec -it paddle-test /bin/bash
λ aja /home python3.9
Python 3.9.7 (default, Sep 10 2021, 00:03:59)
[GCC 7.5.0] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> import paddle
grep: warning: GREP_OPTIONS is deprecated; please use an alias or script
>>> paddle.__version__
'0.0.0'
>>> exit()
λ aja /home ls
ccache-3.7.9/ ccache-3.7.9.tar.gz cmake-3.16.0-Linux-x86_64/ patchelf_0.10-2_amd64.deb
The guideline actually requires you to mount your local developing directory to /paddle path in the docker, so I don't think you need to clone the main repo again.You can also find the details of how to build and test this operator from this document. Hope it can be helpful.
While using the Poisson NLL loss function in PaddlePaddle, I noticed a difference in the way the Stirling approximation is added to the loss, as compared to both TensorFlow and PyTorch.
@akshatvishu How do you notice the difference, do you have a tool like https://github.com/PaddlePaddle/PaConvert ?
@akshatvishu How do you notice the difference, do you have a tool like https://github.com/PaddlePaddle/PaConvert ?
I was just testing the various frameworks for the Poisson nll Loss
and for some reason while paddle
and torch
shared the same parameters , they were giving different results when I was passing Full=True
bug描述 Describe the Bug
Hello,
While using the Poisson NLL loss function in PaddlePaddle, I noticed a difference in the way the Stirling approximation is added to the loss, as compared to both TensorFlow and PyTorch.
Current PaddlePaddle Behavior:
For values of label that are less than or equal to 1, the Stirling approximation is being added to the loss. CODE
Expected Behavior (Based on TensorFlow and PyTorch):
The Stirling approximation should be added to the loss only for
label/target
values greater than 1. It should not be added for values equal to 1.Here's how TensorFlow and PyTorch handle it:
Here is a working example:
As you can see that at
PaddlePaddle
we check if the values in stirling_approx are less than or equal to 1, which is different from checking the values of label or target as in PyTorch and TensorFlow.I wanted to know that if this was done knowingly or do we want to make it behave similar to TensorFlow and PyTorch ; I can happily raise PR in-case we went with the latter option.
其他补充信息 Additional Supplementary Information
A thing to be take an note of is that the working example I provide is when the input is not
log_input
.i.e.log_input=False
and since Tensorflow does not support thenon log_input
values i modified the code ; this line to be precise:result = log_input - target * tf.math.log(log_input + epsilon)
Thus, if we want a more simpler example to reproduce this error :
And this was the PR which added Poisson NLL loss function