Comments (2)
Hi,
Thanks for issuing this bug. This NaN bug caused by KL Divergence calculation in DCRec was suspected and fixed in the individual repository of the paper: link
And you are right the reason is that torch.normal can have non-positive values for log(). A simple workaround is to truncate these values to a tiny number (like 1e-8):
def cal_kl_1(target, input):
target[target<1e-8] = 1e-8
target = torch.log(target + 1e-8)
input = torch.log_softmax(input + 1e-8, dim=0)
return F.kl_div(input, target, reduction='batchmean', log_target=True)
I tested this and it works well without a noticeable performance decline. I'm not quite sure if applying softmax is another effective workaround. However, I have now updated this bugfix for DCRec here, and please feel free to test and compare. :)
from sslrec.
Got it! Thank you for your reply.
from sslrec.
Related Issues (20)
- 关于Epinions数据集缺少category.pkl文件的问题 HOT 1
- 多行为推荐中的 MBSSL(SIGIR2023) 是否在计划中? 🌱 HOT 1
- Gumbel噪声的计算会出现-inf HOT 1
- SimGCL: InfoNCE Loss Calculation Batch vs. Entire Embeddings HOT 2
- 关于评价指标 HOT 2
- 关于多行为推荐中数据集问题 HOT 6
- 如何构建自己的数据集 HOT 2
- Model performance HOT 3
- 关于其他数据集 HOT 2
- pickle加载文件时报错ModuleNotFoundError: No module named 'scipy.sparse._csr',scipy库版本为1.7.3,希望得到作者的解答,万分感谢 HOT 1
- 关于retail_rocket数据集下生成的kg.txt的含义 HOT 2
- 关于lightgcn层数问题 HOT 4
- 训练集测试集的划分
- Can evaluation metrics support AUC-ROC calculations? HOT 1
- cuda版本问题 HOT 1
- 关于SSLRec运行时出现“Cuda Kernel Error”? HOT 4
- 关于构建自己的kg数据集 HOT 2
- 关于模型评测指标数值的问题 HOT 1
- KGIN在SSLRec仓库和KGRec仓库在我的测试下差距过大
- 关于dgl的cuda版本适配问题
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
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.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from sslrec.