TensorFlow Environment
Deploy GPU instances with TensorFlow pre-configured for immediate AI/ML development.
What's Included
Core Frameworks:- TensorFlow 2.x with GPU support
- Keras (high-level neural networks API)
- CUDA and cuDNN pre-configured
- Jupyter Notebook for interactive development
- TensorBoard for visualization
- NumPy, Pandas, Matplotlib
- scikit-learn for traditional ML
- Ubuntu 22.04 or 24.04 LTS
- NVIDIA drivers and CUDA toolkit
- Python 3.9-3.11
- pip and conda package managers
Deploying TensorFlow Environment
Select Environment
- Go to app.spheron.ai → Deploy
- Choose your GPU
- Select OS: Ubuntu 24.04 LTS ML TensorFlow or Ubuntu 22.04 LTS + TensorFlow
- Deploy
Instance ready in 30-60 seconds.
Connect via SSH
ssh root@your-instance-ipVerify Installation
# Check TensorFlow
python3 -c "import tensorflow as tf; print(f'TensorFlow version: {tf.__version__}')"
python3 -c "import tensorflow as tf; print(f'GPU available: {tf.config.list_physical_devices('GPU')}')"
# Check CUDA
nvcc --version
# Check GPU
nvidia-smiQuick Start Examples
Run TensorFlow Test
import tensorflow as tf
# Verify GPU
print("Num GPUs Available:", len(tf.config.list_physical_devices('GPU')))
# Simple computation test
with tf.device('/GPU:0'):
a = tf.constant([[1.0, 2.0], [3.0, 4.0]])
b = tf.constant([[1.0, 1.0], [0.0, 1.0]])
c = tf.matmul(a, b)
print(c)Train Simple Model
import tensorflow as tf
from tensorflow import keras
# Load dataset
mnist = keras.datasets.mnist
(x_train, y_train), (x_test, y_test) = mnist.load_data()
x_train, x_test = x_train / 255.0, x_test / 255.0
# Build model
model = keras.Sequential([
keras.layers.Flatten(input_shape=(28, 28)),
keras.layers.Dense(128, activation='relu'),
keras.layers.Dropout(0.2),
keras.layers.Dense(10)
])
# Compile and train
model.compile(optimizer='adam',
loss=tf.keras.losses.SparseCategoricalCrossentropy(from_logits=True),
metrics=['accuracy'])
model.fit(x_train, y_train, epochs=5)Start Jupyter Notebook
# Install Jupyter if not included
pip install jupyter
# Start Jupyter (accessible from browser)
jupyter notebook --ip=0.0.0.0 --port=8888 --no-browser --allow-rootAccess at: http://your-instance-ip:8888
Common Packages
Install additional packages as needed:
# Computer vision
pip install opencv-python pillow
# Data processing
pip install pandas numpy scipy
# Model optimization
pip install tensorflow-model-optimization
# TensorFlow Datasets
pip install tensorflow-datasets
# Visualization
pip install tensorboard seabornUse Cases
Production Deployment - Enterprise-grade model serving
Computer Vision - Image classification, object detection
NLP - Text analysis, sentiment analysis
Time Series - Forecasting and prediction
Mobile AI - TensorFlow Lite model development
Troubleshooting
GPU not detected by TensorFlow:# Check GPU visibility
python3 -c "import tensorflow as tf; print(tf.config.list_physical_devices('GPU'))"
# Reinstall TensorFlow with GPU support
pip uninstall tensorflow
pip install tensorflow[and-cuda]- Check TensorFlow compatibility: TensorFlow GPU support
- Use compatible CUDA version for your TensorFlow release
- Reduce batch size
- Enable memory growth:
tf.config.experimental.set_memory_growth(gpu, True) - Monitor with:
nvidia-smi -l 1
Additional Resources
- TensorFlow Official Docs
- Keras Documentation
- Getting Started - Deploy your first instance
- Quick Start - Fast deployment guide
- API Reference - Automate deployments