caffe调loss方法

简介: 正文what should I do if......my loss diverges? (increases by order of magnitude, goes to inf. or NaN)lower the learning rateraise momentum (with cor...

正文

what should I do if...
...my loss diverges? (increases by order of magnitude, goes to inf. or NaN)
lower the learning rate
raise momentum (with corresponding learning rate drop)
raise weight decay
raise batch size
use gradient clipping (limit the L2 norm of the gradient to a particular value at each iteration; shrink it to that norm if greater)
try another solver: momentum SGD, ADAM, RMSProp, ...
try a smaller initialization (e.g., for a Gaussian init., lower the stdev.)

what should I do if...
...my loss doesn’t improve / gets stuck / drops slowly?

  • raise the learning rate
  • (maybe) lower momentum, weight decay, and/or batch size
  • try another solver: momentum SGD, ADAM, RMSProp, ...
  • transfer a pre-trained (e.g. on ImageNet) initialization, if possible
  • use a larger initialization (in particular, make sure you didn’t zero-initialize any multiplicative weights in intermediate layers)
  • use a “smarter” initialization (e.g., for linear layers followed by ReLUs, try the msra initialization in Caffe)

  • remove some layers to make the network shallower
    at least to start!
    a strategy for model design: begin with a simple, trainable network; “deepen” it by adding new layers one-by-one

-modify the architecture to improve gradient flow:
batch normalization
residual learning [ResNet]
intermediate losses [GoogLeNet]
other tricks

be patient! (go outside?)
deep learning can take a long time
training AlexNet in 2012: 12 days
although this is down to 1 day in 2015!
loss hovers around the chance value of ln(1000) ≅ 6.908 for the first 1000+ iterations (~1 hour on 2012 GPU)
training ResNet-152 in 2015: 1-2 months (on 8 GPUs!)
the best configurations (net architectures, solvers) at convergence are often not the ones that train fastest early on
some tricks to speed up learning can be “greedy” rather than ultimately beneficial

补充一个:如果显存不够,考虑设定iter_size来增大batch_size

reference

https://docs.google.com/presentation/d/1HxGdeq8MPktHaPb-rlmYYQ723iWzq9ur6Gjo71YiG0Y/edit#slide=id.g8629ab2c8_0_60

目录
相关文章
|
存储 机器学习/深度学习 缓存
vLLM 核心技术 PagedAttention 原理详解
本文系统梳理了 vLLM 核心技术 PagedAttention 的设计理念与实现机制。文章从 KV Cache 在推理中的关键作用与内存管理挑战切入,介绍了 vLLM 在请求调度、分布式执行及 GPU kernel 优化等方面的核心改进。PagedAttention 通过分页机制与动态映射,有效提升了显存利用率,使 vLLM 在保持低延迟的同时显著提升了吞吐能力。
9577 22
vLLM 核心技术 PagedAttention 原理详解
|
弹性计算 运维 Devops
FinOps 应用入门指南
FinOps 是一种云成本管理和优化的解决方案,并为组织、企业、团队提供了系统化的方法论,其中每个人都应该对自己的云资源成本负责。
FinOps 应用入门指南
|
机器学习/深度学习 人工智能 安全
【OpenVI—AI热点日报】10月17日
AI热点日报隆重推出! 我们汇集了最新的AI热点信息、最新论文和观点,为您提供最前沿的AI领域资讯。 (往期链接请在子社区查看官方博文哦~)
551 2
【OpenVI—AI热点日报】10月17日
|
Kubernetes 关系型数据库 持续交付
基础设施即代码(IAC),Zalando Postgres Operator 简介
基础设施即代码(IAC),Zalando Postgres Operator 简介
878 0
基础设施即代码(IAC),Zalando Postgres Operator 简介
|
机器学习/深度学习 PyTorch 算法框架/工具
72 页 PPT,带你梳理神经网络完整架构(含 PyTorch 代码)
今天带来一份由 Santiago Pascual de la Puente 整理和总结的一份 72 页 PPT。这份 PPT 总结了如今主要的神经网络架构及其组成,含 PyTorch 实现代码片段!
1203 0
72 页 PPT,带你梳理神经网络完整架构(含 PyTorch 代码)
|
Web App开发 开发框架 JSON
ColyseusJS 轻量级多人游戏服务器开发框架 - 中文手册(上)
ColyseusJS 轻量级多人游戏服务器开发框架 - 中文手册(上)
945 0
ColyseusJS 轻量级多人游戏服务器开发框架 - 中文手册(上)
|
Web App开发 JavaScript 小程序
揭秘:支付宝小程序 V8 Worker 技术演进
本文分享支付宝小程序 V8 Worker 相关工作沉淀和总结,包括技术演进、基础架构、基础功能、以及 JS 引擎能力输出,以及一些优化方案等。欢迎同学们共同探讨,指正。(文末福利:《小程序开发不求人》电子书下载)
4869 0
揭秘:支付宝小程序 V8 Worker 技术演进
|
Web App开发 移动开发 自然语言处理
JavaScript 引擎 V8 执行流程概述
v8是一款高效高速的JavaScript引擎,广泛用于前端和后端。本文是个v8的入门级讲解,主要讲解下v8的整个执行流程,从v8的源文件,词法分析,语法分析,抽象语法树,字节码,执行字节码,turbofan优化编译器等各个流程进行大致的讲解,希望给想学习v8的人有个整体的流程认知。
1919 0
|
Kubernetes Serverless Perl
Knative ServerlessService 介绍
ServerlessService 简称: SKS, 全称:Serverless Kubernetes-style Service 社区文档: https://docs.google.com/document/d/1byHQL6kePDZq6Qt4MqB-g4BDfiaJsfDPGb5oJEK1Ldo/edit?ts=5c81373b# https://docs.
3663 0
|
存储 安全 容器