mirror of
https://github.com/wassname/ray.git
synced 2026-06-29 05:34:49 +08:00
[tune] Add Fractional GPU example/docs (#3169)
* Add example for fractional GPU support * Update tune_mnist_keras.py * Update doc/source/tune-usage.rst
This commit is contained in:
@@ -105,6 +105,8 @@ def create_parser():
|
||||
parser = argparse.ArgumentParser(description='Keras MNIST Example')
|
||||
parser.add_argument(
|
||||
"--smoke-test", action="store_true", help="Finish quickly for testing")
|
||||
parser.add_argument(
|
||||
"--use-gpu", action="store_true", help="Use GPU in training.")
|
||||
parser.add_argument(
|
||||
'--jobs',
|
||||
type=int,
|
||||
@@ -113,8 +115,8 @@ def create_parser():
|
||||
parser.add_argument(
|
||||
'--threads',
|
||||
type=int,
|
||||
default=None,
|
||||
help='threads used in operations (default: all)')
|
||||
default=2,
|
||||
help='threads used in operations (default: 2)')
|
||||
parser.add_argument(
|
||||
'--steps',
|
||||
type=float,
|
||||
@@ -185,6 +187,10 @@ if __name__ == '__main__':
|
||||
},
|
||||
"run": "train_mnist",
|
||||
"num_samples": 1 if args.smoke_test else 10,
|
||||
"trial_resources": {
|
||||
"cpu": args.threads,
|
||||
"gpu": 0.5 if args.use_gpu else 0
|
||||
},
|
||||
"config": {
|
||||
"lr": lambda spec: np.random.uniform(0.001, 0.1),
|
||||
"momentum": lambda spec: np.random.uniform(0.1, 0.9),
|
||||
|
||||
Reference in New Issue
Block a user