Home / Function/ minify_model() — pytorch Function Reference

minify_model() — pytorch Function Reference

Architecture documentation for the minify_model() function in common.py from the pytorch codebase.

Entity Profile

Dependency Diagram

graph TD
  d825b76f_2b85_74b9_6e8c_af36be54ac1f["minify_model()"]
  9bf8449e_2d7f_c370_514b_b3c7bf20f8e1["run_one_model()"]
  9bf8449e_2d7f_c370_514b_b3c7bf20f8e1 -->|calls| d825b76f_2b85_74b9_6e8c_af36be54ac1f
  79f63331_206c_51dc_bfd1_4fd84b939754["check_accuracy()"]
  d825b76f_2b85_74b9_6e8c_af36be54ac1f -->|calls| 79f63331_206c_51dc_bfd1_4fd84b939754
  style d825b76f_2b85_74b9_6e8c_af36be54ac1f fill:#6366f1,stroke:#818cf8,color:#fff

Relationship Graph

Source Code

benchmarks/dynamo/common.py lines 2954–2984

    def minify_model(
        self,
        name,
        model,
        example_inputs,
        optimize_ctx,
        experiment,
        tag,
    ):
        log.info("Minifying %s...", name)
        os.environ["TORCH_COMPILE_DEBUG"] = "1"
        os.environ["TORCHDYNAMO_REPRO_AFTER"] = "dynamo"
        os.environ["TORCHDYNAMO_REPRO_LEVEL"] = "4"

        self.check_accuracy(name, model, example_inputs, optimize_ctx, experiment, tag)

        if self.args.output_directory:
            repro_dir = self.args.output_directory
        else:
            repro_dir = torch._dynamo.config.base_dir

        try:
            shutil.move("repro.py", f"{repro_dir}/{name}_repro.py")
        except OSError:
            log.error("Could not find repro script for model %s", name)
        else:
            log.info(
                "Repro script for model %s with minified graph saved to %s",
                name,
                repro_dir,
            )

Subdomains

Called By

Frequently Asked Questions

What does minify_model() do?
minify_model() is a function in the pytorch codebase.
What does minify_model() call?
minify_model() calls 1 function(s): check_accuracy.
What calls minify_model()?
minify_model() is called by 1 function(s): run_one_model.

Analyze Your Own Codebase

Get architecture documentation, dependency graphs, and domain analysis for your codebase in minutes.

Try Supermodel Free