Home / Function/ get_tolerance_and_cosine_flag() — pytorch Function Reference

get_tolerance_and_cosine_flag() — pytorch Function Reference

Architecture documentation for the get_tolerance_and_cosine_flag() function in huggingface.py from the pytorch codebase.

Entity Profile

Dependency Diagram

graph TD
  a3bd5d33_16f5_252a_6395_eedbd64f28e7["get_tolerance_and_cosine_flag()"]
  4ed3d19d_5919_8dac_36a3_c8fbf9eb090b["get_tolerance_and_cosine_flag()"]
  a3bd5d33_16f5_252a_6395_eedbd64f28e7 -->|calls| 4ed3d19d_5919_8dac_36a3_c8fbf9eb090b
  style a3bd5d33_16f5_252a_6395_eedbd64f28e7 fill:#6366f1,stroke:#818cf8,color:#fff

Relationship Graph

Source Code

benchmarks/dynamo/huggingface.py lines 529–549

    def get_tolerance_and_cosine_flag(self, is_training, current_device, name):
        cosine = self.args.cosine
        if is_training:
            from torch._inductor import config as inductor_config

            if (name in self._config["tolerance"]["higher_training"]) or (
                inductor_config.max_autotune
                and name in self._config["tolerance"]["higher_max_autotune_training"]
            ):
                return 2e-2, cosine
            else:
                return 1e-2, cosine
        else:
            if (
                current_device == "cpu"
                and name in self._config["tolerance"]["higher_inference_cpu"]
            ):
                return 5e-3, cosine
            if name in self._config["tolerance"]["higher_inference"]:
                return 4e-3, cosine
        return 1e-3, cosine

Subdomains

Frequently Asked Questions

What does get_tolerance_and_cosine_flag() do?
get_tolerance_and_cosine_flag() is a function in the pytorch codebase.
What does get_tolerance_and_cosine_flag() call?
get_tolerance_and_cosine_flag() calls 1 function(s): get_tolerance_and_cosine_flag.

Analyze Your Own Codebase

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

Try Supermodel Free