| FazBrowse GitHub Viewer | Trending | | Home |
| Tools: [Download Repo ZIP] [Original HTTPS Page] |
| Name | Name | Last commit date | ||
|---|---|---|---|---|
parent directory.. | ||||
This is an example to demonstrate how to use Analytics-Zoo's TFPark API to run distributed Tensorflow and Keras on Spark/BigDL.
Follow the instructions here to install analytics-zoo via pip or download the prebuilt package.
In this example, we will use the slim library to construct the model. You can clone it here and the research/slim directory to PYTHONPATH.
git clone https://github.com/tensorflow/models/
export PYTHONPATH=$PWD/models/research/slim:$PYTHONPATHUsing TFDataset as data input
export MASTER=local[4]
python keras/keras_dataset.pyUsing numpy.ndarray as data input
export MASTER=local[4]
python keras/keras_ndarray.pyUsing TFDataset as data input
export ANALYTICS_ZOO_HOME=... # the directory where you extract the downloaded Analytics Zoo zip package
export SPARK_HOME=... # the root directory of Spark
bash $ANALYTICS_ZOO_HOME/bin/spark-submit-python-with-zoo.sh --master local[4] keras/keras_dataset.pyUsing numpy.ndarray as data input
export ANALYTICS_ZOO_HOME=... # the directory where you extract the downloaded Analytics Zoo zip package
export SPARK_HOME=... # the root directory of Spark
bash $ANALYTICS_ZOO_HOME/bin/spark-submit-python-with-zoo.sh --master local[4] keras/keras_ndarray.pyUsing TFDataset as data input
export MASTER=local[4]
export SPARK_DRIVER_MEMORY=2g
python estimator/estimator_dataset.pyUsing FeatureSet as data input
# the directory to the training data, the sub-directory of IMAGE_PATH should be
# different classes each containing the images of that class.
# e.g.
# IMAGE_PATH=file:///cat_dog
# NUM_CLASSES=2
# /cat_dog
# /cats
# cat.001.jpg
# /dogs
# dog.001.jpg
IMAGE_PATH=... # file://... for local files and hdfs:// for hdfs files
NUM_CLASSES=..
export MASTER=local[4]
export SPARK_DRIVER_MEMORY=10g
python estimator/estimator_inception.py --image-path $IMAGE_PATH --num-classes $NUM_CLASSESUsing TFDataset as data input
export ANALYTICS_ZOO_HOME=... # the directory where you extract the downloaded Analytics Zoo zip package
export SPARK_HOME=... # the root directory of Spark
bash $ANALYTICS_ZOO_HOME/bin/spark-submit-python-with-zoo.sh --master local[4] --driver-memory 2g estimator/estimator_dataset.pyUsing FeatureSet as data input
export ANALYTICS_ZOO_HOME=... # the directory where you extract the downloaded Analytics Zoo zip package
export SPARK_HOME=... # the root directory of Spark
# the directory to the training data, the sub-directory of IMAGE_PATH should be
# different classes each containing the images of that class.
# e.g.
# IMAGE_PATH=file:///cat_dog
# NUM_CLASSES=2
# /cat_dog
# /cats
# cat.001.jpg
# /dogs
# dog.001.jpg
IMAGE_PATH=... # file://... for local files and hdfs:// for hdfs files
NUM_CLASSES=..
bash $ANALYTICS_ZOO_HOME/bin/spark-submit-python-with-zoo.sh --master local[4] --driver-memory 10g estimator/estimator_inception.py --image-path $IMAGE_PATH --num-classes $NUM_CLASSESexport SPARK_MASTER=local[4]
export SPARK_DRIVER_MEMORY=2g
python tf_optimzer/train_lenet.pyexport ANALYTICS_ZOO_HOME=... # the directory where you extract the downloaded Analytics Zoo zip package
export SPARK_HOME=... # the root directory of Spark
bash $ANALYTICS_ZOO_HOME/bin/spark-submit-python-with-zoo.sh --master local[4] --driver-memory 2g tf_optimizer/train_lenet.pyexport SPARK_MASTER=local[4]
export SPARK_DRIVER_MEMEORY=2g
python tf_optimizer/evaluate_lenet.pyexport ANALYTICS_ZOO_HOME=... # the directory where you extract the downloaded Analytics Zoo zip package
export SPARK_HOME=... # the root directory of Spark
bash $ANALYTICS_ZOO_HOME/bin/spark-submit-python-with-zoo.sh --master local[4] --driver-memory 2g tf_optimizer/evaluate_lenet.pyPlease first install tensorflow_gan to run this example. (pip install tensorflow_probability==0.7.0 tensorflow_datasets==2.0.0 tensorflow_gan==2.0.0)
export MASTER=local[1]
python gan/gan_train_and_evaluate.pyThe training program will generate a TensorFlow checkpoint at /tmp/gan_model and every 1000 steps will generate 50 hand-written digits and save them in a single image in the current directory.
The following is the generated image after 20000 steps.
Please first install tensorflow_gan to run this example. (pip install tensorflow_gan==2.0.0)
export ANALYTICS_ZOO_HOME=... # the directory where you extract the downloaded Analytics Zoo zip package
export SPARK_HOME=... # the root directory of Spark
bash $ANALYTICS_ZOO_HOME/bin/spark-submit-python-with-zoo.sh --master local[1] gan/gan_train_and_evaluate.pyThe training program will generate a TensorFlow checkpoint at /tmp/gan_model and every 1000 steps will generate 50 hand-written digits and save them in a single image in the current directory.
The following is the generated image after 20000 steps.
| Back | FazBrowse Home | New Git URL |