You can not select more than 25 topics Topics must start with a chinese character,a letter or number, can include dashes ('-') and can be up to 35 characters long.

event_data.py 12 kB

6 years ago
6 years ago
6 years ago
123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400
  1. # Copyright 2020 Huawei Technologies Co., Ltd
  2. #
  3. # Licensed under the Apache License, Version 2.0 (the "License");
  4. # you may not use this file except in compliance with the License.
  5. # You may obtain a copy of the License at
  6. #
  7. # http://www.apache.org/licenses/LICENSE-2.0
  8. #
  9. # Unless required by applicable law or agreed to in writing, software
  10. # distributed under the License is distributed on an "AS IS" BASIS,
  11. # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  12. # See the License for the specific language governing permissions and
  13. # limitations under the License.
  14. # ============================================================================
  15. """The event data in querier test."""
  16. import json
  17. from ....utils.mindspore.dataset.engine.serializer_deserializer import SERIALIZED_PIPELINE
  18. EVENT_TRAIN_DICT_0 = {
  19. 'wall_time': 1581499557.7017336,
  20. 'train_lineage': {
  21. 'hyper_parameters': {
  22. 'optimizer': 'ApplyMomentum0',
  23. 'learning_rate': 0.10000000149011612,
  24. 'loss_function': '',
  25. 'epoch': 1,
  26. 'parallel_mode': 'stand_alone0',
  27. 'device_num': 1,
  28. 'batch_size': 31
  29. },
  30. 'algorithm': {
  31. 'network': 'TrainOneStepCell0',
  32. 'loss': 2.3025848865509033
  33. },
  34. 'train_dataset': {
  35. 'train_dataset_path': '',
  36. 'train_dataset_size': 31
  37. },
  38. 'model': {
  39. 'path': 'xxx0',
  40. 'size': 400716930
  41. }
  42. }
  43. }
  44. EVENT_TRAIN_DICT_1 = {
  45. 'wall_time': 1581499557.7017336,
  46. 'train_lineage': {
  47. 'hyper_parameters': {
  48. 'optimizer': 'ApplyMomentum1',
  49. 'learning_rate': 0.20000000298023224,
  50. 'loss_function': 'loss_function1',
  51. 'epoch': 1,
  52. 'parallel_mode': 'stand_alone1',
  53. 'device_num': 2,
  54. 'batch_size': 35
  55. },
  56. 'algorithm': {
  57. 'network': 'TrainOneStepCell1',
  58. 'loss': 2.4025847911834717
  59. },
  60. 'train_dataset': {
  61. 'train_dataset_path': '/path/to/train_dataset1',
  62. 'train_dataset_size': 32
  63. },
  64. 'model': {
  65. 'path': 'xxx1',
  66. 'size': 400716931
  67. }
  68. }
  69. }
  70. EVENT_TRAIN_DICT_2 = {
  71. 'wall_time': 1581499557.7017336,
  72. 'train_lineage': {
  73. 'hyper_parameters': {
  74. 'optimizer': 'ApplyMomentum2',
  75. 'learning_rate': 0.30000001192092896,
  76. 'loss_function': 'loss_function2',
  77. 'epoch': 2,
  78. 'parallel_mode': 'stand_alone2',
  79. 'device_num': 3,
  80. 'batch_size': 38
  81. },
  82. 'algorithm': {
  83. 'network': 'TrainOneStepCell2',
  84. 'loss': 2.502584934234619
  85. },
  86. 'train_dataset': {
  87. 'train_dataset_path': '/path/to/train_dataset2',
  88. 'train_dataset_size': 33
  89. },
  90. 'model': {
  91. 'path': 'xxx2',
  92. 'size': 400716932
  93. }
  94. }
  95. }
  96. EVENT_TRAIN_DICT_3 = {
  97. 'wall_time': 1581499557.7017336,
  98. 'train_lineage': {
  99. 'hyper_parameters': {
  100. 'optimizer': 'ApplyMomentum3',
  101. 'learning_rate': 0.4000000059604645,
  102. 'loss_function': 'loss_function3',
  103. 'epoch': 2,
  104. 'parallel_mode': 'stand_alone3',
  105. 'device_num': 3,
  106. 'batch_size': 35
  107. },
  108. 'algorithm': {
  109. 'network': 'TrainOneStepCell3',
  110. 'loss': 2.6025848388671875
  111. },
  112. 'train_dataset': {
  113. 'train_dataset_path': '/path/to/train_dataset3',
  114. 'train_dataset_size': 34
  115. },
  116. 'model': {
  117. 'path': 'xxx3',
  118. 'size': 400716933
  119. }
  120. }
  121. }
  122. EVENT_TRAIN_DICT_4 = {
  123. 'wall_time': 1581499557.7017336,
  124. 'train_lineage': {
  125. 'hyper_parameters': {
  126. 'optimizer': 'ApplyMomentum4',
  127. 'learning_rate': 0.5,
  128. 'loss_function': 'loss_function1',
  129. 'epoch': 3,
  130. 'parallel_mode': 'stand_alone4',
  131. 'device_num': 1,
  132. 'batch_size': 50
  133. },
  134. 'algorithm': {
  135. 'network': 'TrainOneStepCell4',
  136. 'loss': 2.702584981918335
  137. },
  138. 'train_dataset': {
  139. 'train_dataset_path': '/path/to/train_dataset4',
  140. 'train_dataset_size': 35
  141. },
  142. 'model': {
  143. 'path': 'xxx4',
  144. 'size': 400716934
  145. }
  146. }
  147. }
  148. EVENT_TRAIN_DICT_5 = {
  149. 'wall_time': 1581499557.7017336,
  150. 'train_lineage': {
  151. 'hyper_parameters': {
  152. 'optimizer': 'ApplyMomentum5',
  153. 'learning_rate': 0.5,
  154. 'loss_function': 'loss_function1',
  155. 'epoch': 3,
  156. 'parallel_mode': 'stand_alone5',
  157. 'device_num': 1,
  158. 'batch_size': 51
  159. },
  160. 'algorithm': {
  161. 'network': 'TrainOneStepCell5',
  162. 'loss': 2.702584981918335
  163. },
  164. 'train_dataset': {
  165. 'train_dataset_size': 35
  166. },
  167. 'model': {
  168. 'path': 'xxx4',
  169. 'size': 400716934
  170. }
  171. }
  172. }
  173. EVENT_TRAIN_DICT_EXCEPTION = {
  174. 'wall_time': 1581499557.7017336
  175. }
  176. METRIC_0 = {
  177. 'accuracy': None,
  178. 'mae': 2.00000001,
  179. 'mse': 3.00000001
  180. }
  181. CUSTOMIZED__0 = {
  182. 'metric/accuracy': {'label': 'metric/accuracy', 'required': True, 'type': 'float'},
  183. }
  184. CUSTOMIZED_0 = {
  185. **CUSTOMIZED__0,
  186. 'metric/mae': {'label': 'metric/mae', 'required': True, 'type': 'float'},
  187. 'metric/mse': {'label': 'metric/mse', 'required': True, 'type': 'float'}
  188. }
  189. CUSTOMIZED_1 = {
  190. 'metric/accuracy': {'label': 'metric/accuracy', 'required': True, 'type': 'NoneType'},
  191. 'metric/mae': {'label': 'metric/mae', 'required': True, 'type': 'float'},
  192. 'metric/mse': {'label': 'metric/mse', 'required': True, 'type': 'float'}
  193. }
  194. CUSTOMIZED_2 = {
  195. 'metric/accuracy': {'label': 'metric/accuracy', 'required': True, 'type': 'mixed'},
  196. 'metric/mae': {'label': 'metric/mae', 'required': True, 'type': 'float'},
  197. 'metric/mse': {'label': 'metric/mse', 'required': True, 'type': 'float'}
  198. }
  199. METRIC_1 = {
  200. 'accuracy': 1.0000002,
  201. 'mae': 2.00000002,
  202. 'mse': 3.00000002
  203. }
  204. METRIC_2 = {
  205. 'accuracy': 1.0000003,
  206. 'mae': 2.00000003,
  207. 'mse': 3.00000003
  208. }
  209. METRIC_3 = {
  210. 'accuracy': 1.0000004,
  211. 'mae': 2.00000004,
  212. 'mse': 3.00000004
  213. }
  214. METRIC_4 = {
  215. 'accuracy': 1.0000005,
  216. 'mae': 2.00000005,
  217. 'mse': 3.00000005
  218. }
  219. METRIC_5 = {
  220. 'accuracy': 1.0000006,
  221. 'mae': 2.00000006,
  222. 'mse': 3.00000006
  223. }
  224. EVENT_EVAL_DICT_0 = {
  225. 'wall_time': 1581499557.7017336,
  226. 'evaluation_lineage': {
  227. 'metric': json.dumps(METRIC_0),
  228. 'valid_dataset': {
  229. 'valid_dataset_path': '',
  230. 'valid_dataset_size': 400716931
  231. }
  232. }
  233. }
  234. EVENT_EVAL_DICT_1 = {
  235. 'wall_time': 1581499557.7017336,
  236. 'evaluation_lineage': {
  237. 'metric': json.dumps(METRIC_1),
  238. 'valid_dataset': {
  239. 'valid_dataset_path': '/path/to/valid_dataset1',
  240. 'valid_dataset_size': 400716931
  241. }
  242. }
  243. }
  244. EVENT_EVAL_DICT_2 = {
  245. 'wall_time': 1581499557.7017336,
  246. 'evaluation_lineage': {
  247. 'metric': json.dumps(METRIC_2),
  248. 'valid_dataset': {
  249. 'valid_dataset_path': '/path/to/valid_dataset2',
  250. 'valid_dataset_size': 400716931
  251. }
  252. }
  253. }
  254. EVENT_EVAL_DICT_3 = {
  255. 'wall_time': 1581499557.7017336,
  256. 'evaluation_lineage': {
  257. 'metric': json.dumps(METRIC_3),
  258. 'valid_dataset': {
  259. 'valid_dataset_path': '/path/to/valid_dataset3',
  260. 'valid_dataset_size': 400716931
  261. }
  262. }
  263. }
  264. EVENT_EVAL_DICT_4 = {
  265. 'wall_time': 1581499557.7017336,
  266. 'evaluation_lineage': {
  267. 'metric': json.dumps(METRIC_4),
  268. 'valid_dataset': {
  269. 'valid_dataset_path': '/path/to/valid_dataset4',
  270. 'valid_dataset_size': 400716931
  271. }
  272. }
  273. }
  274. EVENT_EVAL_DICT_5 = {
  275. 'wall_time': 1581499557.7017336,
  276. 'evaluation_lineage': {
  277. 'metric': json.dumps(METRIC_5),
  278. 'valid_dataset': {
  279. 'valid_dataset_path': '/path/to/valid_dataset5',
  280. 'valid_dataset_size': 400716931
  281. }
  282. }
  283. }
  284. EVENT_EVAL_DICT_EXCEPTION = {
  285. 'wall_time': 1581499557.7017336
  286. }
  287. EVENT_DATASET_DICT_0 = {
  288. 'wall_time': 1583317727.4949381,
  289. 'dataset_graph': {
  290. 'children': [
  291. {
  292. 'children': [
  293. {
  294. 'parameter': {
  295. 'mapStr': {
  296. 'op_type': 'MnistDataset',
  297. 'shard_id': 'None',
  298. 'num_shards': 'None',
  299. 'op_module': 'minddata.dataengine.datasets',
  300. 'dataset_dir': '/home/anthony/MindData/tests/dataset/data/testMnistData',
  301. 'num_parallel_workers': 'None',
  302. 'shuffle': 'None'
  303. },
  304. 'mapInt': {
  305. 'num_samples': 100
  306. }
  307. },
  308. 'sampler': {
  309. 'operationParam': {
  310. 'mapStr': {
  311. 'sampler_name': 'RandomSampler',
  312. 'sampler_module': 'minddata.dataengine.samplers'
  313. },
  314. 'mapBool': {
  315. 'replacement': True
  316. },
  317. 'mapInt': {
  318. 'num_samples': 100
  319. }
  320. }
  321. }
  322. }
  323. ],
  324. 'parameter': {
  325. 'mapStr': {
  326. 'op_module': 'minddata.dataengine.datasets',
  327. 'op_type': 'MapDataset',
  328. 'num_parallel_workers': 'None'
  329. },
  330. 'mapStrList': {
  331. 'output_columns': {
  332. 'strValue': [
  333. ''
  334. ]
  335. },
  336. 'input_columns': {
  337. 'strValue': [
  338. 'label'
  339. ]
  340. }
  341. }
  342. },
  343. 'operations': [
  344. {
  345. 'operationParam': {
  346. 'mapStr': {
  347. 'tensor_op_module': 'minddata.transforms.c_transforms',
  348. 'tensor_op_name': 'OneHot'
  349. },
  350. 'mapInt': {
  351. 'num_classes': 10
  352. }
  353. }
  354. }
  355. ]
  356. }
  357. ],
  358. 'parameter': {
  359. 'mapStr': {
  360. 'op_module': 'minddata.dataengine.datasets',
  361. 'op_type': 'BatchDataset',
  362. 'num_parallel_workers': 'None'
  363. },
  364. 'mapBool': {
  365. 'drop_remainder': True
  366. },
  367. 'mapInt': {
  368. 'batch_size': 10
  369. }
  370. }
  371. }
  372. }
  373. DATASET_DICT_0 = SERIALIZED_PIPELINE

MindInsight为MindSpore提供了简单易用的调优调试能力。在训练过程中,可以将标量、张量、图像、计算图、模型超参、训练耗时等数据记录到文件中,通过MindInsight可视化页面进行查看及分析。