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

5 years ago
5 years ago
5 years ago
5 years ago
5 years ago
5 years ago
5 years ago
5 years ago
5 years ago
5 years ago
5 years ago
5 years ago
5 years ago
5 years ago
5 years ago
5 years ago
5 years ago
5 years ago
123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407
  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.11,
  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.3025841
  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.2100001,
  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.4025841
  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.3100001,
  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.5025841
  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.4,
  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.6025841
  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.7025841
  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.7025841
  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__1 = {
  185. **CUSTOMIZED__0,
  186. 'user_defined/info': {'label': 'user_defined/info', 'required': False, 'type': 'str'},
  187. 'user_defined/version': {'label': 'user_defined/version', 'required': False, 'type': 'str'},
  188. 'user_defined/eval_version': {'label': 'user_defined/eval_version', 'required': False, 'type': 'str'}
  189. }
  190. CUSTOMIZED_0 = {
  191. **CUSTOMIZED__0,
  192. 'metric/mae': {'label': 'metric/mae', 'required': True, 'type': 'float'},
  193. 'metric/mse': {'label': 'metric/mse', 'required': True, 'type': 'float'}
  194. }
  195. CUSTOMIZED_1 = {
  196. 'metric/accuracy': {'label': 'metric/accuracy', 'required': True, 'type': 'NoneType'},
  197. 'metric/mae': {'label': 'metric/mae', 'required': True, 'type': 'float'},
  198. 'metric/mse': {'label': 'metric/mse', 'required': True, 'type': 'float'}
  199. }
  200. CUSTOMIZED_2 = {
  201. 'metric/accuracy': {'label': 'metric/accuracy', 'required': True, 'type': 'mixed'},
  202. 'metric/mae': {'label': 'metric/mae', 'required': True, 'type': 'float'},
  203. 'metric/mse': {'label': 'metric/mse', 'required': True, 'type': 'float'}
  204. }
  205. METRIC_1 = {
  206. 'accuracy': 1.2000002,
  207. 'mae': 2.00000002,
  208. 'mse': 3.00000002
  209. }
  210. METRIC_2 = {
  211. 'accuracy': 1.3000003,
  212. 'mae': 2.30000003,
  213. 'mse': 3.30000003
  214. }
  215. METRIC_3 = {
  216. 'accuracy': 1.4000004,
  217. 'mae': 2.40000004,
  218. 'mse': 3.40000004
  219. }
  220. METRIC_4 = {
  221. 'accuracy': 1.5000005,
  222. 'mae': 2.50000005,
  223. 'mse': 3.50000005
  224. }
  225. METRIC_5 = {
  226. 'accuracy': 1.7000006,
  227. 'mae': 2.60000006,
  228. 'mse': 3.60000006
  229. }
  230. EVENT_EVAL_DICT_0 = {
  231. 'wall_time': 1581499557.7017336,
  232. 'evaluation_lineage': {
  233. 'metric': json.dumps(METRIC_0),
  234. 'valid_dataset': {
  235. 'valid_dataset_path': '',
  236. 'valid_dataset_size': 400716931
  237. }
  238. }
  239. }
  240. EVENT_EVAL_DICT_1 = {
  241. 'wall_time': 1581499557.7017336,
  242. 'evaluation_lineage': {
  243. 'metric': json.dumps(METRIC_1),
  244. 'valid_dataset': {
  245. 'valid_dataset_path': '/path/to/valid_dataset1',
  246. 'valid_dataset_size': 400716931
  247. }
  248. }
  249. }
  250. EVENT_EVAL_DICT_2 = {
  251. 'wall_time': 1581499557.7017336,
  252. 'evaluation_lineage': {
  253. 'metric': json.dumps(METRIC_2),
  254. 'valid_dataset': {
  255. 'valid_dataset_path': '/path/to/valid_dataset2',
  256. 'valid_dataset_size': 400716931
  257. }
  258. }
  259. }
  260. EVENT_EVAL_DICT_3 = {
  261. 'wall_time': 1581499557.7017336,
  262. 'evaluation_lineage': {
  263. 'metric': json.dumps(METRIC_3),
  264. 'valid_dataset': {
  265. 'valid_dataset_path': '/path/to/valid_dataset3',
  266. 'valid_dataset_size': 400716931
  267. }
  268. }
  269. }
  270. EVENT_EVAL_DICT_4 = {
  271. 'wall_time': 1581499557.7017336,
  272. 'evaluation_lineage': {
  273. 'metric': json.dumps(METRIC_4),
  274. 'valid_dataset': {
  275. 'valid_dataset_path': '/path/to/valid_dataset4',
  276. 'valid_dataset_size': 400716931
  277. }
  278. }
  279. }
  280. EVENT_EVAL_DICT_5 = {
  281. 'wall_time': 1581499557.7017336,
  282. 'evaluation_lineage': {
  283. 'metric': json.dumps(METRIC_5),
  284. 'valid_dataset': {
  285. 'valid_dataset_path': '/path/to/valid_dataset5',
  286. 'valid_dataset_size': 400716931
  287. }
  288. }
  289. }
  290. EVENT_EVAL_DICT_EXCEPTION = {
  291. 'wall_time': 1581499557.7017336
  292. }
  293. EVENT_DATASET_DICT_0 = {
  294. 'wall_time': 1583317727.4949381,
  295. 'dataset_graph': {
  296. 'children': [
  297. {
  298. 'children': [
  299. {
  300. 'parameter': {
  301. 'mapStr': {
  302. 'op_type': 'MnistDataset',
  303. 'shard_id': 'None',
  304. 'num_shards': 'None',
  305. 'op_module': 'minddata.dataengine.datasets',
  306. 'dataset_dir': '/home/anthony/MindData/tests/dataset/data/testMnistData',
  307. 'num_parallel_workers': 'None',
  308. 'shuffle': 'None'
  309. },
  310. 'mapInt': {
  311. 'num_samples': 100
  312. }
  313. },
  314. 'sampler': {
  315. 'operationParam': {
  316. 'mapStr': {
  317. 'sampler_name': 'RandomSampler',
  318. 'sampler_module': 'minddata.dataengine.samplers'
  319. },
  320. 'mapBool': {
  321. 'replacement': True
  322. },
  323. 'mapInt': {
  324. 'num_samples': 100
  325. }
  326. }
  327. }
  328. }
  329. ],
  330. 'parameter': {
  331. 'mapStr': {
  332. 'op_module': 'minddata.dataengine.datasets',
  333. 'op_type': 'MapDataset',
  334. 'num_parallel_workers': 'None'
  335. },
  336. 'mapStrList': {
  337. 'output_columns': {
  338. 'strValue': [
  339. ''
  340. ]
  341. },
  342. 'input_columns': {
  343. 'strValue': [
  344. 'label'
  345. ]
  346. }
  347. }
  348. },
  349. 'operations': [
  350. {
  351. 'operationParam': {
  352. 'mapStr': {
  353. 'tensor_op_module': 'minddata.transforms.c_transforms',
  354. 'tensor_op_name': 'OneHot'
  355. },
  356. 'mapInt': {
  357. 'num_classes': 10
  358. }
  359. }
  360. }
  361. ]
  362. }
  363. ],
  364. 'parameter': {
  365. 'mapStr': {
  366. 'op_module': 'minddata.dataengine.datasets',
  367. 'op_type': 'BatchDataset',
  368. 'num_parallel_workers': 'None'
  369. },
  370. 'mapBool': {
  371. 'drop_remainder': True
  372. },
  373. 'mapInt': {
  374. 'batch_size': 10
  375. }
  376. }
  377. }
  378. }
  379. DATASET_DICT_0 = SERIALIZED_PIPELINE