Install
openclaw skills install kerasBuild, train, and debug deep learning models with Keras patterns, layer recipes, and training diagnostics.
openclaw skills install kerasOn first use, check setup.md for integration guidelines. The skill stores preferences in ~/keras/ when the user confirms.
User builds neural networks with Keras or TensorFlow. Agent handles model architecture, layer configuration, training loops, callbacks, debugging loss issues, and deployment preparation.
Memory lives in ~/keras/. See memory-template.md for setup.
~/keras/
├── memory.md # Preferred architectures, hyperparams
└── models/ # Saved model configs (optional)
| Topic | File |
|---|---|
| Setup process | setup.md |
| Memory template | memory-template.md |
| Layer patterns | layers.md |
| Training diagnostics | training.md |
| Common architectures | architectures.md |
# Sequential - simple stack
model = keras.Sequential([
layers.Dense(64, activation='relu'),
layers.Dense(10, activation='softmax')
])
# Functional - flexible graphs
inputs = keras.Input(shape=(784,))
x = layers.Dense(64, activation='relu')(inputs)
outputs = layers.Dense(10, activation='softmax')(x)
model = keras.Model(inputs, outputs)
input_shape (exclude batch)(height, width, channels) for channels_last(timesteps, features)(features,)# Image input
layers.Conv2D(32, 3, input_shape=(224, 224, 3))
# Sequence input
layers.LSTM(64, input_shape=(100, 50)) # 100 timesteps, 50 features
# Tabular input
layers.Dense(64, input_shape=(20,)) # 20 features
| Task | Output Activation | Loss |
|---|---|---|
| Binary classification | sigmoid | binary_crossentropy |
| Multi-class | softmax | categorical_crossentropy |
| Multi-label | sigmoid | binary_crossentropy |
| Regression | linear (none) | mse or mae |
Apply in this order for overfitting:
layers.Dense(64, activation='relu', kernel_regularizer=keras.regularizers.l2(0.01))
layers.Dropout(0.3)
layers.BatchNormalization()
callbacks = [
keras.callbacks.EarlyStopping(
monitor='val_loss', patience=5, restore_best_weights=True
),
keras.callbacks.ModelCheckpoint(
'best_model.keras', save_best_only=True
),
keras.callbacks.ReduceLROnPlateau(
monitor='val_loss', factor=0.5, patience=3
),
keras.callbacks.TensorBoard(log_dir='./logs')
]
# tf.data for performance
dataset = tf.data.Dataset.from_tensor_slices((x, y))
dataset = dataset.shuffle(10000).batch(32).prefetch(tf.data.AUTOTUNE)
# ImageDataGenerator for augmentation
datagen = keras.preprocessing.image.ImageDataGenerator(
rotation_range=20,
horizontal_flip=True,
validation_split=0.2
)
model.compile(
optimizer=keras.optimizers.Adam(learning_rate=0.001),
loss='categorical_crossentropy',
metrics=['accuracy']
)
Input shape mismatch → check data shape vs model input_shape, exclude batch dimLoss is NaN → reduce learning rate, check for inf/nan in data, add gradient clippingValidation loss diverges → add regularization, reduce model capacity, more dataModel not learning → check labels are correct, verify loss function matches taskGPU OOM → reduce batch size, use mixed precision, gradient checkpointingSlow training → use tf.data pipeline with prefetch, enable XLA compilation| Endpoint | Data Sent | Purpose |
|---|---|---|
| TensorFlow model hub | None (download only) | Pretrained weights when using weights='imagenet' |
Note: Transfer learning examples download pretrained weights on first use. Use weights=None for fully offline operation.
Data that stays local:
~/keras/This skill does NOT:
~/keras/ and working directoryInstall with clawhub install <slug> if user confirms:
tensorflow — TensorFlow operations and deploymentpytorch — Alternative deep learning frameworkai — General AI and ML patternsmodels — Model architecture designclawhub star kerasclawhub sync