Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
29 commits
Select commit Hold shift + click to select a range
e30c9cc
build: new try pinning dependencies
hleepfl Jun 23, 2026
f5cf0b0
build: last missing version pins
hleepfl Jun 23, 2026
274df12
build: replace npm with pnpm
hleepfl Jun 23, 2026
249a35c
build: move sections from package.json, prettier ignore lockfile
hleepfl Jun 23, 2026
462d20a
build: fix phantom dependencies and remove a few useless ones
hleepfl Jun 23, 2026
2666eec
build: update ci to use pnpm
hleepfl Jun 22, 2026
efd52aa
build: update Dockerfile
hleepfl Jun 23, 2026
3a5d357
build: update npm calls to pnpm
hleepfl Jun 24, 2026
331965e
build: simplify building examples
hleepfl Jun 24, 2026
3115891
build: fix e2e tests
hleepfl Jun 24, 2026
651a0ae
build: don't build code in start command
hleepfl Jun 24, 2026
eff23f9
build: update args passing to pnpm (no -- separator)
hleepfl Jun 24, 2026
8cdafa2
ci: sync lockfile
hleepfl Jun 24, 2026
df22553
docs: update docs to mention pnpm instead of npm
hleepfl Jun 24, 2026
be3a84a
docs: update tools installation guide
hleepfl Jun 25, 2026
996c943
chore: formatting
hleepfl Jun 25, 2026
6f605ec
build: integrate pr review comments
hleepfl Jul 2, 2026
0af96d4
chore: sync lockfile
hleepfl Jul 2, 2026
ff0d419
build: add back required dependency
hleepfl Jul 2, 2026
533a6df
chore: sync lockfile
hleepfl Jul 2, 2026
78ca5bd
build: bump typescript to 6
hleepfl Jun 25, 2026
e23dab2
build: bump typescript-eslint
hleepfl Jun 25, 2026
7f319bf
lint: don't ignore docs/examples
hleepfl Jun 25, 2026
8193f80
lint: ignore buggy rule for `webapp`
hleepfl Jun 25, 2026
47f76a7
chore: fix lint errors in discojs
hleepfl Jun 25, 2026
438e8ae
Revert "build: add back required dependency"
hleepfl Jul 2, 2026
adcd8a2
build: re-add necessary dep
hleepfl Jul 2, 2026
d49ee3c
Merge branch 'develop' into 1116-typescript-6
hleepfl Jul 2, 2026
8dc4a1e
chore: fix some eslint errors in a better way
hleepfl Jul 2, 2026
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 3 additions & 1 deletion cli/tsconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,9 @@
}
],
"compilerOptions": {
"outDir": "dist"
"rootDir": "./src",
"outDir": "dist",
"types": ["node"]
},
"include": ["src"]
}
1 change: 1 addition & 0 deletions discojs-web/tsconfig.lib.json
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
],
"compilerOptions": {
"lib": ["DOM"],
"rootDir": "./src",
"outDir": "dist"
},
"include": ["src"],
Expand Down
5 changes: 3 additions & 2 deletions discojs/src/client/decentralized/peer.ts

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

the casting was to make it obvious what we were writing.

Original file line number Diff line number Diff line change
Expand Up @@ -137,7 +137,8 @@ export class Peer {
: FIRST_HEADER_SIZE + b.length,
);
firstChunk.writeUint16BE(messageID);
firstChunk.writeUint8(0 as ChunkID, 2);
const asChunkID = (n: number): ChunkID => n;
firstChunk.writeUint8(asChunkID(0), 2);
firstChunk.writeUint8(totalChunkCount, 3);
b.copy(
firstChunk,
Expand All @@ -147,7 +148,7 @@ export class Peer {
);

return Seq.Indexed([firstChunk]).concat(
Range(1 as ChunkID, Number.POSITIVE_INFINITY)
Range(asChunkID(1), Number.POSITIVE_INFINITY)
.zip(tail)
.map(([id, raw]) => {
const chunk = Buffer.alloc(HEADER_SIZE + raw.length);
Expand Down
9 changes: 2 additions & 7 deletions discojs/src/privacy.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@ import {
addOptimalNoise,
getClippingRadius,
} from "./privacy.js";
import { WeightNormHistory } from "./training/trainer.js";
import * as tf from "@tensorflow/tfjs";
import { List } from "immutable";

Expand Down Expand Up @@ -79,17 +78,13 @@ describe("getClippingRadius", () => {
List([10]),
]);

expect(
getClippingRadius(weightNormHistory as WeightNormHistory, 5),
).toEqual([4, 5]);
expect(getClippingRadius(weightNormHistory, 5)).toEqual([4, 5]);
});

it("uses smaller window size automatically if needed", () => {
const weightNormHistory = List([List([2, 4])]);

// Automatically use window size of 2 instead of 10
expect(
getClippingRadius(weightNormHistory as WeightNormHistory, 10),
).toEqual([3]);
expect(getClippingRadius(weightNormHistory, 10)).toEqual([3]);
});
});
14 changes: 3 additions & 11 deletions discojs/src/processing/index.ts

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

