Skip to content

extension/llm/runner: Python bindings for the Engine/Session API#19992

Closed
mergennachin wants to merge 3 commits into
gh/mergennachin/2/headfrom
gh/mergennachin/3/head
Closed

extension/llm/runner: Python bindings for the Engine/Session API#19992
mergennachin wants to merge 3 commits into
gh/mergennachin/2/headfrom
gh/mergennachin/3/head

Conversation

@mergennachin

@mergennachin mergennachin commented Jun 3, 2026

Copy link
Copy Markdown
Contributor

Bind LLMEngine and LLMSession (PyLLMEngine/PyLLMSession), exposing
create_session(), serving_capacity(), and the token-step methods
(prefill_tokens/decode_one/seek/position/reset/stop) only on LLMSession.
PyTextLLMRunner stays a legacy direct runner and no longer exposes token-step
methods, so LLMSession is the single Python serving surface. Backend execution
across an engine's sessions is serialized by an engine-owned lock.
TokenStringCallback buffers byte-level BPE tokens so a multi-byte character
split across callbacks does not break UTF-8 decoding. Stubs in _llm_runner.pyi;
boundary and session tests in test_runner_pybindings.py.

Second of four stacked commits; depends on the C++ core.

#20001

[ghstack-poisoned]
@pytorch-bot

pytorch-bot Bot commented Jun 3, 2026

Copy link
Copy Markdown

🔗 Helpful Links

🧪 See artifacts and rendered test results at hud.pytorch.org/pr/pytorch/executorch/19992

Note: Links to docs will display an error until the docs builds have been completed.

❌ 4 New Failures

As of commit b3225d7 with merge base eeb0646 (image):

NEW FAILURES - The following jobs have failed:

This comment was automatically generated by Dr. CI and updates every 15 minutes.

[ghstack-poisoned]
[ghstack-poisoned]
@mergennachin

Copy link
Copy Markdown
Contributor Author

absorbed into #19991 / dropped in the worker-process re-architecture

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

CLA Signed This label is managed by the Facebook bot. Authors need to sign the CLA before a PR can be reviewed.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant