Registry / aws / smdebug-rulesconfig

smdebug-rulesconfig

JSON →
library1.0.1pypypi✓ verified 25d ago

SMDebug RulesConfig is a Python library that provides a mapping of built-in rules with default configurations for Amazon SageMaker Debugger. It helps users specify these rules and common collection configurations without needing to handle low-level details, working in conjunction with the Amazon SageMaker Python SDK. The current version is 1.0.1, released in December 2020. While the package itself has not seen recent updates, its functionality remains an integral part of the SageMaker Debugger ecosystem.

pip install smdebug-rulesconfig
INSTALL
IMPORT
SIG · SMDEBUG-RULESCONFI
S
smdebug-rulesconfig
awspythonv1.0.1
Install
1.6s avg
Import
Disk
16MB
Pass rate
10/ 10
Env Coverage10 / 10
glibc
3.93.13
musl
3.93.13
Install & Compatibility
Where this runs
tested against v1.0.1 · pip install
no network on importno background threads
Install × environment matrix
Each cell = how many times install + import succeeded across repeated harness runs. Partial = flaky.
glibc = Debian/Ubuntu slim · musl = Alpine Linux
musl
py 3.103.95 runs
installs and imports cleanly · install 0.0s · import 0.000s · 18MB
glibc
py 3.103.95 runs
installs and imports cleanly · install 1.6s · import 0.000s · 19MB
16MB installed
● package 16MB
Code
Verified usage

Verified import paths — ran on the pinned version, not inferred.

rule_configs
from sagemaker.debugger import Rule, CollectionConfig, rule_configs
The `rule_configs` object provides access to built-in debugger rule configurations. `Rule` and `CollectionConfig` are typically imported alongside for full rule definition within the SageMaker Python SDK.

This quickstart demonstrates how to instantiate built-in SageMaker Debugger rules using `smdebug-rulesconfig` via the `sagemaker.debugger` module. It shows both a basic rule configuration and a more advanced example with custom parameters and tensor collection specifications, which are typically passed to a SageMaker Estimator.

from sagemaker.debugger import Rule, CollectionConfig, rule_configs from sagemaker.estimator import Estimator # Placeholder for a SageMaker Estimator import os # In a real scenario, replace this with your actual SageMaker Estimator setup # and ensure AWS credentials are configured (e.g., via environment variables or AWS CLI) # For example: estimator = TensorFlow(role=os.environ.get('SAGEMAKER_ROLE', 'arn:aws:iam::123456789012:role/SageMakerRole'), ...) # We use a placeholder here for quickstart reproducibility. # Example: Vanilla built-in rule without customization # This would typically be passed to a SageMaker Estimator's 'rules' parameter. rule_vanishing_gradient = Rule.sagemaker(rule_configs.vanishing_gradient()) print(f"Vanishing Gradient Rule: {rule_vanishing_gradient.name}") # Example: Built-in rule with customization # This demonstrates how to customize a rule's parameters and collections. rule_customized_weight_update = Rule.sagemaker( base_config=rule_configs.weight_update_ratio(), name="my_custom_wup_rule", # Optional # container_local_path="/local/path", # Optional, if running locally or specific container path # s3_output_path="s3://your-s3-bucket/debug-output/", # Optional, overrides default rule_parameters={ "threshold": "0.001" # Example parameter customization }, collections_to_save=[ CollectionConfig( name="weights", # Required. Debugger will collect tensors for this collection. parameters={ "save_interval": "100" # Example collection parameter } ) ] ) print(f"Customized Weight Update Ratio Rule: {rule_customized_weight_update.name}") print(f" Rule parameters: {rule_customized_weight_update.rule_parameters}") print(f" Collections to save: {[c.name for c in rule_customized_weight_update.collections_to_save]}")
Debug
Known issues
breakingMajor version 1.0.0 introduced the ability to specify profiler rules, and 1.0.1 added action classes for rules (e.g., `StopTraining`, `Email`). While older rule definitions might still work, new features and potentially updated underlying behavior for rule processing necessitate awareness of these version changes when upgrading or using new capabilities.
fix
Review SageMaker Python SDK and `smdebug` documentation for best practices when upgrading, especially concerning profiler rules and rule actions. Ensure your `sagemaker` and `smdebug` client libraries are also up-to-date.
affects: <1.0.0
gotchaThis library (smdebug-rulesconfig) is tightly integrated with the Amazon SageMaker Python SDK and the `smdebug` client library. To utilize the latest Debugger features and ensure compatibility, it is crucial to keep both `sagemaker` and `smdebug` packages updated in your environment, not just `smdebug-rulesconfig`.
fix
Always run `pip install -U sagemaker smdebug` alongside `pip install -U smdebug-rulesconfig` to ensure all components are at compatible and recent versions.
affects: All versions
gotchaThe SageMaker DebuggerHookConfig is initialized by default for framework estimators (e.g., TensorFlow, PyTorch) to minimize code changes for debugging. If you do not intend to use Debugger, you must explicitly disable the hook.
fix
Set `debugger_hook_config=False` when initializing your SageMaker framework estimator, e.g., `estimator = TensorFlow(..., debugger_hook_config=False)`.
affects: All versions
gotchaThe `smdebug-rulesconfig` library focuses on *configuring* rules. The actual execution and analysis of these rules occur within the broader Amazon SageMaker Debugger service, often leveraging the `smdebug` client library for data retrieval and custom rule logic. Confusing these roles can lead to unexpected behavior if not properly integrated into a SageMaker training job.
fix
Understand that `smdebug-rulesconfig` provides the rule definitions, which are then passed to a SageMaker Estimator. SageMaker handles running these rules. For local or custom analysis, the `smdebug` client library is used to read debug data. Refer to the SageMaker Debugger developer guide for a comprehensive understanding of the workflow.
affects: All versions
Upgrade
Version history
1.0.1latest on PyPI · released Dec 18, 2020
Audit
Dependencies

No dependency data recorded yet.

Agent activity
10 hits · last 30 days
node
8
OpenAI (training)
1
Resources