@epfml/discojs 3.0.1-p20250211140448.0 → 3.0.1-p20250218072819.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.
@@ -84,7 +84,8 @@ export class Peer {
84
84
  firstChunk.writeUint8(totalChunkCount, 3);
85
85
  b.copy(firstChunk, FIRST_HEADER_SIZE, 0, this.maxChunkSize - FIRST_HEADER_SIZE);
86
86
  return Seq.Indexed([firstChunk])
87
- .concat(Range(1).zip(tail)
87
+ .concat(Range(1, Number.POSITIVE_INFINITY)
88
+ .zip(tail)
88
89
  .map(([id, raw]) => {
89
90
  const chunk = Buffer.alloc(HEADER_SIZE + raw.length);
90
91
  chunk.writeUint16BE(messageID);
@@ -103,6 +103,8 @@ export class FederatedClient extends Client {
103
103
  * @returns the new global weights sent by the server
104
104
  */
105
105
  async onRoundEndCommunication(weights) {
106
+ if (this._ownId === undefined)
107
+ throw new Error("no received ID from server");
106
108
  if (this.aggregationResult === undefined) {
107
109
  throw new Error("local aggregation result was not set");
108
110
  }
@@ -111,7 +113,11 @@ export class FederatedClient extends Client {
111
113
  this.saveAndEmit("updating model");
112
114
  // Send our local contribution to the server
113
115
  // and receive the server global update for this round as an answer to our contribution
114
- const payloadToServer = this.aggregator.makePayloads(weights).first();
116
+ const payloadToServer = this.aggregator
117
+ .makePayloads(weights)
118
+ .get(SERVER_NODE_ID);
119
+ if (payloadToServer === undefined)
120
+ throw new Error("aggregator didn't make a payload for the server");
115
121
  const msg = {
116
122
  type: type.SendPayload,
117
123
  payload: await serialization.weights.encode(payloadToServer),
@@ -26,7 +26,7 @@ export class TFJS extends Model {
26
26
  }
27
27
  async *train(trainingDataset, validationDataset) {
28
28
  let batchesLogs = List();
29
- for await (const [batch, batchNumber] of trainingDataset.zip(Range())) {
29
+ for await (const [batch, batchNumber] of trainingDataset.zip(Range(0, Number.POSITIVE_INFINITY))) {
30
30
  const batchLogs = {
31
31
  batch: batchNumber,
32
32
  ...(await this.#runBatch(batch)),
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@epfml/discojs",
3
- "version": "3.0.1-p20250211140448.0",
3
+ "version": "3.0.1-p20250218072819.0",
4
4
  "type": "module",
5
5
  "main": "dist/index.js",
6
6
  "types": "dist/index.d.ts",
@@ -22,10 +22,9 @@
22
22
  "@epfml/isomorphic-wrtc": "1",
23
23
  "@jimp/core": "1",
24
24
  "@jimp/plugin-resize": "1",
25
- "@msgpack/msgpack": "^3.0.0-beta2",
25
+ "@msgpack/msgpack": "<3.0.0-beta5",
26
26
  "@tensorflow/tfjs": "4",
27
27
  "@xenova/transformers": "2",
28
- "immutable": "4",
29
28
  "isomorphic-ws": "5",
30
29
  "simple-peer": "9",
31
30
  "tslib": "2",