Skip to content

[BUG] LazyTurtle converts .bin/.pt checkpoints into a full temp safetensors copy on every load() and keeps it until interpreter exit #4205

Closed

Description

@Qubitium

Severity: low–medium (disk leak in long-lived processes: one model-sized copy per load, in the system TMPDIR, not the configured offload path)
Version: 7.11.0 @ 9dad249

Summary

utils/structure.py:1289-1292 does tempfile.mkdtemp(prefix="lazyturtle-") and cleans up only via atexit.register(shutil.rmtree, ...). Nothing ties the copy to the lifetime of the model or turtle, and conversions aren't reused for the same source.

Reproduce

import glob, gc, os, tempfile
from gptqmodel import GPTQModel, QuantizeConfig
for i in range(2):
    m = GPTQModel.load("facebook/opt-125m", quantize_config=QuantizeConfig(bits=4)); del m; gc.collect()   # .bin-only checkpoint
    print(glob.glob(os.path.join(tempfile.gettempdir(), "lazyturtle-*")))

Actual: one 250,502,107-byte dir after the first load+del, two (500 MB) after the second. They are removed only at exit.

Expected:

  • Clean up when the model or turtle is released (weakref finaliser / context).
  • Reuse the conversion per source path.
  • Put it under the configured offload path rather than the system TMPDIR.

Found during an AI-assisted review (Claude Code) of 9dad249; repros were run on RTX 4090/5090 (CUDA 13) and/or Radeon AI PRO R9700 (ROCm) unless marked static/suspected.

Activity

  1. added
    bug
    on Nov 16, 2026
  2. self-assigned this
    on Nov 16, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

bug

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions