Skip to content

Commit

Permalink
fixup! *: bump deps
Browse files Browse the repository at this point in the history
  • Loading branch information
tharvik committed Feb 17, 2025
1 parent 238a630 commit c85b1d5
Show file tree
Hide file tree
Showing 12 changed files with 28 additions and 19 deletions.
3 changes: 2 additions & 1 deletion cli/src/benchmark_gpt.ts
Original file line number Diff line number Diff line change
Expand Up @@ -119,7 +119,8 @@ async function main(args: Required<CLIArguments>): Promise<void> {
for (let i = 0; i < iterations; i++) {
const timeStart = performance.now()
for (let n = 0; n < maxNewTokens; n++) {
const next: number = (await model.predict(List.of(tokens))).first();
const next = (await model.predict(List.of(tokens))).first();
if (next === undefined) throw new Error("empty prediction");
tokens = tokens.push(next)
}
inferenceTime += performance.now() - timeStart
Expand Down
5 changes: 2 additions & 3 deletions cli/src/train_gpt.ts
Original file line number Diff line number Diff line change
Expand Up @@ -36,9 +36,8 @@ async function main(): Promise<void> {

const maxNewTokens = 14
for (let n = 0; n < maxNewTokens; n++) {
const next: number = (await model.predict(
List.of(tokens), { seed })
).first();
const next = (await model.predict(List.of(tokens), { seed })).first();
if (next === undefined) throw new Error("empty prediction");
tokens = tokens.push(next)
}
const generation = tokenizer.decode(tokens.toArray(), { skip_special_tokens: true })
Expand Down
2 changes: 1 addition & 1 deletion discojs/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@
"@epfml/isomorphic-wrtc": "1",
"@jimp/core": "1",
"@jimp/plugin-resize": "1",
"@msgpack/msgpack": "^3.0.0-beta2",
"@msgpack/msgpack": "3",
"@tensorflow/tfjs": "4",
"@xenova/transformers": "2",
"isomorphic-ws": "5",
Expand Down
2 changes: 1 addition & 1 deletion discojs/src/aggregator.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ AGGREGATORS.forEach(([name, Aggregator]) =>
Map(
network
.entrySeq()
.zip(Range(1312))
.zip(Range(1312, Number.POSITIVE_INFINITY))
.map(([[id, agg], ws]) => [
id,
[agg, WeightsContainer.of([ws])],
Expand Down
3 changes: 2 additions & 1 deletion discojs/src/client/decentralized/peer.ts
Original file line number Diff line number Diff line change
Expand Up @@ -137,7 +137,8 @@ export class Peer {

return Seq.Indexed([firstChunk])
.concat(
Range(1 as ChunkID).zip(tail)
Range(1 as ChunkID, Number.POSITIVE_INFINITY)
.zip(tail)
.map(([id, raw]) => {
const chunk = Buffer.alloc(HEADER_SIZE + raw.length)
chunk.writeUint16BE(messageID)
Expand Down
8 changes: 7 additions & 1 deletion discojs/src/client/federated/federated_client.ts
Original file line number Diff line number Diff line change
Expand Up @@ -129,6 +129,8 @@ export class FederatedClient extends Client {
* @returns the new global weights sent by the server
*/
override async onRoundEndCommunication(weights: WeightsContainer): Promise<WeightsContainer> {
if (this._ownId === undefined)
throw new Error("no received ID from server");
if (this.aggregationResult === undefined) {
throw new Error("local aggregation result was not set");
}
Expand All @@ -138,7 +140,11 @@ export class FederatedClient extends Client {
this.saveAndEmit("updating model")
// Send our local contribution to the server
// and receive the server global update for this round as an answer to our contribution
const payloadToServer: WeightsContainer = this.aggregator.makePayloads(weights).first()
const payloadToServer = this.aggregator
.makePayloads(weights)
.get(SERVER_NODE_ID);
if (payloadToServer === undefined)
throw new Error("aggregator didn't make a payload for the server");
const msg: messages.SendPayload = {
type: type.SendPayload,
payload: await serialization.weights.encode(payloadToServer),
Expand Down
2 changes: 1 addition & 1 deletion discojs/src/dataset/dataset.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -131,7 +131,7 @@ describe("dataset", () => {
it("zips with non-async iterable", async () => {
const dataset = new Dataset([1, 2, 3]);

const zipped = dataset.zip(Range());
const zipped = dataset.zip(Range(0, Number.POSITIVE_INFINITY));

expect(await arrayFromAsync(zipped)).to.have.deep.ordered.members([
[1, 0],
Expand Down
7 changes: 4 additions & 3 deletions discojs/src/models/gpt/gpt.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -34,9 +34,10 @@ describe("gpt-tfjs", function () {
const input = "Lorem ipsum dolor";
const inputTokens = processing.tokenize(tokenizer, data);

const outputToken: number = (
await model.predict(List.of(inputTokens), { seed })
).first();
const outputToken = (
await model.predict(List.of(inputTokens), { seed })
).first();
if (outputToken === undefined) throw new Error("empty prediction");
const output = tokenizer.decode([outputToken]);

expect(input + output).equal(data); // Assert that the model completes 'Lorem ipsum dolor' with 'sit'
Expand Down
5 changes: 3 additions & 2 deletions discojs/src/models/tfjs.ts
Original file line number Diff line number Diff line change
Expand Up @@ -44,8 +44,9 @@ export class TFJS<D extends "image" | "tabular"> extends Model<D> {
validationDataset?: Dataset<Batched<DataFormat.ModelEncoded[D]>>,
): AsyncGenerator<BatchLogs, EpochLogs> {
let batchesLogs = List<BatchLogs>();
for await (const [batch, batchNumber] of trainingDataset.zip(Range())) {

for await (const [batch, batchNumber] of trainingDataset.zip(
Range(0, Number.POSITIVE_INFINITY),
)) {
const batchLogs = {
batch: batchNumber,
...(await this.#runBatch(batch)),
Expand Down
6 changes: 3 additions & 3 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion server/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
"dependencies": {
"@epfml/discojs-node": "*",
"@koush/wrtc": "0.5",
"@msgpack/msgpack": "^3.0.0-beta2",
"@msgpack/msgpack": "3",
"@tensorflow/tfjs": "4",
"cors": "2",
"express": "4",
Expand Down
2 changes: 1 addition & 1 deletion webapp/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
"dependencies": {
"@epfml/discojs": "*",
"@epfml/discojs-web": "*",
"@msgpack/msgpack": "^3.0.0-beta2",
"@msgpack/msgpack": "3",
"apexcharts": "4",
"cypress": "13",
"d3": "7",
Expand Down

0 comments on commit c85b1d5

Please sign in to comment.