tensorflow-metal

RSS for tag

TensorFlow accelerates machine learning model training with Metal on Mac GPUs.

tensorflow-metal Documentation

Posts under tensorflow-metal tag

256 Posts
Sort by:
Post not yet marked as solved
5 Replies
77 Views
Comparison between MAC Studio M1 Ultra (20c, 64c, 128GB RAM) vs 2017 Intel i5 MBP (16GB RAM) for the subject matter i.e. memory leakage while using tf.keras.models.predict() for saved model on both machines: MBP-2017: First prediction takes around 10MB and subsequent calls ~0-1MB MACSTUDIO-2022: First prediction takes around 150MB and subsequent calls ~70-80MB. After say 10000 such calls o predict(), while my MBP memory usage stays under 10GB, MACSTUDIO climbs to ~80GB (and counting up for higher number of calls). Even using keras.backend.clear_session() after each call on MACSTUDIO did not help. Can anyone having insight on TensorFlow-metal and/or MAC M1 machines help? Thanks, Bapi
Posted
by karbapi.
Last updated
.
Post not yet marked as solved
2 Replies
44 Views
This does not seem to be effecting the training, but it seems somewhat important (no clue on how to read it however): Error: command buffer exited with error status. The Metal Performance Shaders operations encoded on it may not have completed. Error: (null) Internal Error (0000000e:Internal Error) <AGXG13XFamilyCommandBuffer: 0x29b027b50> label = <none> device = <AGXG13XDevice: 0x12da25600> name = Apple M1 Max commandQueue = <AGXG13XFamilyCommandQueue: 0x106477000> label = <none> device = <AGXG13XDevice: 0x12da25600> name = Apple M1 Max retainedReferences = 1 This is happening during a "heavy" model training on "heavy" dataset, so maybe is related to some memory issue, but I have no clue how to confront it
Posted Last updated
.
Post not yet marked as solved
1 Replies
155 Views
I've stumbled into issues using tensorflow-metal on the M1. When generating random tensors, the tf.random function will produce the same tensor after calling it once inside a tf.function, while it is fine outside of a tf.function. Example: import tensorflow as tf tf.random.set_seed(1) def func(): return tf.random.uniform(()) Calling from a regular function works: Edit: Only works when setting the seed beforehand. If not, same issue as below happens, where the random tensor is only generated 'once'. print("Normal function -> seed works") print(func()) print(func()) print(func()) print(func()) > Normal function -> seed works > tf.Tensor(0.16513085, shape=(), dtype=float32) > tf.Tensor(0.51010704, shape=(), dtype=float32) > tf.Tensor(0.8292774, shape=(), dtype=float32) > tf.Tensor(0.2364521, shape=(), dtype=float32) While when using it inside a tf.function: tf_func = tf.function(func) print("tf.function -> seed stops working after 1 generation") print(tf_func()) print(tf_func()) print(tf_func()) print(tf_func()) > tf.function -> seed stops working after 1 generation > tf.Tensor(0.81269646, shape=(), dtype=float32) > tf.Tensor(0.31179297, shape=(), dtype=float32) > tf.Tensor(0.31179297, shape=(), dtype=float32) > tf.Tensor(0.31179297, shape=(), dtype=float32) I've seen that the team is working on a similar issue atm, but maybe this is something your are not aware of right now. System Info system: Darwin release: 21.4.0 version: Darwin Kernel Version 21.4.0: Fri Mar 18 00:47:26 PDT 2022; root:xnu-8020.101.4~15/RELEASE_ARM64_T8101 machine: arm64 processor: arm python_implementation: CPython python_version: 3.9.7 python_version_tuple: ('3', '9', '7') python_build: ('default', 'Sep 29 2021 19:24:02') python_compiler: Clang 11.1.0 platform: macOS-12.3.1-arm64-arm-64bit Packages: tensorflow-macos 2.9.2 tensorflow-metal 0.5.0
Posted
by fstermann.
Last updated
.
Post not yet marked as solved
1 Replies
232 Views
I have a macbook air M1 2020 with macos 12.2 Monterey. I bought it in order to be able to speed up deep learning with the tensorflow GPU extension for M1 machines. I have tried EVERYTHING. Gone through countless tutorials and installed several packages (miniforge, updated python, conda on top of miniforge). Still, when I try to run the command conda install -c apple tensorflow-deps==2.8.0 it doesn't work and gives me this error message: PackagesNotFoundError: The following packages are not available from current channels:  - tensorflow-deps==2.8.0 Current channels:  - https://conda.anaconda.org/apple/osx-64  - https://conda.anaconda.org/apple/noarch  - https://repo.anaconda.com/pkgs/main/osx-64  - https://repo.anaconda.com/pkgs/main/noarch  - https://repo.anaconda.com/pkgs/r/osx-64  - https://repo.anaconda.com/pkgs/r/noarch  - https://conda.anaconda.org/conda-forge/osx-64  - https://conda.anaconda.org/conda-forge/noarch To search for alternate channels that may provide the conda package you're looking for, navigate to   https://anaconda.org and use the search bar at the top of the page. Is there anyone who has managed to solve this?
Posted Last updated
.
Post not yet marked as solved
1 Replies
156 Views
So I'm trying to follow a tutorial about Times Series Prediction from the tensorflow website : https://www.tensorflow.org/probability/examples/Structural_Time_Series_Modeling_Case_Studies_Atmospheric_CO2_and_Electricity_Demand And on The 11th block of code (the fitting part I get the following error): UnimplementedError: Could not find compiler for platform METAL: NOT_FOUND: could not find registered compiler for platform METAL -- check target linkage [Op:__inference_run_jitted_minimize_20055] Is there any solution to this problem ?
Posted
by Space192.
Last updated
.
Post not yet marked as solved
1 Replies
130 Views
Hi awesome person. In https://developer.apple.com/forums/thread/709170 I had the following code except jitted=True. I changed jitted to False. Running the following elbo_loss_curve = tfp.vi.fit_surrogate_posterior( target_log_prob_fn=model.joint_distribution( observed_time_series=df_train["coverage"]).log_prob, surrogate_posterior=variational_posteriors, optimizer=tf.optimizers.Adam(learning_rate=0.1), num_steps=num_variational_steps, jit_compile=False) Gives me the error below. I am not doing any with statements. This is holding me back. Any chance I could get updates on this or the other ticket? Thanks. Joseph. For the other bits, this is real fast! thank you. File "/Users/joseph/Downloads/structural_time_series_modeling_case_studies_atmospheric_co2_and_electricity_demand.py", line 104, in <module> elbo_loss_curve = tfp.vi.fit_surrogate_posterior( File "/opt/homebrew/Caskroom/miniforge/base/envs/tf/lib/python3.10/site-packages/tensorflow/python/util/deprecation.py", line 561, in new_func return func(*args, **kwargs) File "/opt/homebrew/Caskroom/miniforge/base/envs/tf/lib/python3.10/site-packages/tensorflow_probability/python/vi/optimization.py", line 751, in fit_surrogate_posterior return tfp_math.minimize(complete_variational_loss_fn, File "/opt/homebrew/Caskroom/miniforge/base/envs/tf/lib/python3.10/site-packages/tensorflow_probability/python/math/minimize.py", line 610, in minimize _, traced_values = _minimize_common( File "/opt/homebrew/Caskroom/miniforge/base/envs/tf/lib/python3.10/site-packages/tensorflow_probability/python/math/minimize.py", line 153, in _minimize_common initial_optimizer_state) = optimizer_step_fn( File "/opt/homebrew/Caskroom/miniforge/base/envs/tf/lib/python3.10/site-packages/tensorflow/python/util/traceback_utils.py", line 153, in error_handler raise e.with_traceback(filtered_tb) from None File "/opt/homebrew/Caskroom/miniforge/base/envs/tf/lib/python3.10/site-packages/tensorflow/python/eager/execute.py", line 54, in quick_execute tensors = pywrap_tfe.TFE_Py_Execute(ctx._handle, device_name, op_name, tensorflow.python.framework.errors_impl.InvalidArgumentError: Cannot assign a device for operation monte_carlo_variational_loss/build_factored_surrogate_posterior/Normal_trainable_variables/Identity_1/ReadVariableOp: Could not satisfy explicit device specification '' because the node {{colocation_node monte_carlo_variational_loss/build_factored_surrogate_posterior/Normal_trainable_variables/Identity_1/ReadVariableOp}} was colocated with a group of nodes that required incompatible device '/job:localhost/replica:0/task:0/device:GPU:0'. All available devices [/job:localhost/replica:0/task:0/device:CPU:0, /job:localhost/replica:0/task:0/device:GPU:0]. Colocation Debug Info: Colocation group had the following types and supported devices: Root Member(assigned_device_name_index_=2 requested_device_name_='/job:localhost/replica:0/task:0/device:GPU:0' assigned_device_name_='/job:localhost/replica:0/task:0/device:GPU:0' resource_device_name_='/job:localhost/replica:0/task:0/device:GPU:0' supported_device_types_=[CPU] possible_devices_=[] ReadVariableOp: GPU CPU ResourceApplyAdam: CPU _Arg: GPU CPU Colocation members, user-requested devices, and framework assigned devices, if any: monte_carlo_variational_loss_build_factored_surrogate_posterior_normal_trainable_variables_identity_1_readvariableop_resource (_Arg) framework assigned device=/job:localhost/replica:0/task:0/device:GPU:0 adam_adam_update_resourceapplyadam_m (_Arg) framework assigned device=/job:localhost/replica:0/task:0/device:GPU:0 adam_adam_update_resourceapplyadam_v (_Arg) framework assigned device=/job:localhost/replica:0/task:0/device:GPU:0 monte_carlo_variational_loss/build_factored_surrogate_posterior/Normal_trainable_variables/Identity_1/ReadVariableOp (ReadVariableOp) monte_carlo_variational_loss/build_factored_surrogate_posterior_1/Normal_trainable_variables/Identity_1/ReadVariableOp (ReadVariableOp) monte_carlo_variational_loss/build_factored_surrogate_posterior_2/Normal_trainable_variables/Identity_1/ReadVariableOp (ReadVariableOp) Adam/Adam/update/ResourceApplyAdam (ResourceApplyAdam) /job:localhost/replica:0/task:0/device:GPU:0 Identity_9/ReadVariableOp (ReadVariableOp) [[{{node monte_carlo_variational_loss/build_factored_surrogate_posterior/Normal_trainable_variables/Identity_1/ReadVariableOp}}]] [Op:__inference_optimizer_step_13601]
Posted Last updated
.
Post not yet marked as solved
5 Replies
211 Views
Hi all. Trying to run the intro example to STS of tensorflow. The introductory notebook https://github.com/tensorflow/probability/blob/main/tensorflow_probability/examples/jupyter_notebooks/Structural_Time_Series_Modeling_Case_Studies_Atmospheric_CO2_and_Electricity_Demand.ipynb Gets an unimplemented error when calculating the loss curve. Seems to work for everything else. Has anybody gotten this intro example to work? Thank you
Posted Last updated
.
Post not yet marked as solved
1 Replies
295 Views
I have been trying to install TensorFlow 2.6.0 in a conda environment. Here's the command: python -m pip install tensorflow-macos==2.6.0 But it gives me this error:         TypeError: str expected, not int        [end of output]            note: This error originates from a subprocess, and is likely not a problem with pip.     error: legacy-install-failure           × Encountered error while trying to install package.     ╰─> numpy           note: This is an issue with the package mentioned above, not pip.     hint: See above for output from the failure.           [notice] A new release of pip available: 22.1.2 -> 22.2.1     [notice] To update, run: python3.8 -m pip install --upgrade pip     [end of output]     note: This error originates from a subprocess, and is likely not a problem with pip. error: subprocess-exited-with-error × pip subprocess to install backend dependencies did not run successfully. │ exit code: 1 ╰─> See above for output. note: This error originates from a subprocess, and is likely not a problem with pip. [notice] A new release of pip available: 22.1.2 -> 22.2.1 [notice] To update, run: python3.8 -m pip install --upgrade pip The full output is too large to fit in here. So I put the output here - https://docs.google.com/document/d/1eKL5UbeK8y0nNbp3mnWPBUutrTOTiWHALjZliQtB7jw/edit?usp=sharing Go check it out. Please help me to successfully install Tensorflow in my M1 MacBook Pro. OS: macOS Big Sur v11.6; Environment python: Python 3.8.13; Environment pip: Pip v22.1.2
Posted
by arannya.
Last updated
.
Post not yet marked as solved
3 Replies
101 Views
Hi! GPU acceleration lacks of M1 GPU support (only with this specific model), getting this message when trying to run a trained model on GPU: NotFoundError: Graph execution error: No registered 'AddN' OpKernel for 'GPU' devices compatible with node {{node model_3/keras_layer_3/StatefulPartitionedCall/StatefulPartitionedCall/StatefulPartitionedCall/roberta_pack_inputs/StatefulPartitionedCall/RaggedConcat/ArithmeticOptimizer/AddOpsRewrite_Leaf_0_add_2}} (OpKernel was found, but attributes didn't match) Requested Attributes: N=2, T=DT_INT64, _XlaHasReferenceVars=false, _grappler_ArithmeticOptimizer_AddOpsRewriteStage=true, _device="/job:localhost/replica:0/task:0/device:GPU:0" . Registered: device='XLA_CPU_JIT'; T in [DT_FLOAT, DT_DOUBLE, DT_INT32, DT_UINT8, DT_INT16, 16534343205130372495, DT_COMPLEX128, DT_HALF, DT_UINT32, DT_UINT64, DT_VARIANT] device='GPU'; T in [DT_FLOAT] device='DEFAULT'; T in [DT_INT32] device='CPU'; T in [DT_UINT64] device='CPU'; T in [DT_INT64] device='CPU'; T in [DT_UINT32] device='CPU'; T in [DT_UINT16] device='CPU'; T in [DT_INT16] device='CPU'; T in [DT_UINT8] device='CPU'; T in [DT_INT8] device='CPU'; T in [DT_INT32] device='CPU'; T in [DT_HALF] device='CPU'; T in [DT_BFLOAT16] device='CPU'; T in [DT_FLOAT] device='CPU'; T in [DT_DOUBLE] device='CPU'; T in [DT_COMPLEX64] device='CPU'; T in [DT_COMPLEX128] device='CPU'; T in [DT_VARIANT] [[model_3/keras_layer_3/StatefulPartitionedCall/StatefulPartitionedCall/StatefulPartitionedCall/roberta_pack_inputs/StatefulPartitionedCall/RaggedConcat/ArithmeticOptimizer/AddOpsRewrite_Leaf_0_add_2]] [Op:__inference_train_function_300451]
Posted
by sm_96.
Last updated
.
Post not yet marked as solved
1 Replies
68 Views
Hi Guy I face the problem that Macbook Air M2 cannot use Tensorflow via conda path. I have already followed the instruction on this link: https://developer.apple.com/metal/tensorflow-plugin/ but it still cannot work. Can someone advise us ?
Posted
by Thanasan.
Last updated
.
Post not yet marked as solved
27 Replies
11k Views
Device: MacBook Pro 16 M1 Max, 64GB running MacOS 12.0.1. I tried setting up GPU Accelerated TensorFlow on my Mac using the following steps: Setup: XCode CLI / Homebrew/ Miniforge Conda Env: Python 3.9.5 conda install -c apple tensorflow-deps python -m pip install tensorflow-macos python -m pip install tensorflow-metal brew install libjpeg conda install -y matplotlib jupyterlab In Jupyter Lab, I try to execute this code: from tensorflow.keras import layers from tensorflow.keras import models model = models.Sequential() model.add(layers.Conv2D(32, (3, 3), activation='relu', input_shape=(28, 28, 1))) 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.summary() The code executes, but I get this warning, indicating no GPU Acceleration can be used as it defaults to a 0MB GPU. Error: Metal device set to: Apple M1 Max 2021-10-27 08:23:32.872480: 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. 2021-10-27 08:23:32.872707: 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>) Anyone has any idea how to fix this? I came across a bunch of posts around here related to the same issue but with no solid fix. I created a new question as I found the other questions less descriptive of the issue, and wanted to comprehensively depict it. Any fix would be of much help.
Posted Last updated
.
Post not yet marked as solved
4 Replies
334 Views
I am training a model using tensorflow-metal and having training deadlock issue similar to (https://developer.apple.com/forums/thread/703081). Following is a minimum code to reproduce the problem. import tensorflow as tf #dev = '/cpu:0' dev = '/gpu:0' epochs = 1000 batch_size = 32 hidden = 128 mnist = tf.keras.datasets.mnist train, _ = mnist.load_data() x_train, y_train = train[0] / 255.0, train[1] with tf.device(dev): model = tf.keras.models.Sequential() model.add(tf.keras.layers.Flatten()) model.add(tf.keras.layers.Dense(hidden, activation='relu')) model.add(tf.keras.layers.Dropout(0.3)) model.add(tf.keras.layers.Dense(hidden, activation='relu')) model.add(tf.keras.layers.Dropout(0.3)) model.add(tf.keras.layers.Dense(10, activation='softmax')) model.compile(loss='sparse_categorical_crossentropy', optimizer='adam', metrics=['accuracy']) model.fit(x_train, y_train, batch_size=batch_size, epochs=epochs) Test configurations are: MacBook Air M1 macOS 12.4 tensorflow-deps 2.9 tensorflow-macos 2.9.2 tensorflow-metal 0.5.0 With this configuration and above code, training stops in the middle of 27th epoch (100% as far as I have tested). Interestingly, the problem can not be reproduced if I change any of following. GPU to CPU remove Dropout layers downgrade tensorflow-metal to 0.4
Posted
by masa6s.
Last updated
.
Post not yet marked as solved
4 Replies
1.4k Views
I know you guys already support tensorflow by two packages: tensorflow-macos and tensorflow-metal. However to work with NLP, users also need tensorflow-text package. Could you devlopers build a dedicated version tensorflow-text-macos to support this demands. Best Regards,
Posted
by SuperBo.
Last updated
.
Post not yet marked as solved
0 Replies
66 Views
I'm trying to install tf-models-official package on my M1 Mac inside conda environment with tensorflow-macos installed. However, I'm getting a conflict: The conflict is caused by: tf-models-official 2.9.2 depends on tensorflow-text~=2.9.0 tf-models-official 2.9.1 depends on tensorflow-text~=2.9.0 tf-models-official 2.9.0 depends on tensorflow-text~=2.9.0 tf-models-official 2.8.0 depends on tensorflow-text~=2.8.0 tf-models-official 2.7.2 depends on tensorflow>=2.4.0 tf-models-official 2.7.1 depends on tensorflow>=2.4.0 tf-models-official 2.7.0 depends on tensorflow-text>=2.7.0 tf-models-official 2.6.1 depends on tensorflow>=2.6.0 tf-models-official 2.6.0 depends on tensorflow>=2.5.0 tf-models-official 2.5.1 depends on tensorflow>=2.5.0 tf-models-official 2.5.0 depends on tensorflow>=2.5.0 tf-models-official 2.4.0 depends on tensorflow>=2.4.0 tf-models-official 2.3.0 depends on tensorflow>=2.3.0 tf-models-official 2.2.2 depends on tensorflow>=2.2.0 tf-models-official 2.2.1 depends on tensorflow>=2.2.0 tf-models-official 2.2.0 depends on tensorflow>=2.2.0 It is probably because the installed tensorflow is in fact tensorflow-macos and pip is unable to see it. So, may be Apple needs to provide a meta package called 'tensorflow' so we would be able to use it properly?
Posted
by antony66.
Last updated
.
Post not yet marked as solved
7 Replies
14k Views
I just got my new MacBook Pro with M1 Max chip and am setting up Python. I've tried several combinational settings to test speed - now I'm quite confused. First put my questions here: Why python run natively on M1 Max is greatly (~100%) slower than on my old MacBook Pro 2016 with Intel i5? On M1 Max, why there isn't significant speed difference between native run (by miniforge) and run via Rosetta (by anaconda) - which is supposed to be slower ~20%? On M1 Max and native run, why there isn't significant speed difference between conda installed Numpy and TensorFlow installed Numpy - which is supposed to be faster? On M1 Max, why run in PyCharm IDE is constantly slower ~20% than run from terminal, which doesn't happen on my old Intel Mac. Evidence supporting my questions is as follows: Here are the settings I've tried: 1. Python installed by Miniforge-arm64, so that python is natively run on M1 Max Chip. (Check from Activity Monitor, Kind of python process is Apple). Anaconda.: Then python is run via Rosseta. (Check from Activity Monitor, Kind of python process is Intel). 2. Numpy installed by conda install numpy: numpy from original conda-forge channel, or pre-installed with anaconda. Apple-TensorFlow: with python installed by miniforge, I directly install tensorflow, and numpy will also be installed. It's said that, numpy installed in this way is optimized for Apple M1 and will be faster. Here is the installation commands: conda install -c apple tensorflow-deps python -m pip install tensorflow-macos python -m pip install tensorflow-metal 3. Run from Terminal. PyCharm (Apple Silicon version). Here is the test code: import time import numpy as np np.random.seed(42) a = np.random.uniform(size=(300, 300)) runtimes = 10 timecosts = [] for _ in range(runtimes): s_time = time.time() for i in range(100): a += 1 np.linalg.svd(a) timecosts.append(time.time() - s_time) print(f'mean of {runtimes} runs: {np.mean(timecosts):.5f}s') and here are the results: +-----------------------------------+-----------------------+--------------------+ | Python installed by (run on)→ | Miniforge (native M1) | Anaconda (Rosseta) | +----------------------+------------+------------+----------+----------+---------+ | Numpy installed by ↓ | Run from → | Terminal | PyCharm | Terminal | PyCharm | +----------------------+------------+------------+----------+----------+---------+ | Apple Tensorflow | 4.19151 | 4.86248 | / | / | +-----------------------------------+------------+----------+----------+---------+ | conda install numpy | 4.29386 | 4.98370 | 4.10029 | 4.99271 | +-----------------------------------+------------+----------+----------+---------+ This is quite slow. For comparison, run the same code on my old MacBook Pro 2016 with i5 chip - it costs 2.39917s. another post reports that run with M1 chip (not Pro or Max), miniforge+conda_installed_numpy is 2.53214s, and miniforge+apple_tensorflow_numpy is 1.00613s. you may also try on it your own. Here is the CPU information details: My old i5: $ sysctl -a | grep -e brand_string -e cpu.core_count machdep.cpu.brand_string: Intel(R) Core(TM) i5-6360U CPU @ 2.00GHz machdep.cpu.core_count: 2 My new M1 Max: % sysctl -a | grep -e brand_string -e cpu.core_count machdep.cpu.brand_string: Apple M1 Max machdep.cpu.core_count: 10 I follow instructions strictly from tutorials - but why would all these happen? Is it because of my installation flaws, or because of M1 Max chip? Since my work relies heavily on local runs, local speed is very important to me. Any suggestions to possible solution, or any data points on your own device would be greatly appreciated :)
Posted Last updated
.
Post not yet marked as solved
0 Replies
59 Views
Installing tensorflow-metal downgraded the python-six dependency from 1.16.0 to 1.15.0 because the dependency specification of tensorflow-metal specififed six~=1.15.0. This is a pinned version which is something libraries like tensorflow-metal should avoid at all cost; what if I want to use tensorflow together with another library that requires six>=1.16? I can't imagine that there is anything in six 1.16 that would break tensorflow.
Posted
by burnpanck.
Last updated
.
Post marked as solved
14 Replies
17k Views
Following the instructions at https://developer.apple.com/metal/tensorflow-plugin/ I got as far as python -m pip install tensorflow-macos and it responded "ERROR: Could not find a version that satisfies the requirement tensorflow-macos (from versions: none) ERROR: No matching distribution found for tensorflow-macos" I'd be grateful for any suggestions
Posted Last updated
.
Post marked as solved
8 Replies
379 Views
Hi, I'm running scaaml which starts running fine, after several iterations its slows right down. 76: I tensorflow/core/grappler/optimizers/custom_graph_optimizer_registry.cc:113] Plugin optimizer for device_type GPU is enabled. 2022-07-04 06:25:08.268023: I tensorflow/core/grappler/optimizers/custom_graph_optimizer_registry.cc:113] Plugin optimizer for device_type GPU is enabled. 2048/2048 [==============================] - 512s 250ms/step - loss: 1.8051 - acc: 0.3809 - val_loss: 1.9365 - val_acc: 0.3350 Epoch 19/30 536/2048 [======>.......................] - ETA: 44:10:15 - loss: 1.7715 - acc: 0.3911 Previous flows were processed in a reasonable amount of time 173: I tensorflow/core/grappler/optimizers/custom_graph_optimizer_registry.cc:113] Plugin optimizer for device_type GPU is enabled. 2022-07-04 06:16:20.906834: I tensorflow/core/grappler/optimizers/custom_graph_optimizer_registry.cc:113] Plugin optimizer for device_type GPU is enabled. WARNING:absl:Found untraced functions such as _jit_compiled_convolution_op, _jit_compiled_convolution_op, _jit_compiled_convolution_op, _jit_compiled_convolution_op, _jit_compiled_convolution_op while saving (showing 5 of 46). These functions will not be directly callable after loading. 2048/2048 [==============================] - 538s 263ms/step - loss: 1.8303 - acc: 0.3744 - val_loss: 1.8793 - val_acc: 0.3452 Epoch 18/30 2048/2048 [==============================] - ETA: 0s - loss: 1.8051 - acc: 0.38092022-07-04 06:25:08.264476: I tensorflow/core/grappler/optimizers/custom_graph_optimizer_registry.cc:113] Plugin optimizer for device_type GPU is enabled. 2022-07-04 06:25:08.268023: I tensorflow/core/grappler/optimizers/custom_graph_optimizer_registry.cc:113] Plugin optimizer for device_type GPU is enabled. 2048/2048 [==============================] - 512s 250ms/step - loss: 1.8051 - acc: 0.3809 - val_loss: 1. I'm running the code elsewhere and it runs just fine. I could run other GPU tasks and these picked up the GPU no problem, its as if running after an extended period of time, the resources/application stopped - but kept running very slowly.
Posted
by alz0r.
Last updated
.
Post not yet marked as solved
2 Replies
240 Views
I am trying to run the notebook https://www.tensorflow.org/text/tutorials/text_classification_rnn from the TensorFlow website. The code has LSTM and Bidirectional layers When the GPU is enabled the time is 56 minutes/epoch. When I am only using the CPU is 264 seconds/epoch. I am using MacBook Pro 14 (10 CPU cores, 16 GPU cores) and TensorFlow-macos 2.8 with TensorFlow-metal 0.5.0.  I face the same problem for TensorFlow-macos 2.9 too. My environment has: tensorflow-macos          2.8.0   tensorflow-metal          0.5.0  tensorflow-text           2.8.1   tensorflow-datasets       4.6.0                    tensorflow-deps           2.8.0                          tensorflow-hub            0.12.0                       tensorflow-metadata       1.8.0                                         When I am using CNNs the GPU is fully enabled and 3-4 times faster than when only using the CPU.  Any idea where is the problem when using LSTMs and Bidirectional?
Posted Last updated
.
Post marked as solved
1 Replies
140 Views
I am trying to run a TensorFlow model on M1 Mac with the following settings: MacBook Pro M1 macOS 12.4 tensorflow-deps & tensorflow-estimator --> 2.9.0 tensorflow-macos --> 2.9.2 tensorflow-metal --> 0.5.0 keras --> 2.9.0 keras-preprocessing --> 1.1.2 Python 3.8.13 When resizing and rescaling from keras.layers, I got the following error: resize_and_rescale = keras.Sequential([ layers.experimental.preprocessing.Resizing(IMAGE_SIZE, IMAGE_SIZE), layers.experimental.preprocessing.Rescaling(1./255), ]) --------------------------------------------------------------------------- AttributeError Traceback (most recent call last) Input In [15], in <cell line: 1>() 1 resize_and_rescale = keras.Sequential([ ----> 2 layers.experimental.preprocessing.Resizing(IMAGE_SIZE, IMAGE_SIZE), 3 layers.experimental.preprocessing.Rescaling(1./255), 4 ]) AttributeError: module 'keras.layers' has no attribute 'experimental' Any suggestions? Thanks
Posted
by mtoseef99.
Last updated
.