@epfml/discojs 2.1.1 → 2.1.2-p20240506085037.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (334) hide show
  1. package/dist/aggregator/base.d.ts +180 -0
  2. package/dist/aggregator/base.js +236 -0
  3. package/dist/aggregator/get.d.ts +16 -0
  4. package/dist/aggregator/get.js +31 -0
  5. package/dist/aggregator/index.d.ts +7 -0
  6. package/dist/aggregator/index.js +4 -0
  7. package/dist/aggregator/mean.d.ts +23 -0
  8. package/dist/aggregator/mean.js +69 -0
  9. package/dist/aggregator/secure.d.ts +27 -0
  10. package/dist/aggregator/secure.js +91 -0
  11. package/dist/async_informant.d.ts +15 -0
  12. package/dist/async_informant.js +42 -0
  13. package/dist/client/base.d.ts +76 -0
  14. package/dist/client/base.js +88 -0
  15. package/dist/client/decentralized/base.d.ts +32 -0
  16. package/dist/client/decentralized/base.js +192 -0
  17. package/dist/client/decentralized/index.d.ts +2 -0
  18. package/dist/client/decentralized/index.js +2 -0
  19. package/dist/client/decentralized/messages.d.ts +28 -0
  20. package/dist/client/decentralized/messages.js +44 -0
  21. package/dist/client/decentralized/peer.d.ts +40 -0
  22. package/dist/client/decentralized/peer.js +189 -0
  23. package/dist/client/decentralized/peer_pool.d.ts +12 -0
  24. package/dist/client/decentralized/peer_pool.js +44 -0
  25. package/dist/client/event_connection.d.ts +34 -0
  26. package/dist/client/event_connection.js +105 -0
  27. package/dist/client/federated/base.d.ts +54 -0
  28. package/dist/client/federated/base.js +151 -0
  29. package/dist/client/federated/index.d.ts +2 -0
  30. package/dist/client/federated/index.js +2 -0
  31. package/dist/client/federated/messages.d.ts +30 -0
  32. package/dist/client/federated/messages.js +24 -0
  33. package/dist/client/index.d.ts +8 -0
  34. package/dist/client/index.js +8 -0
  35. package/dist/client/local.d.ts +3 -0
  36. package/dist/client/local.js +3 -0
  37. package/dist/client/messages.d.ts +30 -0
  38. package/dist/client/messages.js +26 -0
  39. package/dist/client/types.d.ts +2 -0
  40. package/dist/client/types.js +4 -0
  41. package/dist/client/utils.d.ts +2 -0
  42. package/dist/client/utils.js +7 -0
  43. package/dist/dataset/data/data.d.ts +48 -0
  44. package/dist/dataset/data/data.js +72 -0
  45. package/dist/dataset/data/data_split.d.ts +8 -0
  46. package/dist/dataset/data/data_split.js +1 -0
  47. package/dist/dataset/data/image_data.d.ts +11 -0
  48. package/dist/dataset/data/image_data.js +38 -0
  49. package/dist/dataset/data/index.d.ts +6 -0
  50. package/dist/dataset/data/index.js +5 -0
  51. package/dist/dataset/data/preprocessing/base.d.ts +16 -0
  52. package/dist/dataset/data/preprocessing/base.js +1 -0
  53. package/dist/dataset/data/preprocessing/image_preprocessing.d.ts +13 -0
  54. package/dist/dataset/data/preprocessing/image_preprocessing.js +40 -0
  55. package/dist/dataset/data/preprocessing/index.d.ts +4 -0
  56. package/dist/dataset/data/preprocessing/index.js +3 -0
  57. package/dist/dataset/data/preprocessing/tabular_preprocessing.d.ts +13 -0
  58. package/dist/dataset/data/preprocessing/tabular_preprocessing.js +45 -0
  59. package/dist/dataset/data/preprocessing/text_preprocessing.d.ts +13 -0
  60. package/dist/dataset/data/preprocessing/text_preprocessing.js +85 -0
  61. package/dist/dataset/data/tabular_data.d.ts +11 -0
  62. package/dist/dataset/data/tabular_data.js +25 -0
  63. package/dist/dataset/data/text_data.d.ts +11 -0
  64. package/dist/dataset/data/text_data.js +14 -0
  65. package/dist/{core/dataset → dataset}/data_loader/data_loader.d.ts +3 -5
  66. package/dist/dataset/data_loader/data_loader.js +2 -0
  67. package/dist/dataset/data_loader/image_loader.d.ts +20 -3
  68. package/dist/dataset/data_loader/image_loader.js +98 -23
  69. package/dist/dataset/data_loader/index.d.ts +5 -2
  70. package/dist/dataset/data_loader/index.js +4 -7
  71. package/dist/dataset/data_loader/tabular_loader.d.ts +34 -3
  72. package/dist/dataset/data_loader/tabular_loader.js +75 -15
  73. package/dist/dataset/data_loader/text_loader.d.ts +14 -0
  74. package/dist/dataset/data_loader/text_loader.js +25 -0
  75. package/dist/dataset/dataset.d.ts +5 -0
  76. package/dist/dataset/dataset.js +1 -0
  77. package/dist/dataset/dataset_builder.d.ts +60 -0
  78. package/dist/dataset/dataset_builder.js +142 -0
  79. package/dist/dataset/index.d.ts +5 -0
  80. package/dist/dataset/index.js +3 -0
  81. package/dist/default_tasks/cifar10/index.d.ts +2 -0
  82. package/dist/{core/default_tasks/cifar10.js → default_tasks/cifar10/index.js} +28 -36
  83. package/dist/default_tasks/cifar10/model.d.ts +434 -0
  84. package/dist/default_tasks/cifar10/model.js +2385 -0
  85. package/dist/default_tasks/geotags/index.d.ts +2 -0
  86. package/dist/default_tasks/geotags/index.js +65 -0
  87. package/dist/default_tasks/geotags/model.d.ts +593 -0
  88. package/dist/default_tasks/geotags/model.js +4715 -0
  89. package/dist/default_tasks/index.d.ts +8 -0
  90. package/dist/default_tasks/index.js +8 -0
  91. package/dist/default_tasks/lus_covid.d.ts +2 -0
  92. package/dist/default_tasks/lus_covid.js +89 -0
  93. package/dist/default_tasks/mnist.d.ts +2 -0
  94. package/dist/{core/default_tasks → default_tasks}/mnist.js +26 -34
  95. package/dist/default_tasks/simple_face/index.d.ts +2 -0
  96. package/dist/{core/default_tasks/simple_face.js → default_tasks/simple_face/index.js} +17 -22
  97. package/dist/default_tasks/simple_face/model.d.ts +513 -0
  98. package/dist/default_tasks/simple_face/model.js +4301 -0
  99. package/dist/default_tasks/skin_mnist.d.ts +2 -0
  100. package/dist/default_tasks/skin_mnist.js +80 -0
  101. package/dist/default_tasks/titanic.d.ts +2 -0
  102. package/dist/{core/default_tasks → default_tasks}/titanic.js +24 -33
  103. package/dist/default_tasks/wikitext.d.ts +2 -0
  104. package/dist/default_tasks/wikitext.js +38 -0
  105. package/dist/index.d.ts +18 -2
  106. package/dist/index.js +18 -6
  107. package/dist/{core/informant → informant}/graph_informant.d.ts +1 -1
  108. package/dist/informant/graph_informant.js +20 -0
  109. package/dist/informant/index.d.ts +1 -0
  110. package/dist/informant/index.js +1 -0
  111. package/dist/{core/logging → logging}/console_logger.d.ts +2 -2
  112. package/dist/logging/console_logger.js +22 -0
  113. package/dist/logging/index.d.ts +2 -0
  114. package/dist/logging/index.js +1 -0
  115. package/dist/{core/logging → logging}/logger.d.ts +3 -3
  116. package/dist/logging/logger.js +1 -0
  117. package/dist/memory/base.d.ts +119 -0
  118. package/dist/memory/base.js +9 -0
  119. package/dist/memory/empty.d.ts +20 -0
  120. package/dist/memory/empty.js +43 -0
  121. package/dist/memory/index.d.ts +3 -1
  122. package/dist/memory/index.js +3 -5
  123. package/dist/memory/model_type.d.ts +9 -0
  124. package/dist/memory/model_type.js +10 -0
  125. package/dist/{core/privacy.d.ts → privacy.d.ts} +1 -1
  126. package/dist/{core/privacy.js → privacy.js} +11 -16
  127. package/dist/serialization/index.d.ts +2 -0
  128. package/dist/serialization/index.js +2 -0
  129. package/dist/serialization/model.d.ts +5 -0
  130. package/dist/serialization/model.js +67 -0
  131. package/dist/{core/serialization → serialization}/weights.d.ts +2 -2
  132. package/dist/serialization/weights.js +37 -0
  133. package/dist/task/data_example.js +14 -0
  134. package/dist/task/digest.js +14 -0
  135. package/dist/{core/task → task}/display_information.d.ts +5 -3
  136. package/dist/task/display_information.js +46 -0
  137. package/dist/task/index.d.ts +7 -0
  138. package/dist/task/index.js +5 -0
  139. package/dist/task/label_type.d.ts +9 -0
  140. package/dist/task/label_type.js +28 -0
  141. package/dist/task/summary.js +13 -0
  142. package/dist/{core/task → task}/task.d.ts +7 -7
  143. package/dist/task/task.js +22 -0
  144. package/dist/task/task_handler.d.ts +5 -0
  145. package/dist/task/task_handler.js +20 -0
  146. package/dist/task/task_provider.d.ts +5 -0
  147. package/dist/task/task_provider.js +1 -0
  148. package/dist/{core/task → task}/training_information.d.ts +9 -10
  149. package/dist/task/training_information.js +88 -0
  150. package/dist/training/disco.d.ts +40 -0
  151. package/dist/training/disco.js +107 -0
  152. package/dist/training/index.d.ts +2 -0
  153. package/dist/training/index.js +1 -0
  154. package/dist/training/trainer/distributed_trainer.d.ts +20 -0
  155. package/dist/training/trainer/distributed_trainer.js +36 -0
  156. package/dist/training/trainer/local_trainer.d.ts +12 -0
  157. package/dist/training/trainer/local_trainer.js +19 -0
  158. package/dist/training/trainer/trainer.d.ts +33 -0
  159. package/dist/training/trainer/trainer.js +52 -0
  160. package/dist/{core/training → training}/trainer/trainer_builder.d.ts +5 -7
  161. package/dist/training/trainer/trainer_builder.js +43 -0
  162. package/dist/types.d.ts +8 -0
  163. package/dist/types.js +1 -0
  164. package/dist/utils/event_emitter.d.ts +40 -0
  165. package/dist/utils/event_emitter.js +57 -0
  166. package/dist/validation/index.d.ts +1 -0
  167. package/dist/validation/index.js +1 -0
  168. package/dist/validation/validator.d.ts +28 -0
  169. package/dist/validation/validator.js +132 -0
  170. package/dist/weights/aggregation.d.ts +21 -0
  171. package/dist/weights/aggregation.js +44 -0
  172. package/dist/weights/index.d.ts +2 -0
  173. package/dist/weights/index.js +2 -0
  174. package/dist/weights/weights_container.d.ts +68 -0
  175. package/dist/weights/weights_container.js +96 -0
  176. package/package.json +24 -15
  177. package/README.md +0 -53
  178. package/dist/core/async_buffer.d.ts +0 -41
  179. package/dist/core/async_buffer.js +0 -97
  180. package/dist/core/async_informant.d.ts +0 -20
  181. package/dist/core/async_informant.js +0 -69
  182. package/dist/core/client/base.d.ts +0 -33
  183. package/dist/core/client/base.js +0 -35
  184. package/dist/core/client/decentralized/base.d.ts +0 -32
  185. package/dist/core/client/decentralized/base.js +0 -212
  186. package/dist/core/client/decentralized/clear_text.d.ts +0 -14
  187. package/dist/core/client/decentralized/clear_text.js +0 -96
  188. package/dist/core/client/decentralized/index.d.ts +0 -4
  189. package/dist/core/client/decentralized/index.js +0 -9
  190. package/dist/core/client/decentralized/messages.d.ts +0 -41
  191. package/dist/core/client/decentralized/messages.js +0 -54
  192. package/dist/core/client/decentralized/peer.d.ts +0 -26
  193. package/dist/core/client/decentralized/peer.js +0 -210
  194. package/dist/core/client/decentralized/peer_pool.d.ts +0 -14
  195. package/dist/core/client/decentralized/peer_pool.js +0 -92
  196. package/dist/core/client/decentralized/sec_agg.d.ts +0 -22
  197. package/dist/core/client/decentralized/sec_agg.js +0 -190
  198. package/dist/core/client/decentralized/secret_shares.d.ts +0 -3
  199. package/dist/core/client/decentralized/secret_shares.js +0 -39
  200. package/dist/core/client/decentralized/types.d.ts +0 -2
  201. package/dist/core/client/decentralized/types.js +0 -7
  202. package/dist/core/client/event_connection.d.ts +0 -37
  203. package/dist/core/client/event_connection.js +0 -158
  204. package/dist/core/client/federated/client.d.ts +0 -37
  205. package/dist/core/client/federated/client.js +0 -273
  206. package/dist/core/client/federated/index.d.ts +0 -2
  207. package/dist/core/client/federated/index.js +0 -7
  208. package/dist/core/client/federated/messages.d.ts +0 -38
  209. package/dist/core/client/federated/messages.js +0 -25
  210. package/dist/core/client/index.d.ts +0 -5
  211. package/dist/core/client/index.js +0 -11
  212. package/dist/core/client/local.d.ts +0 -8
  213. package/dist/core/client/local.js +0 -36
  214. package/dist/core/client/messages.d.ts +0 -28
  215. package/dist/core/client/messages.js +0 -33
  216. package/dist/core/client/utils.d.ts +0 -2
  217. package/dist/core/client/utils.js +0 -19
  218. package/dist/core/dataset/data/data.d.ts +0 -11
  219. package/dist/core/dataset/data/data.js +0 -20
  220. package/dist/core/dataset/data/data_split.d.ts +0 -5
  221. package/dist/core/dataset/data/data_split.js +0 -2
  222. package/dist/core/dataset/data/image_data.d.ts +0 -8
  223. package/dist/core/dataset/data/image_data.js +0 -64
  224. package/dist/core/dataset/data/index.d.ts +0 -5
  225. package/dist/core/dataset/data/index.js +0 -11
  226. package/dist/core/dataset/data/preprocessing.d.ts +0 -13
  227. package/dist/core/dataset/data/preprocessing.js +0 -33
  228. package/dist/core/dataset/data/tabular_data.d.ts +0 -8
  229. package/dist/core/dataset/data/tabular_data.js +0 -40
  230. package/dist/core/dataset/data_loader/data_loader.js +0 -10
  231. package/dist/core/dataset/data_loader/image_loader.d.ts +0 -17
  232. package/dist/core/dataset/data_loader/image_loader.js +0 -141
  233. package/dist/core/dataset/data_loader/index.d.ts +0 -3
  234. package/dist/core/dataset/data_loader/index.js +0 -9
  235. package/dist/core/dataset/data_loader/tabular_loader.d.ts +0 -29
  236. package/dist/core/dataset/data_loader/tabular_loader.js +0 -101
  237. package/dist/core/dataset/dataset.d.ts +0 -2
  238. package/dist/core/dataset/dataset.js +0 -2
  239. package/dist/core/dataset/dataset_builder.d.ts +0 -18
  240. package/dist/core/dataset/dataset_builder.js +0 -96
  241. package/dist/core/dataset/index.d.ts +0 -4
  242. package/dist/core/dataset/index.js +0 -14
  243. package/dist/core/default_tasks/cifar10.d.ts +0 -2
  244. package/dist/core/default_tasks/geotags.d.ts +0 -2
  245. package/dist/core/default_tasks/geotags.js +0 -69
  246. package/dist/core/default_tasks/index.d.ts +0 -6
  247. package/dist/core/default_tasks/index.js +0 -15
  248. package/dist/core/default_tasks/lus_covid.d.ts +0 -2
  249. package/dist/core/default_tasks/lus_covid.js +0 -96
  250. package/dist/core/default_tasks/mnist.d.ts +0 -2
  251. package/dist/core/default_tasks/simple_face.d.ts +0 -2
  252. package/dist/core/default_tasks/titanic.d.ts +0 -2
  253. package/dist/core/index.d.ts +0 -18
  254. package/dist/core/index.js +0 -39
  255. package/dist/core/informant/graph_informant.js +0 -23
  256. package/dist/core/informant/index.d.ts +0 -3
  257. package/dist/core/informant/index.js +0 -9
  258. package/dist/core/informant/training_informant/base.d.ts +0 -31
  259. package/dist/core/informant/training_informant/base.js +0 -83
  260. package/dist/core/informant/training_informant/decentralized.d.ts +0 -5
  261. package/dist/core/informant/training_informant/decentralized.js +0 -22
  262. package/dist/core/informant/training_informant/federated.d.ts +0 -14
  263. package/dist/core/informant/training_informant/federated.js +0 -32
  264. package/dist/core/informant/training_informant/index.d.ts +0 -4
  265. package/dist/core/informant/training_informant/index.js +0 -11
  266. package/dist/core/informant/training_informant/local.d.ts +0 -6
  267. package/dist/core/informant/training_informant/local.js +0 -20
  268. package/dist/core/logging/console_logger.js +0 -33
  269. package/dist/core/logging/index.d.ts +0 -3
  270. package/dist/core/logging/index.js +0 -9
  271. package/dist/core/logging/logger.js +0 -9
  272. package/dist/core/logging/trainer_logger.d.ts +0 -24
  273. package/dist/core/logging/trainer_logger.js +0 -59
  274. package/dist/core/memory/base.d.ts +0 -22
  275. package/dist/core/memory/base.js +0 -9
  276. package/dist/core/memory/empty.d.ts +0 -14
  277. package/dist/core/memory/empty.js +0 -75
  278. package/dist/core/memory/index.d.ts +0 -3
  279. package/dist/core/memory/index.js +0 -9
  280. package/dist/core/memory/model_type.d.ts +0 -4
  281. package/dist/core/memory/model_type.js +0 -9
  282. package/dist/core/serialization/index.d.ts +0 -2
  283. package/dist/core/serialization/index.js +0 -6
  284. package/dist/core/serialization/model.d.ts +0 -5
  285. package/dist/core/serialization/model.js +0 -55
  286. package/dist/core/serialization/weights.js +0 -64
  287. package/dist/core/task/data_example.js +0 -24
  288. package/dist/core/task/digest.js +0 -18
  289. package/dist/core/task/display_information.js +0 -49
  290. package/dist/core/task/index.d.ts +0 -6
  291. package/dist/core/task/index.js +0 -15
  292. package/dist/core/task/model_compile_data.d.ts +0 -6
  293. package/dist/core/task/model_compile_data.js +0 -22
  294. package/dist/core/task/summary.js +0 -19
  295. package/dist/core/task/task.js +0 -35
  296. package/dist/core/task/task_handler.d.ts +0 -5
  297. package/dist/core/task/task_handler.js +0 -53
  298. package/dist/core/task/task_provider.d.ts +0 -6
  299. package/dist/core/task/task_provider.js +0 -13
  300. package/dist/core/task/training_information.js +0 -66
  301. package/dist/core/training/disco.d.ts +0 -23
  302. package/dist/core/training/disco.js +0 -130
  303. package/dist/core/training/index.d.ts +0 -2
  304. package/dist/core/training/index.js +0 -7
  305. package/dist/core/training/trainer/distributed_trainer.d.ts +0 -20
  306. package/dist/core/training/trainer/distributed_trainer.js +0 -65
  307. package/dist/core/training/trainer/local_trainer.d.ts +0 -11
  308. package/dist/core/training/trainer/local_trainer.js +0 -34
  309. package/dist/core/training/trainer/round_tracker.d.ts +0 -30
  310. package/dist/core/training/trainer/round_tracker.js +0 -47
  311. package/dist/core/training/trainer/trainer.d.ts +0 -65
  312. package/dist/core/training/trainer/trainer.js +0 -160
  313. package/dist/core/training/trainer/trainer_builder.js +0 -95
  314. package/dist/core/training/training_schemes.d.ts +0 -5
  315. package/dist/core/training/training_schemes.js +0 -10
  316. package/dist/core/types.d.ts +0 -4
  317. package/dist/core/types.js +0 -2
  318. package/dist/core/validation/index.d.ts +0 -1
  319. package/dist/core/validation/index.js +0 -5
  320. package/dist/core/validation/validator.d.ts +0 -17
  321. package/dist/core/validation/validator.js +0 -104
  322. package/dist/core/weights/aggregation.d.ts +0 -7
  323. package/dist/core/weights/aggregation.js +0 -72
  324. package/dist/core/weights/index.d.ts +0 -2
  325. package/dist/core/weights/index.js +0 -7
  326. package/dist/core/weights/weights_container.d.ts +0 -19
  327. package/dist/core/weights/weights_container.js +0 -64
  328. package/dist/imports.d.ts +0 -2
  329. package/dist/imports.js +0 -7
  330. package/dist/memory/memory.d.ts +0 -26
  331. package/dist/memory/memory.js +0 -160
  332. package/dist/{core/task → task}/data_example.d.ts +1 -1
  333. package/dist/{core/task → task}/digest.d.ts +0 -0
  334. package/dist/{core/task → task}/summary.d.ts +1 -1
