Post

Replies

Boosts

Views

Activity

Deep Learning Chapter 10: Advanced use of recurrent neural networks not Using GPU
I am running a recurrent neural network example on an iMac 27" with an AMD Radeon Pro 5700 XT on OS X 12.3. The code runs, the GPU was initialized the GPU is not active. Each epoch takes: 819/819 [==============================] - 32417s 40s/step - loss: 121.7538 - mae: 8.9641 - val_loss: 100.3145 - val_mae: 8.0313 % python chapter-10.py ['"Date Time"', '"p (mbar)"', '"T (degC)"', '"Tpot (K)"', '"Tdew (degC)"', '"rh (%)"', '"VPmax (mbar)"', '"VPact (mbar)"', '"VPdef (mbar)"', '"sh (g/kg)"', '"H2OC (mmol/mol)"', '"rho (g/m**3)"', '"wv (m/s)"', '"max. wv (m/s)"', '"wd (deg)"'] 420451 num_train_samples: 210225 num_val_samples: 105112 num_test_samples: 105114 2022-03-28 18:28:59.988516: I tensorflow/core/platform/cpu_feature_guard.cc:151] This TensorFlow binary is optimized with oneAPI Deep Neural Network Library (oneDNN) to use the following CPU instructions in performance-critical operations: SSE4.2 AVX AVX2 FMA To enable them in other operations, rebuild TensorFlow with the appropriate compiler flags. Metal device set to: AMD Radeon Pro 5700 XT systemMemory: 128.00 GB maxCacheSize: 7.99 GB 2022-03-28 18:28:59.989242: I tensorflow/core/common_runtime/pluggable_device/pluggable_device_factory.cc:305] Could not identify NUMA node of platform GPU ID 0, defaulting to 0. Your kernel may not have been built with NUMA support. 2022-03-28 18:28:59.989616: I tensorflow/core/common_runtime/pluggable_device/pluggable_device_factory.cc:271] Created TensorFlow device (/job:localhost/replica:0/task:0/device:GPU:0 with 0 MB memory) -> physical PluggableDevice (device: 0, name: METAL, pci bus id: <undefined>) WARNING:tensorflow:Layer lstm will not use cuDNN kernels since it doesn't meet the criteria. It will use a generic GPU kernel as fallback when running on GPU. Epoch 1/50 2022-03-28 18:29:02.342296: I tensorflow/core/grappler/optimizers/custom_graph_optimizer_registry.cc:113] Plugin optimizer for device_type GPU is enabled. 819/819 [==============================] - ETA: 0s - loss: 121.7538 - mae: 8.9641 2022-03-29 03:21:02.092397: I tensorflow/core/grappler/optimizers/custom_graph_optimizer_registry.cc:113] Plugin optimizer for device_type GPU is enabled. 819/819 [==============================] - 32417s 40s/step - loss: 121.7538 - mae: 8.9641 - val_loss: 100.3145 - val_mae: 8.0313 Epoch 2/50 381/819 [============>.................] - ETA: 4:50:31 - loss: 93.7597 - mae: 7.6880 from tensorflow import keras from tensorflow.keras import layers num_features = 14 steps = 120 import os fname = os.path.join("jena_climate_2009_2016.csv") with open(fname) as f: data = f.read() lines = data.split("\n") header = lines[0].split(",") lines = lines[1:] print(header) print(len(lines)) import numpy as np temperature = np.zeros((len(lines),)) raw_data = np.zeros((len(lines), len(header) - 1)) for i, line in enumerate(lines): values = [float(x) for x in line.split(",")[1:]] temperature[i] = values[1] raw_data[i, :] = values[:] sampling_rate = 6 sequence_length = 120 delay = sampling_rate * (sequence_length + 24 - 1) batch_size = 256 num_train_samples = int(0.5 * len(raw_data)) num_val_samples = int(0.25 * len(raw_data)) num_test_samples = len(raw_data) - num_train_samples - num_val_samples print("num_train_samples:", num_train_samples) print("num_val_samples:", num_val_samples) print("num_test_samples:", num_test_samples) train_dataset = keras.utils.timeseries_dataset_from_array( raw_data[:-delay], targets=temperature[delay:], sampling_rate=sampling_rate, sequence_length=sequence_length, shuffle=True, batch_size=batch_size, start_index=0, end_index=num_train_samples) val_dataset = keras.utils.timeseries_dataset_from_array( raw_data[:-delay], targets=temperature[delay:], sampling_rate=sampling_rate, sequence_length=sequence_length, shuffle=True, batch_size=batch_size, start_index=num_train_samples, end_index=num_train_samples + num_val_samples) test_dataset = keras.utils.timeseries_dataset_from_array( raw_data[:-delay], targets=temperature[delay:], sampling_rate=sampling_rate, sequence_length=sequence_length, shuffle=True, batch_size=batch_size, start_index=num_train_samples + num_val_samples) inputs = keras.Input(shape=(steps, num_features)) x = layers.SimpleRNN(16, return_sequences=True)(inputs) x = layers.SimpleRNN(16, return_sequences=True)(x) outputs = layers.SimpleRNN(16)(x) inputs = keras.Input(shape=(sequence_length, raw_data.shape[-1])) x = layers.LSTM(32, recurrent_dropout=0.25)(inputs) x = layers.Dropout(0.5)(x) outputs = layers.Dense(1)(x) model = keras.Model(inputs, outputs) callbacks = [ keras.callbacks.ModelCheckpoint("jena_lstm_dropout.keras", save_best_only=True) ] model.compile(optimizer="rmsprop", loss="mse", metrics=["mae"]) history = model.fit(train_dataset, epochs=50, validation_data=val_dataset, callbacks=callbacks) Any idea why the GPU is not active? How does this code example run on an M1 Ultra?
2
0
1.4k
Mar ’22
Deep Learning Example Chapter 11 Part 2 - Sequence Model Crashed OS X 12.3.1
I am running on an iMac 27" 2020 with an AMD Radeon Pro 5700 XT GPU. % pip show tensorflow-macos WARNING: Ignoring invalid distribution -umpy (/Users/davidlaxer/tensorflow-metal/lib/python3.8/site-packages) Name: tensorflow-macos Version: 2.8.0 Summary: TensorFlow is an open source machine learning framework for everyone. Home-page: https://www.tensorflow.org/ Author: Google Inc. Author-email: packages@tensorflow.org License: Apache 2.0 Location: /Users/davidlaxer/tensorflow-metal/lib/python3.8/site-packages Requires: absl-py, astunparse, flatbuffers, gast, google-pasta, grpcio, h5py, keras, keras-preprocessing, libclang, numpy, opt-einsum, protobuf, setuptools, six, tensorboard, termcolor, tf-estimator-nightly, typing-extensions, wrapt Required-by: (tensorflow-metal) (base) davidlaxer@x86_64-apple-darwin13 deep-learning-with-python-notebooks % pip show tensorflow-metal WARNING: Ignoring invalid distribution -umpy (/Users/davidlaxer/tensorflow-metal/lib/python3.8/site-packages) Name: tensorflow-metal Version: 0.4.0 Summary: TensorFlow acceleration for Mac GPUs. Home-page: https://developer.apple.com/metal/tensorflow-plugin/ Author: Author-email: License: MIT License. Copyright © 2020-2021 Apple Inc. All rights reserved. Location: /Users/davidlaxer/tensorflow-metal/lib/python3.8/site-packages Requires: six, wheel Required-by: Here's the code in a Jupyter Notebook: https://github.com/fchollet/deep-learning-with-python-notebooks/blob/master/chapter11_part02_sequence-models.ipynb Monterey crashed in Epoch 1 of training: callbacks = [ keras.callbacks.ModelCheckpoint("one_hot_bidir_lstm.keras", save_best_only=True) ] model.fit(int_train_ds, validation_data=int_val_ds, epochs=10, callbacks=callbacks) model = keras.models.load_model("one_hot_bidir_lstm.keras") print(f"Test acc: {model.evaluate(int_test_ds)[1]:.3f}") Epoch 1/10 2022-04-01 08:55:17.903921: I tensorflow/core/grappler/optimizers/custom_graph_optimizer_registry.cc:113] Plugin optimizer for device_type GPU is enabled. 2022-04-01 08:55:18.427409: I tensorflow/core/grappler/optimizers/custom_graph_optimizer_registry.cc:113] Plugin optimizer for device_type GPU is enabled. 2022-04-01 08:55:18.463345: I tensorflow/core/grappler/optimizers/custom_graph_optimizer_registry.cc:113] Plugin optimizer for device_type GPU is enabled. 2022-04-01 08:55:32.254473: I tensorflow/core/grappler/optimizers/custom_graph_optimizer_registry.cc:113] Plugin optimizer for device_type GPU is enabled. 2022-04-01 08:55:32.276648: I tensorflow/core/grappler/optimizers/custom_graph_optimizer_registry.cc:113] Plugin optimizer for device_type GPU is enabled. 3/625 [..............................] - ETA: 2:03:10 - loss: nan - accuracy: 0.5000 Kernel Panic
1
0
834
Apr ’22
Training Top2vec Model Crashed OS X 12.3.1
Training Top2vec with embedding_batch_size=256 crashed OS X 12.3.1 tensorflow_macos 2.8.0, tensorflow_metal 0.4.0 Anaconda Python 3.8.5 % pip show tensorflow_macos WARNING: Ignoring invalid distribution -umpy (/Users/davidlaxer/tensorflow-metal/lib/python3.8/site-packages) Name: tensorflow-macos Version: 2.8.0 Summary: TensorFlow is an open source machine learning framework for everyone. Home-page: https://www.tensorflow.org/ Author: Google Inc. Author-email: packages@tensorflow.org License: Apache 2.0 Location: /Users/davidlaxer/tensorflow-metal/lib/python3.8/site-packages Requires: absl-py, astunparse, flatbuffers, gast, google-pasta, grpcio, h5py, keras, keras-preprocessing, libclang, numpy, opt-einsum, protobuf, setuptools, six, tensorboard, termcolor, tf-estimator-nightly, typing-extensions, wrapt Required-by: (tensorflow-metal) (base) davidlaxer@x86_64-apple-darwin13 top2vec % pip show tensorflow_metal WARNING: Ignoring invalid distribution -umpy (/Users/davidlaxer/tensorflow-metal/lib/python3.8/site-packages) Name: tensorflow-metal Version: 0.4.0 Summary: TensorFlow acceleration for Mac GPUs. Home-page: https://developer.apple.com/metal/tensorflow-plugin/ Author: Author-email: License: MIT License. Copyright © 2020-2021 Apple Inc. All rights reserved. Location: /Users/davidlaxer/tensorflow-metal/lib/python3.8/site-packages Requires: six, wheel Required-by: To train the model with embedding_model="universal-sentence-encoder", you'll have to download universal-sentence-encoder_4. top2vec_trained = Top2Vec(documents=papers_filtered_df.text.tolist(), split_documents=True, **embedding_batch_size=256,** embedding_model="universal-sentence-encoder", use_embedding_model_tokenizer=True, embedding_model_path="/Users/davidlaxer/Downloads/universal-sentence-encoder_4", workers=8) Here's the project: https://github.com/ddangelov/Top2Vec Here's the Jupyter notebook: https://github.com/ddangelov/Top2Vec/blob/master/notebooks/CORD-19_top2vec.ipynb You'll have to load the COVID-19 data set from Kaggle here: https://www.kaggle.com/datasets/allen-institute-for-ai/CORD-19-research-challenge I set filter size to 1,000: def filter_short(papers_df): papers_df["token_counts"] = papers_df["text"].str.split().map(len) papers_df = **papers_df[papers_df.token_counts>1000].reset_index(drop=True)** papers_df.drop('token_counts', axis=1, inplace=True) return papers_df Trace panic(cpu 8 caller 0xffffff8020d449ad): userspace watchdog timeout: no successful checkins from WindowServer in 120 seconds service: logd, total successful checkins since wake (127621 seconds ago): 12763, last successful checkin: 0 seconds ago service: WindowServer, total successful checkins since wake (127621 seconds ago): 12751, last successful checkin: 120 seconds ago service: remoted, total successful checkins since wake (127621 seconds ago): 12763, last successful checkin: 0 [Trace](https://developer.apple.com/forums/content/attachment/d17c2c9b-569b-4c1a-9c61-892ced7f785b)
2
0
1.6k
Jun ’22
section __TEXT/__const address out of range for architecture x86_64
I got this error building PyTorch 1.12 on OS X Monterey 12.4, XCode 13.4 in the linker: ld: in lib/libnnpack.a(conv1x1.py.o), section __TEXT/__const address out of range for architecture x86_64 clang: error: linker command failed with exit code 1 (use -v to see invocation) % clang --version Apple clang version 13.1.6 (clang-1316.0.21.2.5) Target: x86_64-apple-darwin21.5.0 Thread model: posix InstalledDir: /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin % lipo -info ./build/lib/*.a Non-fat file: ./build/lib/libXNNPACK.a is architecture: x86_64 Non-fat file: ./build/lib/libasmjit.a is architecture: x86_64 Non-fat file: ./build/lib/libbenchmark.a is architecture: x86_64 Non-fat file: ./build/lib/libbenchmark_main.a is architecture: x86_64 Non-fat file: ./build/lib/libcaffe2_protos.a is architecture: x86_64 Non-fat file: ./build/lib/libclog.a is architecture: x86_64 Non-fat file: ./build/lib/libcpuinfo.a is architecture: x86_64 Non-fat file: ./build/lib/libcpuinfo_internals.a is architecture: x86_64 Non-fat file: ./build/lib/libdnnl.a is architecture: x86_64 Non-fat file: ./build/lib/libfbgemm.a is architecture: x86_64 Non-fat file: ./build/lib/libfmt.a is architecture: x86_64 Non-fat file: ./build/lib/libfoxi_loader.a is architecture: x86_64 Non-fat file: ./build/lib/libgmock.a is architecture: x86_64 Non-fat file: ./build/lib/libgmock_main.a is architecture: x86_64 Non-fat file: ./build/lib/libgtest.a is architecture: x86_64 Non-fat file: ./build/lib/libgtest_main.a is architecture: x86_64 Non-fat file: ./build/lib/libkineto.a is architecture: x86_64 Non-fat file: ./build/lib/libnnpack.a is architecture: x86_64 Non-fat file: ./build/lib/libnnpack_reference_layers.a is architecture: x86_64 Non-fat file: ./build/lib/libonnx.a is architecture: x86_64 Non-fat file: ./build/lib/libonnx_proto.a is architecture: x86_64 Non-fat file: ./build/lib/libprotobuf-lite.a is architecture: x86_64 Non-fat file: ./build/lib/libprotobuf.a is architecture: x86_64 Non-fat file: ./build/lib/libprotoc.a is architecture: x86_64 Non-fat file: ./build/lib/libpthreadpool.a is architecture: x86_64 Non-fat file: ./build/lib/libpytorch_qnnpack.a is architecture: x86_64 Non-fat file: ./build/lib/libqnnpack.a is architecture: x86_64 (base) davidlaxer@x86_64-apple-darwin13 pytorch linkText linkText Any suggestions?
0
0
1.7k
May ’22
ld: unsupported tapi file type '!tapi-tbd' in YAML file '/Library/Developer/CommandLineTools/SDKs/MacOSX.sdk/usr/lib/libSystem.tbd' for architecture x86_64
I am trying to build AI-Feynman https://github.com/SJ001/AI-Feynman OS X 12.4 XCode 13.4 % xcode-select -p /Library/Developer/CommandLineTools % which gfortran /Users/davidlaxer/anaconda3/envs/AI-Feynman/bin/gfortran (AI-Feynman) davidlaxer@x86_64-apple-darwin13 AI-Feynman % gfortran --version GNU Fortran (GCC) 4.8.5 Copyright (C) 2015 Free Software Foundation, Inc. GNU Fortran comes with NO WARRANTY, to the extent permitted by law. You may redistribute copies of GNU Fortran under the terms of the GNU General Public License. For more information about these matters, see the file named COPYING I am getting this error trying in link AI-Feynman: /Users/davidlaxer/anaconda3/envs/AI-Feynman/bin/x86_64-apple-darwin13.4.0-gfortran -Wall -g -arch x86_64 -Wall -g -undefined dynamic_lookup -bundle build/temp.macosx-10.9-x86_64-3.9/build/src.macosx-10.9-x86_64-3.9/aifeynman/_symbolic_regress1module.o build/temp.macosx-10.9-x86_64-3.9/build/src.macosx-10.9-x86_64-3.9/build/src.macosx-10.9-x86_64-3.9/aifeynman/fortranobject.o build/temp.macosx-10.9-x86_64-3.9/aifeynman/symbolic_regress1.o build/temp.macosx-10.9-x86_64-3.9/build/src.macosx-10.9-x86_64-3.9/aifeynman/_symbolic_regress1-f2pywrappers.o -L/Users/davidlaxer/anaconda3/envs/AI-Feynman/bin/../lib/gcc/x86_64-apple-darwin11.4.2/4.8.5 -L/Users/davidlaxer/anaconda3/envs/AI-Feynman/bin/../lib/gcc/x86_64-apple-darwin11.4.2/4.8.5/../../.. -L/Users/davidlaxer/anaconda3/envs/AI-Feynman/bin/../lib/gcc/x86_64-apple-darwin11.4.2/4.8.5/../../.. -lgfortran -o aifeynman/_symbolic_regress1.cpython-39-darwin.so ld: unsupported tapi file type '!tapi-tbd' in YAML file '/Library/Developer/CommandLineTools/SDKs/MacOSX.sdk/usr/lib/libSystem.tbd' for architecture x86_64 collect2: error: ld returned 1 exit status error: Command "/Users/davidlaxer/anaconda3/envs/AI-Feynman/bin/x86_64-apple-darwin13.4.0-gfortran -Wall -g -arch x86_64 -Wall -g -undefined dynamic_lookup -bundle build/temp.macosx-10.9-x86_64-3.9/build/src.macosx-10.9-x86_64-3.9/aifeynman/_symbolic_regress1module.o build/temp.macosx-10.9-x86_64-3.9/build/src.macosx-10.9-x86_64-3.9/build/src.macosx-10.9-x86_64-3.9/aifeynman/fortranobject.o build/temp.macosx-10.9-x86_64-3.9/aifeynman/symbolic_regress1.o build/temp.macosx-10.9-x86_64-3.9/build/src.macosx-10.9-x86_64-3.9/aifeynman/_symbolic_regress1-f2pywrappers.o -L/Users/davidlaxer/anaconda3/envs/AI-Feynman/bin/../lib/gcc/x86_64-apple-darwin11.4.2/4.8.5 -L/Users/davidlaxer/anaconda3/envs/AI-Feynman/bin/../lib/gcc/x86_64-apple-darwin11.4.2/4.8.5/../../.. -L/Users/davidlaxer/anaconda3/envs/AI-Feynman/bin/../lib/gcc/x86_64-apple-darwin11.4.2/4.8.5/../../.. -lgfortran -o aifeynman/_symbolic_regress1.cpython-39-darwin.so" failed with exit status 1 % find /Applications/Xcode.app -name libSystem.tbd -ls 227714500 0 lrwxr-xr-x 1 root wheel 15 Jul 29 2021 /Applications/Xcode.app/Contents/Developer/Platforms/AppleTVOS.platform/Developer/SDKs/AppleTVOS.sdk/usr/lib/libSystem.tbd -> libSystem.B.tbd 227847317 64 -rw-r--r-- 1 root wheel 170869 Feb 21 20:37 /Applications/Xcode.app/Contents/Developer/Platforms/DriverKit.platform/Developer/SDKs/DriverKit.sdk/System/DriverKit/usr/lib/libSystem.tbd 228117342 0 lrwxr-xr-x 1 root wheel 15 Jul 29 2021 /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS.sdk/usr/lib/libSystem.tbd -> libSystem.B.tbd find: /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Library/Developer/CoreSimulator/Profiles/Runtimes/iOS.simruntime/Contents/Resources/RuntimeRoot/private/var/mobile: Permission denied 227900857 0 lrwxr-xr-x 1 root wheel 15 Jul 29 2021 /Applications/Xcode.app/Contents/Developer/Platforms/WatchOS.platform/Developer/SDKs/WatchOS.sdk/usr/lib/libSystem.tbd -> libSystem.B.tbd 227872436 0 lrwxr-xr-x 1 root wheel 15 Jul 29 2021 /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/usr/lib/libSystem.tbd -> libSystem.B.tbd 228110285 0 lrwxr-xr-x 1 root wheel 15 Jul 29 2021 /Applications/Xcode.app/Contents/Developer/Platforms/WatchSimulator.platform/Developer/SDKs/WatchSimulator.sdk/usr/lib/libSystem.tbd -> libSystem.B.tbd 227845798 0 lrwxr-xr-x 1 root wheel 15 Jul 29 2021 /Applications/Xcode.app/Contents/Developer/Platforms/AppleTVSimulator.platform/Developer/SDKs/AppleTVSimulator.sdk/usr/lib/libSystem.tbd -> libSystem.B.tbd 228409847 0 lrwxr-xr-x 1 root wheel 15 Jul 29 2021 /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator.sdk/usr/lib/libSystem.tbd -> libSystem.B.tbd (AI-Feynman) davidlaxer@x86_64-apple-darwin13 AI-Feynman % diff /Library/Developer/CommandLineTools/SDKs/MacOSX.sdk/usr/lib/libSystem.tbd /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/usr/lib/libSystem.tbd
1
0
1.8k
Jun ’22