Git Product home page Git Product logo

sagemaker-debugger-rulesconfig's Introduction

Amazon SageMaker Debugger RulesConfig

Amazon SageMaker Debugger is designed to be a debugger for machine learning models. It lets you go beyond just looking at scalars like losses and accuracies during training and gives you full visibility into all tensors 'flowing through the graph' during training or inference.

Amazon SageMaker Debugger RulesConfig provides a mapping of builtin rules with default configurations. These configurations will affect both DebugHookConfig and DebugRuleConfigurations in the Amazon SageMaker Python SDK.

This library, intended to be used with Amazon SageMaker Python SDK, helps you specify builtin rules without worrying about any details or tweak the configuration of builtin rules. These builtin rules are available in Amazon SageMaker.

Amazon SageMaker Debugger Rulesconfig package can be used with Amazon SageMaker Debugger or as stand-alone rule config retriever. In addition to retrieving builtin rules, configuration for common collections can be retrieved as well.

Example: Vanilla builtin rule without customization

from sagemaker.debugger import Rule, rule_configs

my_estimator = Estimator(
    ...
    rules=[Rule.sagemaker(rule_configs.vanishing_gradient())]
)

Example: Builtin rule with customization. For more details please refer to Amazon SageMaker Python SDK documentation.

from sagemaker.debugger import Rule, CollectionConfig, rule_configs

my_estimator = Estimator(
    ...
    rules= [
        Rule.sagemaker(
            base_config=rule_configs.weight_update_ratio(),
            name="my_wup_rule_name",            # Optional
            container_local_path="/local/path", # Optional
            s3_output_path="s3://uri",          # Optional
            rule_parameters={
                "param1": "value1",
                "param2": "value2"
            }, # Optional
            collections_to_save=[
                CollectionConfig(
                    name="my_name",  # Required. If specified, debugger will collect tensors for this collection. Users may have to update rule_parameters above to run the rule on right tensors.
                    parameters= {
                        "param1": "value1",
                        "param2": "value2"
                    }  # Optional
                )
            ],
        )
    ]
)

License

This project is licensed under the Apache-2.0 License.

sagemaker-debugger-rulesconfig's People

Contributors

amazon-auto avatar jarednielsen avatar jigsaw004 avatar leleamol avatar mchoi8739 avatar ndodda-amazon avatar nihalharish avatar nrauschmayr avatar rahul003 avatar vandanavk avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

sagemaker-debugger-rulesconfig's Issues

Syntax warning that will become an error

With Python 3.12.2, when I import the ,sagemaker sdk, an import of this package is triggered and I see

***/site-packages/smdebug_rulesconfig/actions/utils.py:6: SyntaxWarning: invalid escape sequence '\w'
  EMAIL_ADDRESS_REGEX = "^[a-z0-9]+[@]\w+[.]\w{2,3}$"

and a few others. For proper escaping, I think the easiest is to use raw strings, like EMAIL_ADDRESS_REGEX = r"^[a-z0-9]+[@]\w+[.]\w{2,3}$", which should be fairly backwards compatible.

Also note that in the future, this warning will become an error:

Changed in version 3.12: Octal escapes with value larger than 0o377 produce a SyntaxWarning. In a future Python version they will be eventually a SyntaxError.

Note this may conflict with the open PR #37.

Modify EMAIL_ADDRESS_REGEX

In validate_email_address, it checks if EMAIL_ADDRESS_REGEX and the email address in the argument match, but the result is false for email addresses like [email protected]. Can you please fix this so that the result is true for email addresses with the above pattern?

Update the ruleConfigs.json

I am working on adding code snippets of rule configuration to the Debugger dev guide.
I am referring to the following source codes in order to see what default collections are taken by each rule.

In the ruleConfigs.json, some rules have default collections, but some are missing them.
I suggest to add a default tensor collection to those rules that currently don't have it.

For example, in order for the XGBoost TreeDepth rule to work, we need to add the tree collection by default as following:

  "TreeDepth": {
    "DebugRuleConfiguration": {
      "RuleConfigurationName": "TreeDepth",
      "RuleParameters": {
        "rule_to_invoke": "TreeDepth"
      }
    },
    "CollectionConfigurations": [
      {
        "CollectionName": "tree",
        "CollectionParameters": {
          "save_interval": "500"
        }
      }
    ]
  },

StalledTrainingRule cannot be imported

I was reviewing the new notebook regarding StalledTrainingRule.
This is a new built-in 1p rule, and I wonder why the way to call this rule is different from other existing built-in rules.
I cannot call it simply by using the following method:

from sagemaker.debugger import Rule, rule_configs

stalled_training_job_rule = [Rule.sagemaker(rule_configs.stalled_training_rule())]

And the rule also cannot be imported by running the following code in a JupyterLab notebook cell:

from smdebug_rulesconfig import stalled_training_rule

Error message:

ImportErrorTraceback (most recent call last)
<ipython-input-22-1af5fa9dfa3f> in <module>()
----> 1 from smdebug_rulesconfig import stalled_training_rule

ImportError: cannot import name stalled_training_rule

I made sure to install smdebug-rulesconfig-0.1.4, and this problem still persists.

It would be nice if the way to use this stalled_training_rule is as same as using the existing built-in rules.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.