@@ -1,14 +0,0 @@
1
- import { tf } from '..';
2
- import { Memory, ModelInfo, Path } from './base';
3
- export declare class Empty extends Memory {
4
- getModelMetadata(): Promise<undefined>;
5
- contains(): Promise<boolean>;
6
- getModel(): Promise<tf.LayersModel>;
7
- loadModel(): Promise<void>;
8
- updateWorkingModel(): Promise<void>;
9
- saveWorkingModel(): Promise<void>;
10
- deleteModel(): Promise<void>;
11
- downloadModel(): Promise<void>;
12
- pathFor(): Path;
13
- infoFor(): ModelInfo;
14
- }
@@ -1,75 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.Empty = void 0;
4
- var tslib_1 = require("tslib");
5
- var base_1 = require("./base");
6
- var Empty = /** @class */ (function (_super) {
7
- (0, tslib_1.__extends)(Empty, _super);
8
- function Empty() {
9
- return _super !== null && _super.apply(this, arguments) || this;
10
- }
11
- Empty.prototype.getModelMetadata = function () {
12
- return (0, tslib_1.__awaiter)(this, void 0, void 0, function () {
13
- return (0, tslib_1.__generator)(this, function (_a) {
14
- return [2 /*return*/, undefined];
15
- });
16
- });
17
- };
18
- Empty.prototype.contains = function () {
19
- return (0, tslib_1.__awaiter)(this, void 0, void 0, function () {
20
- return (0, tslib_1.__generator)(this, function (_a) {
21
- return [2 /*return*/, false];
22
- });
23
- });
24
- };
25
- Empty.prototype.getModel = function () {
26
- return (0, tslib_1.__awaiter)(this, void 0, void 0, function () {
27
- return (0, tslib_1.__generator)(this, function (_a) {
28
- throw new Error('empty');
29
- });
30
- });
31
- };
32
- Empty.prototype.loadModel = function () {
33
- return (0, tslib_1.__awaiter)(this, void 0, void 0, function () {
34
- return (0, tslib_1.__generator)(this, function (_a) {
35
- throw new Error('empty');
36
- });
37
- });
38
- };
39
- Empty.prototype.updateWorkingModel = function () {
40
- return (0, tslib_1.__awaiter)(this, void 0, void 0, function () {
41
- return (0, tslib_1.__generator)(this, function (_a) {
42
- return [2 /*return*/];
43
- });
44
- });
45
- };
46
- Empty.prototype.saveWorkingModel = function () {
47
- return (0, tslib_1.__awaiter)(this, void 0, void 0, function () {
48
- return (0, tslib_1.__generator)(this, function (_a) {
49
- return [2 /*return*/];
50
- });
51
- });
52
- };
53
- Empty.prototype.deleteModel = function () {
54
- return (0, tslib_1.__awaiter)(this, void 0, void 0, function () {
55
- return (0, tslib_1.__generator)(this, function (_a) {
56
- return [2 /*return*/];
57
- });
58
- });
59
- };
60
- Empty.prototype.downloadModel = function () {
61
- return (0, tslib_1.__awaiter)(this, void 0, void 0, function () {
62
- return (0, tslib_1.__generator)(this, function (_a) {
63
- throw new Error('empty');
64
- });
65
- });
66
- };
67
- Empty.prototype.pathFor = function () {
68
- throw new Error('empty');
69
- };
70
- Empty.prototype.infoFor = function () {
71
- throw new Error('empty');
72
- };
73
- return Empty;
74
- }(base_1.Memory));
75
- exports.Empty = Empty;
@@ -1,3 +0,0 @@
1
- export { Empty } from './empty';
2
- export { Memory, ModelInfo, Path, ModelSource } from './base';
3
- export { ModelType } from './model_type';
@@ -1,9 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.ModelType = exports.Memory = exports.Empty = void 0;
4
- var empty_1 = require("./empty");
5
- Object.defineProperty(exports, "Empty", { enumerable: true, get: function () { return empty_1.Empty; } });
6
- var base_1 = require("./base");
7
- Object.defineProperty(exports, "Memory", { enumerable: true, get: function () { return base_1.Memory; } });
8
- var model_type_1 = require("./model_type");
9
- Object.defineProperty(exports, "ModelType", { enumerable: true, get: function () { return model_type_1.ModelType; } });
@@ -1,4 +0,0 @@
1
- export declare enum ModelType {
2
- WORKING = "working",
3
- SAVED = "saved"
4
- }
@@ -1,9 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.ModelType = void 0;
4
- // Type of model to store & retrieve
5
- var ModelType;
6
- (function (ModelType) {
7
- ModelType["WORKING"] = "working";
8
- ModelType["SAVED"] = "saved";
9
- })(ModelType = exports.ModelType || (exports.ModelType = {}));
@@ -1,2 +0,0 @@
1
- export * as model from './model';
2
- export * as weights from './weights';
@@ -1,6 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.weights = exports.model = void 0;
4
- var tslib_1 = require("tslib");
5
- exports.model = (0, tslib_1.__importStar)(require("./model"));
6
- exports.weights = (0, tslib_1.__importStar)(require("./weights"));
@@ -1,5 +0,0 @@
1
- import { tf } from '..';
2
- export declare type Encoded = number[];
3
- export declare function isEncoded(raw: unknown): raw is Encoded;
4
- export declare function encode(model: tf.LayersModel): Promise<Encoded>;
5
- export declare function decode(encoded: Encoded): Promise<tf.LayersModel>;
@@ -1,55 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.decode = exports.encode = exports.isEncoded = void 0;
4
- var tslib_1 = require("tslib");
5
- var __1 = require("..");
6
- var msgpack_lite_1 = (0, tslib_1.__importDefault)(require("msgpack-lite"));
7
- function isEncoded(raw) {
8
- return Array.isArray(raw) && raw.every(function (r) { return typeof r === 'number'; });
9
- }
10
- exports.isEncoded = isEncoded;
11
- function encode(model) {
12
- return (0, tslib_1.__awaiter)(this, void 0, void 0, function () {
13
- var saved;
14
- var _this = this;
15
- return (0, tslib_1.__generator)(this, function (_a) {
16
- switch (_a.label) {
17
- case 0: return [4 /*yield*/, new Promise(function (resolve) {
18
- void model.save({
19
- save: function (artifacts) { return (0, tslib_1.__awaiter)(_this, void 0, void 0, function () {
20
- return (0, tslib_1.__generator)(this, function (_a) {
21
- resolve(artifacts);
22
- return [2 /*return*/, {
23
- modelArtifactsInfo: {
24
- dateSaved: new Date(),
25
- modelTopologyType: 'JSON'
26
- }
27
- }];
28
- });
29
- }); }
30
- });
31
- })];
32
- case 1:
33
- saved = _a.sent();
34
- return [2 /*return*/, (0, tslib_1.__spreadArray)([], (0, tslib_1.__read)(msgpack_lite_1.default.encode(saved).values()), false)];
35
- }
36
- });
37
- });
38
- }
39
- exports.encode = encode;
40
- function decode(encoded) {
41
- return (0, tslib_1.__awaiter)(this, void 0, void 0, function () {
42
- var raw;
43
- return (0, tslib_1.__generator)(this, function (_a) {
44
- switch (_a.label) {
45
- case 0:
46
- raw = msgpack_lite_1.default.decode(encoded);
47
- return [4 /*yield*/, __1.tf.loadLayersModel({
48
- load: function () { return raw; }
49
- })];
50
- case 1: return [2 /*return*/, _a.sent()];
51
- }
52
- });
53
- });
54
- }
55
- exports.decode = decode;
@@ -1,64 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.decode = exports.encode = exports.isEncoded = void 0;
4
- var tslib_1 = require("tslib");
5
- var msgpack = (0, tslib_1.__importStar)(require("msgpack-lite"));
6
- var __1 = require("..");
7
- function isSerialized(raw) {
8
- if (typeof raw !== 'object' || raw === null) {
9
- return false;
10
- }
11
- if (!('shape' in raw && 'data' in raw)) {
12
- return false;
13
- }
14
- var _a = raw, shape = _a.shape, data = _a.data;
15
- if (!(Array.isArray(shape) && shape.every(function (e) { return typeof e === 'number'; })) ||
16
- !(Array.isArray(data) && data.every(function (e) { return typeof e === 'number'; }))) {
17
- return false;
18
- }
19
- // eslint-disable-next-line
20
- var _ = { shape: shape, data: data };
21
- return true;
22
- }
23
- function isEncoded(raw) {
24
- return Array.isArray(raw) && raw.every(function (e) { return typeof e === 'number'; });
25
- }
26
- exports.isEncoded = isEncoded;
27
- function encode(weights) {
28
- return (0, tslib_1.__awaiter)(this, void 0, void 0, function () {
29
- var serialized;
30
- var _this = this;
31
- return (0, tslib_1.__generator)(this, function (_a) {
32
- switch (_a.label) {
33
- case 0: return [4 /*yield*/, Promise.all(weights.weights.map(function (t) { return (0, tslib_1.__awaiter)(_this, void 0, void 0, function () {
34
- var _a;
35
- var _b;
36
- return (0, tslib_1.__generator)(this, function (_c) {
37
- switch (_c.label) {
38
- case 0:
39
- _b = {
40
- shape: t.shape
41
- };
42
- _a = [[]];
43
- return [4 /*yield*/, t.data()];
44
- case 1: return [2 /*return*/, (_b.data = tslib_1.__spreadArray.apply(void 0, _a.concat([tslib_1.__read.apply(void 0, [_c.sent()]), false])),
45
- _b)];
46
- }
47
- });
48
- }); }))];
49
- case 1:
50
- serialized = _a.sent();
51
- return [2 /*return*/, (0, tslib_1.__spreadArray)([], (0, tslib_1.__read)(msgpack.encode(serialized).values()), false)];
52
- }
53
- });
54
- });
55
- }
56
- exports.encode = encode;
57
- function decode(encoded) {
58
- var raw = msgpack.decode(encoded);
59
- if (!(Array.isArray(raw) && raw.every(isSerialized))) {
60
- throw new Error('expected to decode an array of serialized weights');
61
- }
62
- return new __1.WeightsContainer(raw.map(function (w) { return __1.tf.tensor(w.data, w.shape); }));
63
- }
64
- exports.decode = decode;
@@ -1,24 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.isDataExample = void 0;
4
- var immutable_1 = require("immutable");
5
- function isDataExample(raw) {
6
- if (typeof raw !== 'object') {
7
- return false;
8
- }
9
- if (raw === null) {
10
- return false;
11
- }
12
- if (!(0, immutable_1.Set)(Object.keys(raw)).equals(immutable_1.Set.of('columnName', 'columnData'))) {
13
- return false;
14
- }
15
- var _a = raw, columnName = _a.columnName, columnData = _a.columnData;
16
- if (typeof columnName !== 'string' ||
17
- (typeof columnData !== 'string' && typeof columnData !== 'number')) {
18
- return false;
19
- }
20
- // eslint-disable-next-line @typescript-eslint/no-unused-vars
21
- var _ = { columnName: columnName, columnData: columnData };
22
- return true;
23
- }
24
- exports.isDataExample = isDataExample;
@@ -1,18 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.isDigest = void 0;
4
- function isDigest(raw) {
5
- if (typeof raw !== 'object') {
6
- return false;
7
- }
8
- if (raw === null) {
9
- return false;
10
- }
11
- var _a = raw, algorithm = _a.algorithm, value = _a.value;
12
- if (!(typeof algorithm === 'string' &&
13
- typeof value === 'string')) {
14
- return false;
15
- }
16
- return true;
17
- }
18
- exports.isDigest = isDigest;
@@ -1,49 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.isDisplayInformation = void 0;
4
- var summary_1 = require("./summary");
5
- var data_example_1 = require("./data_example");
6
- function isDisplayInformation(raw) {
7
- if (typeof raw !== 'object') {
8
- return false;
9
- }
10
- if (raw === null) {
11
- return false;
12
- }
13
- var _a = raw, dataExample = _a.dataExample, dataExampleImage = _a.dataExampleImage, dataExampleText = _a.dataExampleText, dataFormatInformation = _a.dataFormatInformation, headers = _a.headers, limitations = _a.limitations, model = _a.model, summary = _a.summary, taskTitle = _a.taskTitle, tradeoffs = _a.tradeoffs;
14
- if (typeof taskTitle !== 'string' ||
15
- (dataExampleText !== undefined && typeof dataExampleText !== 'string') ||
16
- (dataFormatInformation !== undefined && typeof dataFormatInformation !== 'string') ||
17
- (tradeoffs !== undefined && typeof tradeoffs !== 'string') ||
18
- (model !== undefined && typeof model !== 'string') ||
19
- (dataExampleImage !== undefined && typeof dataExampleImage !== 'string') ||
20
- (limitations !== undefined && typeof limitations !== 'string')) {
21
- return false;
22
- }
23
- if (summary !== undefined && !(0, summary_1.isSummary)(summary)) {
24
- return false;
25
- }
26
- if (dataExample !== undefined && !(Array.isArray(dataExample) &&
27
- dataExample.every(data_example_1.isDataExample))) {
28
- return false;
29
- }
30
- if (headers !== undefined && !(Array.isArray(headers) &&
31
- headers.every(function (e) { return typeof e === 'string'; }))) {
32
- return false;
33
- }
34
- // eslint-disable-next-line @typescript-eslint/no-unused-vars
35
- var _ = {
36
- taskTitle: taskTitle,
37
- summary: summary,
38
- tradeoffs: tradeoffs,
39
- dataFormatInformation: dataFormatInformation,
40
- dataExampleText: dataExampleText,
41
- model: model,
42
- dataExample: dataExample,
43
- headers: headers,
44
- dataExampleImage: dataExampleImage,
45
- limitations: limitations
46
- };
47
- return true;
48
- }
49
- exports.isDisplayInformation = isDisplayInformation;
@@ -1,6 +0,0 @@
1
- export { isTask, Task, isTaskID, TaskID } from './task';
2
- export { TaskProvider, isTaskProvider } from './task_provider';
3
- export { isDigest, Digest } from './digest';
4
- export { isDisplayInformation, DisplayInformation } from './display_information';
5
- export { TrainingInformation } from './training_information';
6
- export { pushTask, fetchTasks } from './task_handler';
@@ -1,15 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.fetchTasks = exports.pushTask = exports.isDisplayInformation = exports.isDigest = exports.isTaskProvider = exports.isTaskID = exports.isTask = void 0;
4
- var task_1 = require("./task");
5
- Object.defineProperty(exports, "isTask", { enumerable: true, get: function () { return task_1.isTask; } });
6
- Object.defineProperty(exports, "isTaskID", { enumerable: true, get: function () { return task_1.isTaskID; } });
7
- var task_provider_1 = require("./task_provider");
8
- Object.defineProperty(exports, "isTaskProvider", { enumerable: true, get: function () { return task_provider_1.isTaskProvider; } });
9
- var digest_1 = require("./digest");
10
- Object.defineProperty(exports, "isDigest", { enumerable: true, get: function () { return digest_1.isDigest; } });
11
- var display_information_1 = require("./display_information");
12
- Object.defineProperty(exports, "isDisplayInformation", { enumerable: true, get: function () { return display_information_1.isDisplayInformation; } });
13
- var task_handler_1 = require("./task_handler");
14
- Object.defineProperty(exports, "pushTask", { enumerable: true, get: function () { return task_handler_1.pushTask; } });
15
- Object.defineProperty(exports, "fetchTasks", { enumerable: true, get: function () { return task_handler_1.fetchTasks; } });
@@ -1,6 +0,0 @@
1
- export declare function isModelCompileData(raw: unknown): raw is ModelCompileData;
2
- export interface ModelCompileData {
3
- optimizer: string;
4
- loss: string;
5
- metrics: string[];
6
- }
@@ -1,22 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.isModelCompileData = void 0;
4
- function isModelCompileData(raw) {
5
- if (typeof raw !== 'object') {
6
- return false;
7
- }
8
- if (raw === null) {
9
- return false;
10
- }
11
- var _a = raw, optimizer = _a.optimizer, loss = _a.loss, metrics = _a.metrics;
12
- if (typeof optimizer !== 'string' ||
13
- typeof loss !== 'string') {
14
- return false;
15
- }
16
- if (!(Array.isArray(metrics) &&
17
- metrics.every(function (e) { return typeof e === 'string'; }))) {
18
- return false;
19
- }
20
- return true;
21
- }
22
- exports.isModelCompileData = isModelCompileData;
@@ -1,19 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.isSummary = void 0;
4
- function isSummary(raw) {
5
- if (typeof raw !== 'object') {
6
- return false;
7
- }
8
- if (raw === null) {
9
- return false;
10
- }
11
- var _a = raw, preview = _a.preview, overview = _a.overview;
12
- if (!(typeof preview === 'string' && typeof overview === 'string')) {
13
- return false;
14
- }
15
- // eslint-disable-next-line @typescript-eslint/no-unused-vars
16
- var _ = { preview: preview, overview: overview };
17
- return true;
18
- }
19
- exports.isSummary = isSummary;
@@ -1,35 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.isTask = exports.isTaskID = void 0;
4
- var display_information_1 = require("./display_information");
5
- var training_information_1 = require("./training_information");
6
- var digest_1 = require("./digest");
7
- function isTaskID(obj) {
8
- return typeof obj === 'string';
9
- }
10
- exports.isTaskID = isTaskID;
11
- function isTask(raw) {
12
- if (typeof raw !== 'object') {
13
- return false;
14
- }
15
- if (raw === null) {
16
- return false;
17
- }
18
- var _a = raw, taskID = _a.taskID, digest = _a.digest, displayInformation = _a.displayInformation, trainingInformation = _a.trainingInformation;
19
- if (typeof taskID !== 'string') {
20
- return false;
21
- }
22
- if (digest !== undefined && !(0, digest_1.isDigest)(digest)) {
23
- return false;
24
- }
25
- if (!(0, display_information_1.isDisplayInformation)(displayInformation)) {
26
- return false;
27
- }
28
- if (!(0, training_information_1.isTrainingInformation)(trainingInformation)) {
29
- return false;
30
- }
31
- // eslint-disable-next-line @typescript-eslint/no-unused-vars
32
- var _ = { taskID: taskID, displayInformation: displayInformation, trainingInformation: trainingInformation };
33
- return true;
34
- }
35
- exports.isTask = isTask;
@@ -1,5 +0,0 @@
1
- import { Map } from 'immutable';
2
- import { tf } from '..';
3
- import { Task, TaskID } from './task';
4
- export declare function pushTask(url: URL, task: Task, model: tf.LayersModel): Promise<void>;
5
- export declare function fetchTasks(url: URL): Promise<Map<TaskID, Task>>;
@@ -1,53 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.fetchTasks = exports.pushTask = void 0;
4
- var tslib_1 = require("tslib");
5
- var immutable_1 = require("immutable");
6
- var axios_1 = (0, tslib_1.__importDefault)(require("axios"));
7
- var __1 = require("..");
8
- var task_1 = require("./task");
9
- var TASK_ENDPOINT = 'tasks';
10
- function pushTask(url, task, model) {
11
- return (0, tslib_1.__awaiter)(this, void 0, void 0, function () {
12
- var _a, _b, _c;
13
- var _d;
14
- return (0, tslib_1.__generator)(this, function (_e) {
15
- switch (_e.label) {
16
- case 0:
17
- _b = (_a = axios_1.default).post;
18
- _c = [url.href + TASK_ENDPOINT];
19
- _d = {
20
- task: task
21
- };
22
- return [4 /*yield*/, __1.serialization.model.encode(model)];
23
- case 1:
24
- _d.model = _e.sent();
25
- return [4 /*yield*/, __1.serialization.weights.encode(__1.WeightsContainer.from(model))];
26
- case 2: return [4 /*yield*/, _b.apply(_a, _c.concat([(_d.weights = _e.sent(),
27
- _d)]))];
28
- case 3:
29
- _e.sent();
30
- return [2 /*return*/];
31
- }
32
- });
33
- });
34
- }
35
- exports.pushTask = pushTask;
36
- function fetchTasks(url) {
37
- return (0, tslib_1.__awaiter)(this, void 0, void 0, function () {
38
- var response, tasks;
39
- return (0, tslib_1.__generator)(this, function (_a) {
40
- switch (_a.label) {
41
- case 0: return [4 /*yield*/, axios_1.default.get(url.href + TASK_ENDPOINT)];
42
- case 1:
43
- response = _a.sent();
44
- tasks = response.data;
45
- if (!Array.isArray(tasks) || !tasks.every(task_1.isTask)) {
46
- throw new Error('invalid tasks response');
47
- }
48
- return [2 /*return*/, (0, immutable_1.Map)(tasks.map(function (t) { return [t.taskID, t]; }))];
49
- }
50
- });
51
- });
52
- }
53
- exports.fetchTasks = fetchTasks;
@@ -1,6 +0,0 @@
1
- import { tf, Task } from '..';
2
- export interface TaskProvider {
3
- getTask: () => Task;
4
- getModel: () => Promise<tf.LayersModel>;
5
- }
6
- export declare function isTaskProvider(obj: any): obj is TaskProvider;
@@ -1,13 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.isTaskProvider = void 0;
4
- function isTaskProvider(obj) {
5
- if ('getModel' in obj && typeof obj.getModel === 'function' &&
6
- 'getTask' in obj && typeof obj.getTask === 'function') {
7
- return true;
8
- }
9
- else {
10
- return false;
11
- }
12
- }
13
- exports.isTaskProvider = isTaskProvider;
@@ -1,66 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.isTrainingInformation = void 0;
4
- var model_compile_data_1 = require("./model_compile_data");
5
- function isTrainingInformation(raw) {
6
- if (typeof raw !== 'object') {
7
- return false;
8
- }
9
- if (raw === null) {
10
- return false;
11
- }
12
- var _a = raw, dataType = _a.dataType, scheme = _a.scheme, epochs = _a.epochs,
13
- // roundDuration,
14
- validationSplit = _a.validationSplit, batchSize = _a.batchSize, modelCompileData = _a.modelCompileData, modelID = _a.modelID, preprocessingFunctions = _a.preprocessingFunctions, inputColumns = _a.inputColumns, outputColumns = _a.outputColumns, IMAGE_H = _a.IMAGE_H, IMAGE_W = _a.IMAGE_W, roundDuration = _a.roundDuration, modelURL = _a.modelURL, learningRate = _a.learningRate, decentralizedSecure = _a.decentralizedSecure, maxShareValue = _a.maxShareValue, minimumReadyPeers = _a.minimumReadyPeers, LABEL_LIST = _a.LABEL_LIST, noiseScale = _a.noiseScale, clippingRadius = _a.clippingRadius;
15
- if (typeof dataType !== 'string' ||
16
- typeof modelID !== 'string' ||
17
- typeof epochs !== 'number' ||
18
- typeof batchSize !== 'number' ||
19
- typeof roundDuration !== 'number' ||
20
- typeof validationSplit !== 'number' ||
21
- (modelURL !== undefined && typeof modelURL !== 'string') ||
22
- (noiseScale !== undefined && typeof noiseScale !== 'number') ||
23
- (clippingRadius !== undefined && typeof clippingRadius !== 'number') ||
24
- (learningRate !== undefined && typeof learningRate !== 'number') ||
25
- (decentralizedSecure !== undefined && typeof decentralizedSecure !== 'boolean') ||
26
- (maxShareValue !== undefined && typeof maxShareValue !== 'number') ||
27
- (minimumReadyPeers !== undefined && typeof minimumReadyPeers !== 'number')) {
28
- return false;
29
- }
30
- // interdepences on data type
31
- switch (dataType) {
32
- case 'image':
33
- if (typeof IMAGE_H !== 'number' || typeof IMAGE_W !== 'number') {
34
- return false;
35
- }
36
- break;
37
- case 'tabular':
38
- if (!(Array.isArray(inputColumns) && inputColumns.every(function (e) { return typeof e === 'string'; }))) {
39
- return false;
40
- }
41
- if (!(Array.isArray(outputColumns) && outputColumns.every(function (e) { return typeof e === 'string'; }))) {
42
- return false;
43
- }
44
- break;
45
- }
46
- // interdepences on scheme
47
- switch (scheme) {
48
- case 'decentralized':
49
- break;
50
- case 'federated':
51
- break;
52
- case 'local':
53
- break;
54
- }
55
- if (!(0, model_compile_data_1.isModelCompileData)(modelCompileData)) {
56
- return false;
57
- }
58
- if (LABEL_LIST !== undefined && !(Array.isArray(LABEL_LIST) && LABEL_LIST.every(function (e) { return typeof e === 'string'; }))) {
59
- return false;
60
- }
61
- if (preprocessingFunctions !== undefined && !(Array.isArray(preprocessingFunctions) && preprocessingFunctions.every(function (e) { return typeof e === 'string'; }))) {
62
- return false;
63
- }
64
- return true;
65
- }
66
- exports.isTrainingInformation = isTrainingInformation;
@@ -1,23 +0,0 @@
1
- import { Client, data, Logger, Task, TrainingInformant, TrainingSchemes, Memory } from '..';
2
- import { TrainerLog } from '../logging/trainer_logger';
3
- interface DiscoOptions {
4
- client?: Client;
5
- url?: string | URL;
6
- scheme?: TrainingSchemes;
7
- informant?: TrainingInformant;
8
- logger?: Logger;
9
- memory?: Memory;
10
- }
11
- export declare class Disco {
12
- readonly task: Task;
13
- readonly logger: Logger;
14
- readonly memory: Memory;
15
- private readonly client;
16
- private readonly trainer;
17
- constructor(task: Task, options: DiscoOptions);
18
- fit(dataTuple: data.DataSplit): Promise<void>;
19
- pause(): Promise<void>;
20
- close(): Promise<void>;
21
- logs(): Promise<TrainerLog>;
22
- }
23
- export {};