gpu
ci/woodpecker/push/woodpecker Pipeline was successful Details

This commit is contained in:
Malte Grosse 2023-11-30 10:04:15 +09:00
parent 45d58b7723
commit 511187ba16
2 changed files with 14 additions and 16 deletions

View File

@ -1,8 +1,8 @@
steps: steps:
"caffe": "train":
image: nvcr.io/nvidia/tensorflow:23.10-tf2-py3 image: nvcr.io/nvidia/tensorflow:23.10-tf2-py3
commands: commands:
- echo "ci working................b. " - echo "starting python script"
- python run.py - python run.py

26
run.py
View File

@ -46,18 +46,6 @@ y_test_categorical = keras.utils.to_categorical(
print("model build") print("model build")
model = keras.Sequential([
keras.layers.Flatten(input_shape=(32,32,3)),
keras.layers.Dense(300, activation='relu'),
keras.layers.Dense(100, activation='relu'),
keras.layers.Dense(10, activation='sigmoid')
])
model.compile(optimizer='SGD',
loss='categorical_crossentropy',
metrics=['accuracy'])
model.fit(X_train_scaled, y_train_categorical, epochs=1)
def get_model(): def get_model():
model = keras.Sequential([ model = keras.Sequential([
@ -73,7 +61,17 @@ def get_model():
return model return model
with tf.device('/GPU:0'): with tf.device('/GPU:0'):
cpu_model = get_model() model = keras.Sequential([
cpu_model.fit(X_train_scaled, y_train_categorical, epochs=10) keras.layers.Flatten(input_shape=(32,32,3)),
keras.layers.Dense(3000, activation='relu'),
keras.layers.Dense(1000, activation='relu'),
keras.layers.Dense(10, activation='sigmoid')
])
model.compile(optimizer='SGD',
loss='categorical_crossentropy',
metrics=['accuracy'])
model.fit(X_train_scaled, y_train_categorical, epochs=10)
model.save('mymodel.keras')
print("done") print("done")