Suppr超能文献

TorchLens:一个用于提取和可视化PyTorch模型隐藏激活值的Python包。

TorchLens: A Python package for extracting and visualizing hidden activations of PyTorch models.

作者信息

Taylor JohnMark, Kriegeskorte Nikolaus

机构信息

Zuckerman Mind Brain Behavior Institute, Columbia University (10027).

出版信息

bioRxiv. 2023 Mar 18:2023.03.16.532916. doi: 10.1101/2023.03.16.532916.

Abstract

Deep neural network models (DNNs) are essential to modern AI and provide powerful models of information processing in biological neural networks. Researchers in both neuroscience and engineering are pursuing a better understanding of the internal representations and operations that undergird the successes and failures of DNNs. Neuroscientists additionally evaluate DNNs as models of brain computation by comparing their internal representations to those found in brains. It is therefore essential to have a method to easily and exhaustively extract and characterize the results of the internal operations of any DNN. Many models are implemented in PyTorch, the leading framework for building DNN models. Here we introduce , a new open-source Python package for extracting and characterizing hidden-layer activations in PyTorch models. Uniquely among existing approaches to this problem, has the following features: (1) it exhaustively extracts the results of all intermediate operations, not just those associated with PyTorch module objects, yielding a full record of every step in the model's computational graph, (2) it provides an intuitive visualization of the model's complete computational graph along with metadata about each computational step in a model's forward pass for further analysis, (3) it contains a built-in validation procedure to algorithmically verify the accuracy of all saved hidden-layer activations, and (4) the approach it uses can be automatically applied to any PyTorch model with no modifications, including models with conditional (if-then) logic in their forward pass, recurrent models, branching models where layer outputs are fed into multiple subsequent layers in parallel, and models with internally generated tensors (e.g., injections of noise). Furthermore, using requires minimal additional code, making it easy to incorporate into existing pipelines for model development and analysis, and useful as a pedagogical aid when teaching deep learning concepts. We hope this contribution will help researchers in AI and neuroscience understand the internal representations of DNNs.

摘要

深度神经网络模型(DNNs)对于现代人工智能至关重要,并为生物神经网络中的信息处理提供了强大的模型。神经科学和工程领域的研究人员都在努力更好地理解支撑DNN成功与失败的内部表示和操作。神经科学家还通过将DNN的内部表示与大脑中的表示进行比较,将DNN评估为大脑计算模型。因此,必须有一种方法能够轻松且详尽地提取和表征任何DNN内部操作的结果。许多模型是在PyTorch中实现的,PyTorch是构建DNN模型的领先框架。在这里,我们介绍了 ,这是一个用于提取和表征PyTorch模型中隐藏层激活的新开源Python包。在解决这个问题的现有方法中, 具有以下独特功能:(1)它详尽地提取所有中间操作的结果,而不仅仅是那些与PyTorch模块对象相关的结果,从而生成模型计算图中每个步骤的完整记录;(2)它提供了模型完整计算图的直观可视化,以及关于模型前向传播中每个计算步骤的元数据,以便进行进一步分析;(3)它包含一个内置的验证程序,用于通过算法验证所有保存的隐藏层激活的准确性;(4)它所使用的方法可以自动应用于任何PyTorch模型,无需修改,包括在前向传播中具有条件(if-then)逻辑的模型、循环模型、层输出并行馈入多个后续层的分支模型以及具有内部生成张量的模型(例如,噪声注入)。此外,使用 只需要最少的额外代码,便于纳入现有的模型开发和分析管道,并且在教授深度学习概念时作为教学辅助工具也很有用。我们希望这一贡献将有助于人工智能和神经科学领域的研究人员理解DNN的内部表示。

https://cdn.ncbi.nlm.nih.gov/pmc/blobs/077c/10055035/60c06e23dc2b/nihpp-2023.03.16.532916v1-f0001.jpg

文献AI研究员

20分钟写一篇综述,助力文献阅读效率提升50倍。

立即体验

用中文搜PubMed

大模型驱动的PubMed中文搜索引擎

马上搜索

文档翻译

学术文献翻译模型,支持多种主流文档格式。

立即体验