Skip to content

Commit

Permalink
Update serialization readme
Browse files Browse the repository at this point in the history
  • Loading branch information
DrA1ex committed Sep 20, 2023
1 parent a27721a commit e6dd43d
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 3 deletions.
10 changes: 9 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -274,7 +274,7 @@ gpuWrapper.destroy();

### Saving/Loading model
```javascript
import {SequentialModel, Dense, ModelSerialization} from "mind-net.js";
import {SequentialModel, Dense, ModelSerialization, BinarySerializer, TensorType} from "mind-net.js";

// Create and configure model
const network = new SequentialModel();
Expand All @@ -289,6 +289,14 @@ console.log(savedModel);

// Load model
const loadedModel = ModelSerialization.load(savedModel);

// Save model in binary representation and reduce weights precision to Float32
const binaryModel = BinarySerializer.save(network, TensorType.F32);
console.log(`Model size: ${binaryModel.byteLength}`);

// Load binary model
const loadedFromBinary = BinarySerializer.load(binaryModel);

```

### Configuration of Training dashboard
Expand Down
3 changes: 2 additions & 1 deletion src/app/neural-network/neural-network.ts
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,8 @@ export {
} from "./chart"

export {
ModelSerialization, ChainSerialization, UniversalModelSerializer, GanSerialization, BinarySerializer
ModelSerialization, ChainSerialization, UniversalModelSerializer, GanSerialization, BinarySerializer,
TensorType,
} from "./serialization";

export {
Expand Down
2 changes: 1 addition & 1 deletion src/app/neural-network/serialization/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,4 +2,4 @@ export {ModelSerialization} from "./model"
export {ChainSerialization} from "./chain"
export {GanSerialization} from "./gan"
export {UniversalModelSerializer} from "./universal"
export {BinarySerializer} from "./binary"
export {BinarySerializer, TensorType} from "./binary"

0 comments on commit e6dd43d

Please sign in to comment.