better to inline the various now useless renaming variables

Original file line number Diff line number Diff line change
Expand Up @@ -108,26 +108,18 @@ export function postprocess<D extends DataType>(
): DataFormat.Inferred[D] {
switch (task.dataType) {
case "image": {
// cast as typescript doesn't reduce generic type
const index = encoded as DataFormat.ModelEncoded["image"][1];
const labels = List(task.trainingInformation.LABEL_LIST);

const v = labels.get(index);
const v = labels.get(encoded);
if (v === undefined) throw new Error("index not found in labels");
return v as DataFormat.Inferred[D];
}
case "tabular": {
// cast as typescript doesn't reduce generic type
const v = encoded as DataFormat.ModelEncoded["tabular"][1];

return v as DataFormat.Inferred[D];
return encoded as DataFormat.Inferred[D];
}
case "text": {
// cast as typescript doesn't reduce generic type
const token = encoded as DataFormat.ModelEncoded["text"][1];

return task.trainingInformation.tokenizer.decode([
token,
encoded,
]) as DataFormat.Inferred[D];
}
}
Expand Down
2 changes: 1 addition & 1 deletion discojs/src/serialization/weights.ts
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ function isSerialized(raw: unknown): raw is Serialized {
export async function encode(weights: WeightsContainer): Promise<Encoded> {
const serialized: Serialized[] = await Promise.all(
weights.weights.map(async (t) => ({
shape: t.shape as number[],
shape: t.shape,
data: await t.data<"float32">(),
})),
);
Expand Down
3 changes: 2 additions & 1 deletion discojs/src/training/disco.ts
Original file line number Diff line number Diff line change
Expand Up @@ -224,7 +224,8 @@ export class Disco<D extends DataType, N extends Network> extends EventEmitter<{
await this.#preprocessSplitAndBatch(dataset);

// the client fetches the latest weights upon connection
// TODO unsafe cast
// TODO unsafe cast, and eslint rule is buggy
// eslint-disable-next-line @typescript-eslint/no-unnecessary-type-assertion
this.trainer.model = (await this.#client.connect()) as Model<D>;

for await (const [roundNum, round] of enumerate(
Expand Down
1 change: 1 addition & 0 deletions docs/examples/tsconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@
"skipLibCheck": true,

"outDir": "dist",
"rootDir": ".",
"types": ["node"]
},
"include": ["*.ts"]
Expand Down
17 changes: 14 additions & 3 deletions eslint.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -41,10 +41,22 @@ export default defineConfigWithVueTs(
ignoreRestSiblings: true,
},
],
// allow biome formatting
"no-mixed-spaces-and-tabs": "off",
// allow for nicer names
"@typescript-eslint/no-namespace": "off",
// rule is buggy, might be necessary to disable it entirely
"@typescript-eslint/no-unnecessary-type-assertion": [
"error",
{
typesToIgnore: ["Model", "DataType"],
},
],
},
},
{
files: ["webapp/**"],
rules: {
// Buggy rule in typescript-eslint 8.59 and at least until 8.62. Check if future versions fix it
"@typescript-eslint/no-unnecessary-type-assertion": "off",
},
},
{
Expand All @@ -61,7 +73,6 @@ export default defineConfigWithVueTs(
files: ["webapp/cypress/**/*.ts"],
},
{ ignores: ["**/dist/*"] },
{ ignores: ["docs/examples/**"] },
{ ignores: ["**/src/protobuf/"] },

// don't use linter for formatting
Expand Down
6 changes: 5 additions & 1 deletion onnx-converter/tsconfig.lib.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,9 @@
{
"extends": "../tsconfig.base.json",
"compilerOptions": { "outDir": "dist" },
"compilerOptions": {
"rootDir": "./src",
"outDir": "dist",
"types": ["node"]
},
"include": ["src"]
}
4 changes: 2 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -20,8 +20,8 @@
"eslint-plugin-vue": "10.8.0",
"knip": "6.17.1",
"prettier": "3.6.2",
"typescript": "5.9.3",
"typescript-eslint": "8.58.0",
"typescript": "6.0.3",
"typescript-eslint": "8.62.0",
"vitest": "catalog:"
},
"packageManager": "pnpm@11.8.0+sha512.c1f5e7c4cb241c8f174b743851d82f42b802324afc8b0f116b96adb15aa06664948dde36960a3ba1079ba5b4b29dd0140135b94b5b5f5263592249d68e555f26"
Expand Down
Loading