当前位置:网站首页>【tf.keras】:版本从1.x升级到2.x遇到的一个问题:InvalidArgumentError: Cannot assign a device for operation embedding_
【tf.keras】:版本从1.x升级到2.x遇到的一个问题:InvalidArgumentError: Cannot assign a device for operation embedding_
2022-07-24 15:34:00 【Jack_Kuo】
问题
【tf.keras】:版本从1.x升级到2.x遇到的一个问题:
tensorflow.python.framework.errors_impl.InvalidArgumentError: Cannot assign a device for operation model_1/Embedding-Norm/mul/ReadVariableOp: Could not satisfy explicit device specification '' because the node {
{
colocation_node model_1/Embedding-Norm/mul/ReadVariableOp}} was colocated with a group of nodes that required incompatible device '/job:localhost/replica:0/task:0/device:GPU:0'. All available devices [/job:localhost/replica:0/task:0/device:CPU:0, /job:localhost/replica:0/task:0/device:GPU:0].
解决
1.x的优化函数是这样的:
model = Model(model.inputs, output)
model.summary()
AdamW = extend_with_weight_decay(Adam, 'AdamW')
AdamWG = extend_with_gradient_accumulation(AdamW, 'AdamWG')
optimizer = AdamWG(
learning_rate=2e-5,
weight_decay_rate=0.01,
exclude_from_weight_decay=['Norm', 'bias'],
grad_accum_steps=16
)
model.compile(optimizer=optimizer)
2.x的优化函数需要改成这样的:
model = Model(model.inputs, output)
model.summary()
AdamW = extend_with_weight_decay(Adam, 'AdamW')
optimizer = AdamW(learning_rate=2e-6, weight_decay_rate=0.01)
model.compile(optimizer=optimizer)
边栏推荐
- 各种Normalization的直观理解
- 2022 robocom world robot developer competition - undergraduate group (provincial competition) -- question 2: intelligent medication assistant (finished)
- Lsyncd搭建同步镜像-用Lsyncd实现本地和远程服务器之间实时同步
- 【AdaptiveAvgPool3d】pytorch教程
- 在哪家证券公司开户最好最安全 如何开户炒股票
- Which securities company is good at opening an account with flush? Excuse me, is it safe to open an account with mobile phone or stock?
- Citic securities account opening process, is it safe to open an account on your mobile phone
- Do you understand the working principle of gyroscope?
- 26.文件使用磁盘的代码实现
- MySQL learning notes (summary)
猜你喜欢
![[fluent -- layout] flow layout (flow and wrap)](/img/01/c588f75313580063cf32cc01677600.jpg)
[fluent -- layout] flow layout (flow and wrap)

【AdaptiveAvgPool3d】pytorch教程

Analysis of some difficulties in VAE (variational self encoder)

Huawei camera capability

Read the paper with me - multi model text recognition network

【着色器实现Pixelate马赛克效果_Shader效果第七篇】

27.目录与文件系统

Still using listview? Use animatedlist to make list elements move

Discussion and legitimacy of the order of entering and leaving the stack

MATLAB image defogging technology GUI interface - global balance histogram
随机推荐
简化理解:发布订阅
Fastjson code execution cve-2022-25845
ZABBIX administrator forgot login password
Research on stability of time-delay systems based on Lambert function
Outlook tutorial, how to create tasks and to DOS in outlook?
Five principles of solid are indispensable for good architecture design
Is Huishang futures platform safe? Is it OK to open a futures account?
Netease email (126/163): authorization code acquisition strategy
[machine learning basics] - another perspective to explain SVM
SQL row to column, column to row
Outlook tutorial, how to set rules in outlook?
2022 robocom world robot developer competition - undergraduate group (provincial competition) -- fifth question tree and bipartite diagram (completed)
Date class and time class definitions (operator overload application)
Intelligent operation and maintenance scenario analysis: how to detect abnormal business system status through exception detection
遭受DDoS时,高防IP和高防CDN的选择
Vector introduction and underlying principle
维护香港服务器安全的9个关键措施
YOLO5Face:为什么要重新发明人脸检测器
什么是防火墙?防火墙能发挥什么样的作用?
未来数据库需要关心的硬核创新