-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
3 changed files
with
49 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
from __future__ import absolute_import, division, print_function, unicode_literals | ||
import tensorflow as tf | ||
from tensorflow.keras import datasets, layers, models | ||
|
||
(train_images, train_labels), (test_images, test_labels) = datasets.cifar10.load_data() | ||
train_images, test_images = train_images / 255.0, test_images / 255.0 | ||
|
||
model = models.Sequential() | ||
model.add(layers.Conv2D(32, (3, 3), activation='relu', input_shape=(32, 32, 3))) | ||
model.add(layers.MaxPooling2D((2, 2))) | ||
model.add(layers.Conv2D(64, (3, 3), activation='relu')) | ||
model.add(layers.MaxPooling2D((2, 2))) | ||
model.add(layers.Conv2D(64, (3, 3), activation='relu')) | ||
model.add(layers.Flatten()) | ||
model.add(layers.Dense(64, activation='relu')) | ||
model.add(layers.Dense(10, activation='softmax')) | ||
|
||
model.compile(optimizer='adam', | ||
loss='sparse_categorical_crossentropy', | ||
metrics=['accuracy']) | ||
|
||
model.summary() | ||
|
||
history = model.fit(train_images, train_labels, epochs=10, | ||
validation_data=(test_images, test_labels)) | ||
|
||
test_loss, test_acc = model.evaluate(test_images, test_labels, verbose=2) | ||
|
||
print(test_acc) | ||
|
||
model.save('my_model.keras') | ||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
# TensorFlow example | ||
|
||
Simple example from the tutorial; make sure to use the datamover to pick up the cifar.py script | ||
|
||
``` | ||
sbatch -p f4s --datamover=simple ./runscript.sh | ||
``` |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
sudo mount -t cvmfs software.eessi.io /cvmfs/software.eessi.io | ||
source /cvmfs/software.eessi.io/versions/2023.06/init/bash | ||
|
||
ml load TensorFlow | ||
cd outputs | ||
|
||
#python -c "import tensorflow as tf; tf.keras.datasets.cifar10.load_data()" | ||
python ../cifar.py | ||
|