Skip to content

Commit 09ca805

Browse files
jarednielsenrahul003
authored andcommitted
Remove trailing whitespace and newlines in all files. (aws#232)
This is necessary to prevent a massive merge conflict in my next PR.
1 parent 4f1b4be commit 09ca805

File tree

119 files changed

+885
-921
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

119 files changed

+885
-921
lines changed

NOTICE

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,2 @@
11
Tornasole_core
2-
Copyright 2019 Amazon.com, Inc. or its affiliates. All Rights Reserved.
2+
Copyright 2019 Amazon.com, Inc. or its affiliates. All Rights Reserved.

README.md

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,32 +1,32 @@
11
## Tornasole
22

3-
Tornasole is an upcoming AWS service designed to be a debugger
4-
for machine learning models. It lets you go beyond just looking
5-
at scalars like losses and accuracies during training and
6-
gives you full visibility into all tensors 'flowing through the graph'
3+
Tornasole is an upcoming AWS service designed to be a debugger
4+
for machine learning models. It lets you go beyond just looking
5+
at scalars like losses and accuracies during training and
6+
gives you full visibility into all tensors 'flowing through the graph'
77
during training or inference.
88

99
Using Tornasole is a two step process:
1010

1111
### Saving tensors
1212

13-
This needs the `tornasole` package built for the appropriate framework.
14-
It allows you to collect the tensors you want at the frequency
15-
that you want, and save them for analysis.
13+
This needs the `tornasole` package built for the appropriate framework.
14+
It allows you to collect the tensors you want at the frequency
15+
that you want, and save them for analysis.
1616
Please follow the appropriate Readme page to install the correct version.
17-
17+
1818

1919
#### [Tornasole TensorFlow](docs/tensorflow/README.md)
2020
#### [Tornasole MXNet](docs/mxnet/README.md)
2121
#### [Tornasole PyTorch](docs/pytorch/README.md)
2222
#### [Tornasole XGBoost](docs/xgboost/README.md)
2323

2424
### Analysis
25-
Please refer **[this page](docs/rules/README.md)** for more details about how to analyze.
26-
The analysis of these tensors can be done on a separate machine in parallel with the training job.
25+
Please refer **[this page](docs/rules/README.md)** for more details about how to analyze.
26+
The analysis of these tensors can be done on a separate machine in parallel with the training job.
2727

2828
## ContactUs
2929
We would like to hear from you. If you have any question or feedback, please reach out to us [email protected]
3030

3131
## License
32-
This library is licensed under the Apache 2.0 License.
32+
This library is licensed under the Apache 2.0 License.

bin/build_binaries.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -47,4 +47,4 @@
4747
# remove other versions
4848
subprocess.check_call(['aws', 's3', 'rm', '--recursive', '--exclude', 'tornasole-{}*'.format(VERSION),
4949
's3://tornasole-binaries-use1/tornasole_{}/py3/latest/'.format(b)])
50-
subprocess.check_call(['rm', '-rf', 'dist', 'build', '*.egg-info', '.eggs'])
50+
subprocess.check_call(['rm', '-rf', 'dist', 'build', '*.egg-info', '.eggs'])

bin/sagemaker-containers/mxnet/1.4.1/build.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,4 +37,4 @@ build() {
3737
build cpu &
3838
build gpu &
3939

40-
wait
40+
wait

bin/sagemaker-containers/permissions.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,4 +24,4 @@
2424
]
2525
}
2626
]
27-
}
27+
}

