当前位置: 首页 > news >正文

php网站开发教案今日军事头条新闻

php网站开发教案,今日军事头条新闻,办公空间设计案例平面图,触屏网站开发Debug 1. 快速运行一次所有的代码 (fast_dev_run) 训练了好长时间但是在训练or 验证的时候崩溃了 使用 fast_dev_run运行5个batch 的 training validation test and predication 查看是否存在错误: train Trainer(fast_dev_runTrue) # True 时为5 train Train…

Debug

1. 快速运行一次所有的代码 (fast_dev_run)

训练了好长时间但是在训练or 验证的时候崩溃了 使用 fast_dev_run运行5个batch 的 training validation test and predication 查看是否存在错误:

train = Trainer(fast_dev_run=True) # True 时为5 
train = Trainer(fast_dev_run=7) # 可以调节为任意int值

2.缩短epoch的长度 (limit_xxx_batch)

有时仅使用training or validation or … 是helpful的 例如在Imagenet等较大的数据集上,比等待complete epoch faster

train = Trainer(limit_train_batch=0.1, limit_val_batch=0.01) # 10% and 1%
train = Trainer(limit_train_batch=10, limit_val_batch=5) # 10 batches and 5 batches

3. 打印输入输出层尺寸(example_input_array)

class LitModel(LightningModule):def __init__(self, *args, **kwargs):self.example_input_array = torch.Tensor(32, 1, 28, 28)

summary table 将会输出包括 input and output 的 dimensions

  | Name  | Type        | Params | Mode  | In sizes  | Out sizes
----------------------------------------------------------------------
0 | net   | Sequential  | 132 K  | train | [10, 256] | [10, 512]
1 | net.0 | Linear      | 131 K  | train | [10, 256] | [10, 512]
2 | net.1 | BatchNorm1d | 1.0 K  | train | [10, 512] | [10, 512]

发现 bottlenecks (profiler)

1. 查看时间(profiler)

trainer = Trainer(profiler="simple") # 测量训练循环中的所有方法# output for simple
FIT Profiler Report-------------------------------------------------------------------------------------------
|  Action                                          |  Mean duration (s) |  Total time (s) |
-------------------------------------------------------------------------------------------
|  [LightningModule]BoringModel.prepare_data       |  10.0001           |  20.00          |
|  run_training_epoch                              |  6.1558            |  6.1558         |
|  run_training_batch                              |  0.0022506         |  0.015754       |
|  [LightningModule]BoringModel.optimizer_step     |  0.0017477         |  0.012234       |
|  [LightningModule]BoringModel.val_dataloader     |  0.00024388        |  0.00024388     |
|  on_train_batch_start                            |  0.00014637        |  0.0010246      |
|  [LightningModule]BoringModel.teardown           |  2.15e-06          |  2.15e-06       |
|  [LightningModule]BoringModel.on_train_start     |  1.644e-06         |  1.644e-06      |
|  [LightningModule]BoringModel.on_train_end       |  1.516e-06         |  1.516e-06      |
|  [LightningModule]BoringModel.on_fit_end         |  1.426e-06         |  1.426e-06      |
|  [LightningModule]BoringModel.setup              |  1.403e-06         |  1.403e-06      |
|  [LightningModule]BoringModel.on_fit_start       |  1.226e-06         |  1.226e-06      |
-------------------------------------------------------------------------------------------trainer = Trainer(profiler="advanced") # 测量每个function的时间
# output for advanced
Profiler ReportProfile stats for: get_train_batch4869394 function calls (4863767 primitive calls) in 18.893 seconds
Ordered by: cumulative time
List reduced from 76 to 10 due to restriction <10>
ncalls  tottime  percall  cumtime  percall filename:lineno(function)
3752/1876    0.011    0.000   18.887    0.010 {built-in method builtins.next}1876     0.008    0.000   18.877    0.010 dataloader.py:344(__next__)1876     0.074    0.000   18.869    0.010 dataloader.py:383(_next_data)1875     0.012    0.000   18.721    0.010 fetch.py:42(fetch)1875     0.084    0.000   18.290    0.010 fetch.py:44(<listcomp>)60000    1.759    0.000   18.206    0.000 mnist.py:80(__getitem__)60000    0.267    0.000   13.022    0.000 transforms.py:68(__call__)60000    0.182    0.000    7.020    0.000 transforms.py:93(__call__)60000    1.651    0.000    6.839    0.000 functional.py:42(to_tensor)60000    0.260    0.000    5.734    0.000 transforms.py:167(__call__)# 如果探查器报告变得太长,您可以将报告流式传输到文件
from lightning.pytorch.profilers import AdvancedProfilerprofiler = AdvancedProfiler(dirpath=".", filename="perf_logs")
trainer = Trainer(profiler=profiler)

highlevel usage:
https://lightning.ai/docs/pytorch/stable/tuning/profiler_intermediate.html

2. 查看accelerator的使用情况 (DeviceStatsMonitor)

检测瓶颈的另一个有用技术是确保您使用加速器 (GPU/TPU/HPU) 的全部容量。

from lightning.pytorch.callbacks import DeviceStatsMonitortrainer = Trainer(callbacks=[DeviceStatsMonitor()])

SOTA find

https://lightning.ai/docs/pytorch/stable/advanced/training_tricks.html

http://www.hkea.cn/news/606384/

相关文章:

  • wordpress utc时间慢8小时大连seo关键词排名
  • 中国建设承包商网站创建软件平台该怎么做
  • 中小企业网站建设费用海外推广服务
  • 企业名称的英文做网站名seo是怎么优化推广的
  • 手机在线建站西安seo服务公司
  • 网站开发有前途吗我也要投放广告
  • 备案 网站名称怎么写crm软件
  • 扁平式网站模板b2b网站推广优化
  • 做外贸网站网络营销咨询服务
  • 江门网站建设方案报价淘宝seo优化怎么做
  • 盘龙城做网站推广网站推广
  • 如何做电子书网站域名站长工具
  • 物联网平台有哪些排名优化外包公司
  • 秦皇岛汽车网站制作数字营销工具
  • 培训教育的网站怎么做东莞做网站的联系电话
  • 云南做网站的公司外贸谷歌优化
  • 网页设计学徒培训可试学巢湖seo推广
  • 让顾客心动的句子seo模拟点击软件源码
  • 设计类专业包括哪些kj6699的seo综合查询
  • 手机网站制作哪家好查关键词
  • 米拓企业网站管理系统电商培训机构排名前十
  • 做效果图有哪些网站seo点击排名
  • 网络营销推广网站收录seo推广排名平台有哪些
  • 产品经理如何看待网站开发广州软件系统开发seo推广
  • wordpress 忘记管理员如何做网站seo
  • app和网站哪个有优势淘宝关键词排名
  • wordpress该域名宁波网站seo公司
  • 建购物网站怎么建呀简单的网站建设
  • 江苏省建设教育协会网站首页百度知道合伙人答题兼职入口
  • 做优化的网站平台搭建