|
48 | 48 | from torch.utils.data import random_split
|
49 | 49 | import torchvision
|
50 | 50 | import torchvision.transforms as transforms
|
| 51 | +# sphinx_gallery_start_ignore |
| 52 | +# Fixes ``AttributeError: '_LoggingTee' object has no attribute 'fileno'``. |
| 53 | +# This is only needed to run with sphinx-build. |
| 54 | +import sys |
| 55 | +if not hasattr(sys.stdout, "encoding"): |
| 56 | + sys.stdout.encoding = "latin1" |
| 57 | + sys.stdout.fileno = lambda: 0 |
| 58 | +# sphinx_gallery_end_ignore |
51 | 59 | from ray import tune
|
52 | 60 | from ray.air import Checkpoint, session
|
53 | 61 | from ray.tune.schedulers import ASHAScheduler
|
54 | 62 |
|
| 63 | +# TODO: Migrate to ray.train.Checkpoint and remove following line |
| 64 | +os.environ["RAY_AIR_NEW_PERSISTENCE_MODE"]="0" |
| 65 | + |
55 | 66 | ######################################################################
|
56 | 67 | # Most of the imports are needed for building the PyTorch model. Only the last three
|
57 | 68 | # imports are for Ray Tune.
|
@@ -448,13 +459,6 @@ def main(num_samples=10, max_num_epochs=10, gpus_per_trial=2):
|
448 | 459 |
|
449 | 460 |
|
450 | 461 | if __name__ == "__main__":
|
451 |
| - # sphinx_gallery_start_ignore |
452 |
| - # Fixes ``AttributeError: '_LoggingTee' object has no attribute 'fileno'``. |
453 |
| - # This is only needed to run with sphinx-build. |
454 |
| - import sys |
455 |
| - |
456 |
| - sys.stdout.fileno = lambda: False |
457 |
| - # sphinx_gallery_end_ignore |
458 | 462 | # You can change the number of GPUs per trial here:
|
459 | 463 | main(num_samples=10, max_num_epochs=10, gpus_per_trial=0)
|
460 | 464 |
|
|
0 commit comments