microsoft / microsoft/onnxruntime

[Web] Missing API for fetching model metadata

Open
#16,547 4 comments 6 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

api:Javascript feature request platform:web
Dominant language
C++
Stars
21.9k
Forks
4.2k
Avg merge
4d 11h
Merged PRs (30d)
184

Description

### Describe the issue

In Java, I can do
```java
OrtSession session = env.createSession(res.getContentAsByteArray());
OnnxModelMetadata meta = session.getMetadata();
Map customMeta = meta.getCustomMetadata();
String imgzz = customMeta.get("imgsz");
```

To get the `imgsz` metadata from a model.

In TypeScript, I expected to be able to do the same with roughly the same API, however I cannot find any API for this. Am I missing something, has nobody just gotten around to implementing the API yet (is this what
https://github.com/microsoft/onnxruntime/blob/a5dab850b8dfa64d8818eefa01e0df40cf3e4400/js/common/lib/inference-session.ts#L321-L324 is about?) or is there another reason the API does not exist?

### To reproduce

-

### Urgency

_No response_

### ONNX Runtime Installation

Released Package

### ONNX Runtime Version or Commit ID

1.15.0

### Execution Provider

'wasm'/'cpu' (WebAssembly CPU)

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start with js/common/lib/inference-session.ts around the referenced lines and compare the existing TypeScript web session surface with the Java metadata API shown in the issue. Trace how the WebAssembly CPU session is exposed, then verify that model metadata, including custom metadata such as "imgsz", can be fetched through the web API and add coverage where the existing tests for this surface are located.

Written by the indexing model from the issue text.

Assessment

Tech stack
typescript, wasm
Domain
ai, api
Issue type
Feature
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.