Skip to main content

vllm-iter

vllm-iter provides iterable-friendly offline generation utilities on top of vllm.LLM.

IterableLLM.generate_iter() keeps a bounded number of unfinished requests in flight while yielding final completions incrementally in input order. The max_inflight setting controls wrapper-managed unfinished requests, not the model-side microbatch size. By default it follows vLLM's scheduler capacity (max_num_seqs), and you can set a smaller or larger value to tune host-side backpressure. When the input iterable length is known ahead of time, pass total= to keep the tqdm progress bar stable instead of growing it dynamically as prompts are submitted.

Motivation

This is useful when your prompts come from a large streaming source and you do not want to materialize either the full input set or the full output set in memory.

For example, imagine a huge JSON Lines file. You can iterate over the input lines, convert each one into a PromptType, and feed that iterable directly into generate_iter(). As results come back, you can immediately append them to an output JSON Lines file and forget about them. That keeps memory bounded and also means a crash or interruption does not lose everything that was already written.

Installation

pip install git+https://github.com/michielree/vllm-iter.git

Example

from vllm import SamplingParams

from vllm_iter import IterableLLM


def prompt_source():
    for topic in ["redis", "postgres", "kafka"]:
        yield f"Give me a one-line summary of {topic}."


llm = IterableLLM(
    model="distilbert/distilgpt2",
    tensor_parallel_size=1,
    gpu_memory_utilization=0.10,
    enforce_eager=True,
)

for output in llm.generate_iter(
    prompt_source(),
    sampling_params=SamplingParams(max_tokens=32),
    use_tqdm=False,
):
    print(output.prompt)
    print(output.outputs[0].text)

Metadata

Release files for vllm-iter 0.1.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for vllm-iter 0.1.0
File Size Uploaded Provenance Actions
vllm_iter-0.1.0.tar.gz 10.3 kB Without provenance Details for vllm_iter-0.1.0.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for vllm-iter 0.1.0
File Interpreter ABI Platform Actions
vllm_iter-0.1.0-py3-none-any.whl Python 3 none any Details for vllm_iter-0.1.0-py3-none-any.whl

Total release size: 16.5 kB

Release files / vllm_iter-0.1.0.tar.gz

Download URL vllm_iter-0.1.0.tar.gz
Size 10.3 kB
Tags Source
SHA-256 checksum
How to use checksums
7de3396b6f6e33d98560f6781f5b6cc866ec7219d867d9e432dddfc99b3cbbeb
BLAKE2b-256 checksum
How to use checksums
631e9e190c9eed81c8421048697c59065852692aba75491ab6cb53a0ea573ba7
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via uv/0.11.16 {"installer":{"name":"uv","version":"0.11.16","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}

Release files / vllm_iter-0.1.0-py3-none-any.whl

Download URL vllm_iter-0.1.0-py3-none-any.whl
Size 6.2 kB
Tags Python 3
SHA-256 checksum
How to use checksums
469b63cd8d374f7202390cea34b5bbeaf1975e75ffd011d3361313cf05707f35
BLAKE2b-256 checksum
How to use checksums
01e59f8d88c595f4b8b258aa78902092d7fabd5d8a810c10f88b28f353fdd606
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via uv/0.11.16 {"installer":{"name":"uv","version":"0.11.16","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}

Security for vllm-iter 0.1.0

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Release history Release notifications | RSS feed

This release

0.1.0 This release

2 release files No provenance

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page