Apply gradients with distributed_shampoo fails
还没有人认领这个 Issue。
评估
- 难度
- 3/5
- 预计耗时
- 1-2 天
- 新手友好度
- 35/100
- Issue 类型
- 缺陷
- 描述清晰度
- 基本清楚
- 活跃度
- 停滞
- 技术栈
- python, tensorflow
调研方向
The traceback points to lingvo/core/distributed_shampoo.py, in _create_slots around line 336, where a TensorFlow variable is used as a dictionary key. Start by reading that method and the TensorFlow 2.7 variable hashing behavior described by the error. Confirm the failure with the reported apply_gradients() call; done means distributed shampoo applies gradients successfully with TensorFlow 2.7.1.
由索引模型根据 Issue 内容生成。
描述
Hello,
I am trying to run distributed shampoo implemented in lingvo. I have the compatible tensorflow version with lignvo.
Python 3.8.12 | packaged by conda-forge | (default, Oct 12 2021, 21:59:51)
[GCC 9.4.0] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> import tensorflow as tf
>>> tf.__version__
'2.7.1'
>>>
But when I do opt.apply_gradients(), it throws an error about tf.variable being unhashable. apply_gradients() works fine with other optimizers.
File "program.py", line 177, in train_step
optimizer.apply_gradients(
File "/home/ubuntu/anaconda3/envs/tensorflow2_p38/lib/python3.8/site-packages/tensorflow/python/training/optimizer.py", line 605, in apply_gradients
self._create_slots(var_list)
File "/home/ubuntu/anaconda3/envs/tensorflow2_p38/lib/python3.8/site-packages/lingvo/core/distributed_shampoo.py", line 336, in _create_slots
self._partitioner_metadata[v] = TensorPartitioner.partition_metadata(
File "/home/ubuntu/anaconda3/envs/tensorflow2_p38/lib/python3.8/site-packages/tensorflow/python/ops/variables.py", line 1085, in __hash__
raise TypeError(
TypeError: Variable is unhashable. Instead, use variable.ref() as the key. (Variable: <tf.Variable 'conv2d_23/kernel:0' shape=(7, 7, 8, 32) dtype=float32, numpy=
array([[[[-6.29460454e-01, -4.73986834e-01, -3.37867022e-01, ...,
5.98385096e-01, -1.81423143e-01, 4.59209830e-02],
[ 1.96352646e-01, -1.11289904e-01, 3.36863637e-01, ...,
Appreciate any help to fix the issue.
- 主要语言
- Python
- 星标
- 2.9k
- 派生
- 452
- PR 合并指标
- 30 天内没有已合并 PR
环境准备
- 没有 Dockerfile 或 Docker Compose 文件
- 没有 Pull Request 模板
- 阅读贡献指南
从这里开始
- 先读完整个 Issue,再读项目的贡献指南。
- 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
- Fork 仓库,在一个分支上完成修改。
- 提交 Pull Request,并在描述里引用这个 Issue 编号。
tensorflow/lingvo 的其他 Issue
-
About inverseAug未关闭
难度 4/5 3-5 天 新手友好度 25/100
tensorflow/lingvo#370 · 1 条评论 ·
-
难度 4/5 1-2 天 新手友好度 35/100
tensorflow/lingvo#359 · 1 条评论 ·
-
难度 2/5 1-3 小时 新手友好度 15/100
tensorflow/lingvo#356 · 5 个 reaction ·
-
难度 5/5 一周以上 新手友好度 25/100
tensorflow/lingvo#333 ·
-
难度 3/5 1-2 天 新手友好度 35/100
tensorflow/lingvo#332 · 1 条评论 ·
查看 tensorflow/lingvo 的全部 Issue
相似的 Issue
-
Wayback Links未关闭
难度 2/5 1-3 小时 新手友好度 82/100
chnm/teachinghistory-hugo#53 ·
-
gpt-oss "Forcing a tool call" row no longer reproduces: tool_choice is now honoured on every surface未关闭
难度 2/5 1-3 小时 新手友好度 83/100
aws-samples/sample-per-model-bedrock#840 ·
维护者通常 1 天内回复
-
难度 1/5 1 小时以内 新手友好度 85/100
521xueweihan/HelloGitHub#4318 ·
-
难度 2/5 1-3 小时 新手友好度 72/100
DiamondLightSource/eiger-correction#2 · 1 条评论 ·
-
难度 2/5 1-3 小时 新手友好度 68/100
django-cms/djangocms-frontend#413 ·