bin/sagemaker-containers/pytorch/1.1.0/build.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -46,4 +46,4 @@ build() {
4646

4747
build cpu &
4848
build gpu &
49-
wait
49+
wait

bin/sagemaker-containers/tensorflow/tf-train.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@
1212
parser.add_argument('--tornasole_frequency', type=float, help="How often to save TS data", default=10 )
1313
parser.add_argument('--run_name', type=str, help="Run Name", default=str(uuid.uuid4()) )
1414
parser.add_argument('--local_reductions', nargs='+', type=str, default=[] )
15-
# running in Tf estimator mode, script need to accept --model_dir parameter
15+
# running in Tf estimator mode, script need to accept --model_dir parameter
1616
parser.add_argument('--model_dir', type=str, help="model dir", default=str(uuid.uuid4()) )
1717
args = parser.parse_args()
1818
# Network definition
@@ -31,7 +31,7 @@
3131
graph = tf.get_default_graph()
3232
list_of_tuples = [op.outputs for op in graph.get_operations()]
3333
t = str(time.time())
34-
hook = TornasoleHook("s3://tornasolecodebuildtest/container_testing/ts_outputs/tf"+t,
34+
hook = TornasoleHook("s3://tornasolecodebuildtest/container_testing/ts_outputs/tf"+t,
3535
save_config=SaveConfig(save_interval=10))
3636
sess = tf.train.MonitoredSession(hooks=[hook])
3737
for i in range(args.steps):

config/buildspec.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ phases:
2020

2121
pre_build:
2222
commands:
23-
23+
2424
build:
2525
commands:
2626
- cd $CODEBUILD_SRC_DIR && python setup.py bdist_wheel --universal && pip install dist/*.whl && cd ..

config/protoc_downloader.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,4 +5,4 @@ PROTOC_ZIP=protoc-3.7.1-linux-x86_64.zip
55
curl -OL https://github.com/google/protobuf/releases/download/v3.7.1/$PROTOC_ZIP
66
unzip -o $PROTOC_ZIP -d /usr/local bin/protoc
77
unzip -o $PROTOC_ZIP -d /usr/local include/*
8-
rm -f $PROTOC_ZIP
8+
rm -f $PROTOC_ZIP

config/upload_on_end.sh

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,4 +28,3 @@ else
2828
upload_dirs integration_tests_logs pytest_reports wheels
2929
echo "INFO BUILD SUCCEEDED !!! , ACCESS BUILD LOGS THROUGH GITHUB OR TROUGH THE LINK PR:$GITHUB_PR_URL . CODEBUILD:$CODEBUILD_BUILD_URL. Test logs are on S3 here:$S3_TEST_REPORT_URL"
3030
fi
31-

docs/mxnet/README.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,7 @@ pip install tornasole_mxnet/*
4949
**Please note** : If, while installing tornasole, you get a version conflict issue between botocore and boto3,
5050
you might need to run the following
5151
```
52-
pip uninstall -y botocore boto3 aioboto3 aiobotocore && pip install botocore==1.12.91 boto3==1.9.91 aiobotocore==0.10.2 aioboto3==6.4.1
52+
pip uninstall -y botocore boto3 aioboto3 aiobotocore && pip install botocore==1.12.91 boto3==1.9.91 aiobotocore==0.10.2 aioboto3==6.4.1
5353
```
5454

5555
## Quickstart
@@ -271,7 +271,7 @@ hook = TornasoleHook(out_dir=out_dir, include_collections=['weights', 'bias','gr
271271
'default', 'ReluActivation', 'flatten'])
272272
```
273273

274-
Refer [API](api.md) for a list of the reductions available as well as examples.
274+
Refer [API](api.md) for a list of the reductions available as well as examples.
275275

276276

277277
### How to save tensors

docs/mxnet/api.md

Lines changed: 52 additions & 52 deletions
Original file line numberDiff line numberDiff line change
@@ -5,71 +5,71 @@ Tornasole MXNet provides the following constructs:
55
TornasoleHook is the entry point for Tornasole into your program.
66

77
```
8-
8+
99
class TornasoleHook
1010
"""
11-
A class used to represent the hook which gets attached to the
12-
training process.
13-
14-
15-
11+
A class used to represent the hook which gets attached to the
12+
training process.
13+
14+
15+
1616
Attributes
1717
----------
1818
out_dir : str
1919
represents a path to which the outputs of tornasole will be written to.
2020
This can be a local path or an S3 prefix of the form s3://bucket_name/prefix.
21-
Note that for Sagemaker, you always need to specify the out_dir as `/opt/ml/output/tensors`.
22-
In the future, we will make this the default in Sagemaker environments.
23-
21+
Note that for Sagemaker, you always need to specify the out_dir as `/opt/ml/output/tensors`.
22+
In the future, we will make this the default in Sagemaker environments.
23+
2424
dry_run : bool
2525
when dry_run is set to True, behavior is only described in the log file.
26-
The tensors are not actually saved.
27-
26+
The tensors are not actually saved.
27+
2828
worker: str
2929
name of worker in a multi process training job
3030
outputs and tensors are organized by this name during retrieval.
31-
31+
3232
save_config: SaveConfig object or a dictionary from mode to SaveConfig objects
33-
SaveConfig allows you to customize when tensors are saved.
34-
Hook takes SaveConfig object which is applied as
33+
SaveConfig allows you to customize when tensors are saved.
34+
Hook takes SaveConfig object which is applied as
3535
default for all included tensors.
36-
A collection can optionally have its own SaveConfig object
36+
A collection can optionally have its own SaveConfig object
3737
which overrides this for its tensors.
3838
If you pass a dictionary from mode->SaveConfig, then that
3939
SaveConfig is applied to tensors included for that mode.
40-
example: {modes.TRAIN: SaveConfig(save_interval=10),
40+
example: {modes.TRAIN: SaveConfig(save_interval=10),
4141
modes.EVAL:SaveConfig(save_interval=1)}
4242
Refer to documentation for SaveConfig.
43-
43+
4444
reduction_config: ReductionConfig object
45-
ReductionConfig allows you to save tensors as their reductions
46-
instead of saving full tensors.
45+
ReductionConfig allows you to save tensors as their reductions
46+
instead of saving full tensors.
4747
If ReductionConfig is passed then the chosen reductions are applied
4848
as default for all tensors included.
4949
A collection can optionally have its own ReductionConfig object
50-
which overrides this for its tensors.
51-
50+
which overrides this for its tensors.
51+
5252
include_regex: list of str
5353
takes as input the list of string representing regular expressions. Tensors whose names match
5454
these regular expressions will be saved. These tensors will be available as part of the `default`
5555
collection.
56-
56+
5757
include_collections: list of str
5858
takes as input the names of collections which should be saved.
5959
by default, ['weights','gradients', 'bias', 'default'] are passed to include_collections.
60-
60+
6161
save_all: bool
6262
a shortcut for saving all tensors in the model.
6363
tensors are all grouped into the `default` collection
64-
64+
6565
def __init__(self,
6666
out_dir,
6767
dry_run=False,
6868
worker='worker0',
6969
reduction_config=None,
7070
save_config=SaveConfig(save_interval=100),
7171
include_regex=None,
72-
include_collections=['weights', 'gradients', 'bias', 'default'],
72+
include_collections=['weights', 'gradients', 'bias', 'default'],
7373
save_all=False,
7474
):
7575
```
@@ -96,10 +96,10 @@ The _reduction\_config_ is optional. If not specified, the reductions are not ap
9696

9797
### Collection
9898

99-
Collection object helps group tensors for easier handling of tensors being saved.
100-
A collection has its own list of tensors, include/exclude regex patterns, reduction config and save config.
101-
This allows setting of different save and reduction configs for different tensors.
102-
These collections are then also available during analysis with `tornasole_rules`.
99+
Collection object helps group tensors for easier handling of tensors being saved.
100+
A collection has its own list of tensors, include/exclude regex patterns, reduction config and save config.
101+
This allows setting of different save and reduction configs for different tensors.
102+
These collections are then also available during analysis with `tornasole_rules`.
103103

104104
#### Creating or accessing a collection
105105

@@ -131,75 +131,75 @@ The following methods can be called on a collection object.
131131
| ```coll.set_reduction_config()``` | Sets reduction config for the collection |
132132

133133
### SaveConfig
134-
SaveConfig class allows you to customize the frequency of saving tensors.
135-
The hook takes a SaveConfig object which is applied as
136-
default to all tensors included.
137-
A collection can also have its own SaveConfig object which is applied
134+
SaveConfig class allows you to customize the frequency of saving tensors.
135+
The hook takes a SaveConfig object which is applied as
136+
default to all tensors included.
137+
A collection can also have its own SaveConfig object which is applied
138138
to the tensors belonging to that collection.
139139

140-
SaveConfig also allows you to save tensors when certain tensors become nan.
140+
SaveConfig also allows you to save tensors when certain tensors become nan.
141141
This list of tensors to watch for is taken as a list of strings representing names of tensors.
142142

143143
```
144-
144+
145145
class SaveConfig:
146-
146+
147147
Attributes
148148
----------
149-
149+
150150
save_interval: int
151-
allows you to save every n steps by passing n to save_interval
152-
151+
allows you to save every n steps by passing n to save_interval
152+
153153
skip_num_steps: int
154154
allows you to avoid saving for the first n steps of the job.
155155
it defaults to 0, i.e. don't skip any steps in the beginning.
156-
156+
157157
save_steps: list of int
158158
save at all the steps given in this list.
159159
if this is given, it ignores the save_interval.
160-
160+
161161
when_nan: list of str representing name of tensor
162162
saves the tensors to which this saveConfig is attached
163163
whenever any of the tensors in this list become nan or infinite.
164164
This means that if your save_interval is set to 10, and 'loss' is in when_nan
165165
your tensors will be saved whenever save_interval is multiple of 10 as well as
166166
whenever loss becomes nan or infinite.
167-
```
167+
```
168168

169169
The default value of _save\_interval_ is 100. The TornasoleHook that uses a default SaveConfig object will store the tensors every 100th step.
170170

171171

172-
### ReductionConfig
172+
### ReductionConfig
173173
ReductionConfig allows the saving of certain reductions of tensors instead
174174
of saving the full tensor. The motivation here is to reduce the amount of data
175175
saved, and increase the speed in cases where you don't need the full
176176
tensor. The reduction operations which are computed in the training process
177-
and then saved.
178-
During analysis, these are available as reductions of the original tensor.
177+
and then saved.
178+
During analysis, these are available as reductions of the original tensor.
179179
Please note that using reduction config means that you will not have
180180
the full tensor available during analysis, so this can restrict what you can do with the tensor saved.
181-
The hook takes a ReductionConfig object which is applied as default to all tensors included.
182-
A collection can also have its own ReductionConfig object which is applied
181+
The hook takes a ReductionConfig object which is applied as default to all tensors included.
182+
A collection can also have its own ReductionConfig object which is applied
183183
to the tensors belonging to that collection.
184184

185185
```
186-
186+
187187
Attributes
188188
----------
189-
189+
190190
reductions: list of str
191191
takes list of names of reductions to be computed.
192192
should be one of 'min', 'max', 'median', 'mean', 'std', 'sum', 'prod'
193-
193+
194194
abs_reductions: list of str
195195
takes list of names of reductions to be computed after converting the tensor
196196
to abs(tensor) i.e. reductions are applied on the absolute values of tensor.
197197
should be one of 'min', 'max', 'median', 'mean', 'std', 'sum', 'prod'
198-
198+
199199
norms: list of str
200200
takes names of norms to be computed of the tensor.
201201
should be one of 'l1', 'l2'
202-
202+
203203
abs_norms: list of str
204204
takes names of norms to be computed of the tensor after taking absolute value
205205
should be one of 'l1', 'l2'

docs/pytorch/README.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,7 @@ pip install tornasole_pytorch/*
4949
**Please note** : If, while installing tornasole, you get a version conflict issue between botocore and boto3,
5050
you might need to run the following
5151
```
52-
pip uninstall -y botocore boto3 aioboto3 aiobotocore && pip install botocore==1.12.91 boto3==1.9.91 aiobotocore==0.10.2 aioboto3==6.4.1
52+
pip uninstall -y botocore boto3 aioboto3 aiobotocore && pip install botocore==1.12.91 boto3==1.9.91 aiobotocore==0.10.2 aioboto3==6.4.1
5353
```
5454

5555
## Quickstart
@@ -268,7 +268,7 @@ These reduction config instances can be passed to the hook as follows
268268
import tornasole.pytorch as ts
269269
hook = ts.TornasoleHook(..., reduction_config=ts.ReductionConfig(norms=['l1']), ...)
270270
```
271-
Refer [API](api.md) for a full list of the reductions available.
271+
Refer [API](api.md) for a full list of the reductions available.
272272

273273

274274
### How to save tensors

0 commit comments

Comments
 (0)