Machine Learning

RSS for tag

Create intelligent features and enable new experiences for your apps by leveraging powerful on-device machine learning.

Posts under Machine Learning tag

88 Posts
Sort by:
Post not yet marked as solved
0 Replies
304 Views
I'm trying to apply TensorFlow-macOS to accelerate the fine-tune of hugging face transformer program on my Radeon Pro 5300M. However, there shows that "Cannot assign a device for operation", would it be possible to tell me why and how to solve this problem? issues: Version of TensorFlow-macOS is 2.5.0; I've tried to update into 2.6.0, and it've worked. However, it's extremely slower than the 2.5.0 one. It would be a better way to fix 2.5.0 according to the 2.6.0, but I don't know how to do.
Posted
by
Post not yet marked as solved
4 Replies
668 Views
Hi, while I was able to successfully retrieve MLModelCollection with a list of model identifiers from Apple's CoreML Deployment Dashboard, loading encrypted models from a collection results in the following error: NSUnderlyingError=0x281ffb810 {Error Domain=com.apple.CoreML Code=3 "failed to invoke mremap_encrypted with result = -1, error = 12" UserInfo={NSLocalizedDescription=failed to invoke mremap_encrypted with result = -1, error = 12}}} I use the same MLModel.load(contentsOf:configuration:completionHandler:) method with model URLs (from MLModelCollection) which works just fine for non–encrypted models. Is there any workaround for this issue?
Posted
by
Post not yet marked as solved
2 Replies
392 Views
Hi, I have seen this video: https://developer.apple.com/videos/play/wwdc2021/10041/ and in my project i am trying to draw detected barcodes. I am using Vision framework and i have the barcode position in boundingBox parameter, but i dont understand cgrect of that parameter. I am programming in objective c and i don't see resources, and for more complication i have not an image, i am capturing barcodes from video camera sesion. for parts: 1-how can i draw detected barcode like in the video (from an image). 2-how can i draw detected barcode in capturesession. I have used VNImageRectForNormalizedRect to pass from normalized to pixel, but the result is not correct. thank you very much.
Posted
by
Post not yet marked as solved
1 Replies
334 Views
In a section of my app I would like to recommend restaurants to users based on certain parameters. Some parameters have a higher weighting than others. In this WWDC Video a very similar app is made. Here if a user likes a dish a value of 1.0 is assigned to those specific keywords (that apple to the dish) with a value of -1.0 to all other keywords that don't apply to that dish. For my app if the user has ordered I then apply a value of 1.0 (to the keywords that apply) but if a user has just expressed interest (but not ordered) then can I apply a value of 0.5 (and -0.5) instead, would the model adapt to this?
Posted
by
Post not yet marked as solved
1 Replies
557 Views
After collecting data I wanted to create an ML model I have done this before but for some reason I was getting the error: error: Couldn't lookup symbols:  CreateML.MLDataTable.init(contentsOf: Foundation.URL, options: CreateML.MLDataTable.ParsingOptions) throws -> CreateML.MLDataTable  CreateML.MLDataTable.init(contentsOf: Foundation.URL, options: CreateML.MLDataTable.ParsingOptions) throws -> CreateML.MLDataTable So I went to test a working example that was created by apple using this link: https://developer.apple.com/documentation/createml/creating_a_model_from_tabular_data After running this test with no data changed, I still get the same error logged. I don't know if I'm doing something wrong. Any advice would be greatly appreciated.
Posted
by
Post not yet marked as solved
0 Replies
294 Views
Hi, I would like to use a recent version of JAX on my new Macbook Pro with an M1 chip but unfortunately have run into the issue that tensorflow_macos seems to require numpy<=1.19 but JAX requires numpy>=1.20. Is there any way to manually compile tensorflow_macos with a newer numpy version? Or are you planning to release an update any time soon? Thanks!
Posted
by
Post not yet marked as solved
1 Replies
831 Views
this is the message i got as i tried to install tensorflow on my mac M1ship ERROR: tensorflow_addons_macos-0.1a2-cp38-cp38-macosx_11_0_arm64.whl is not a supported wheel on this platform. i have followed all the instruction as presented on the website can somebody help please.?
Posted
by
Post not yet marked as solved
2 Replies
429 Views
Being brand new to create ML I tried to run my own ML project. When creating my own image classifier (same with tabular classification) I fail from the start. When selecting valid training data create ML says "Data Analysis stopped". I'm using Create ML Version 3.0 (78.7). Any suggestions?
Posted
by
Post not yet marked as solved
5 Replies
1.9k Views
Hi everyone, I found that the performance of GPU is not good as I expected (as slow as a turtle), I wanna switch from GPU to CPU. but mlcompute module cannot be found, so wired. The same code ran on colab and my computer (jupyter lab) take 156s vs 40 minutes per epoch, respectively. I only used a small dataset (a few thousands of data points), and each epoch only have 20 baches. I am so disappointing and it seems like the "powerful" GPU is a joke. I am using 12.0.1 macOS and the version of tensorflow-macos is 2.6.0 Can anyone tell me why this happens?
Posted
by
Post not yet marked as solved
5 Replies
2.4k Views
Hi, I installed skearn successfully and ran the MINIST toy example successfully. then I started to run my project. The finning thing everything seems good at the start point (at least no ImportError occurs). but when I made some changes of my code and try to run all cells (I use jupyter lab) again, ImportError occurs..... ImportError: dlopen(/Users/a/miniforge3/lib/python3.9/site-packages/scipy/spatial/qhull.cpython-39-darwin.so, 0x0002): Library not loaded: @rpath/liblapack.3.dylib   Referenced from: /Users/a/miniforge3/lib/python3.9/site-packages/scipy/spatial/qhull.cpython-39-darwin.so   Reason: tried: '/Users/a/miniforge3/lib/liblapack.3.dylib' (no such file), '/Users/a/miniforge3/lib/liblapack.3.dylib' (no such file), '/Users/a/miniforge3/lib/python3.9/site-packages/scipy/spatial/../../../../liblapack.3.dylib' (no such file), '/Users/a/miniforge3/lib/liblapack.3.dylib' (no such file), '/Users/a/miniforge3/lib/liblapack.3.dylib' (no such file), '/Users/a/miniforge3/lib/python3.9/site-packages/scipy/spatial/../../../../liblapack.3.dylib' (no such file), '/Users/a/miniforge3/lib/liblapack.3.dylib' (no such file), '/Users/a/miniforge3/bin/../lib/liblapack.3.dylib' (no such file), '/Users/a/miniforge3/lib/liblapack.3.dylib' (no such file), '/Users/a/miniforge3/bin/../lib/liblapack.3.dylib' (no such file), '/usr/local/lib/liblapack.3.dylib' (no such file), '/usr/lib/liblapack.3.dylib' (no such file) then I have to uninstall scipy, sklearn, etc and reinstall all of them. and my code can be ran again..... Magically I hate to say, anyone knows how to permanently solve this problem? make skearn more stable?
Posted
by
Post marked as solved
3 Replies
1.1k Views
I followed this guideline to install tensorflow https://developer.apple.com/metal/tensorflow-plugin/ but sklearn cannot be found so I used conda install sklearn and then somehow sklearn module still cannot be imported. Here is the outputs when I tried to import sklearn: (base) (tensorflow-metal) a@A ~ % python Python 3.9.7 | packaged by conda-forge | (default, Sep 29 2021, 19:24:02)  [Clang 11.1.0 ] on darwin Type "help", "copyright", "credits" or "license" for more information. >>> import sklearn Traceback (most recent call last):   File "<stdin>", line 1, in <module>   File "/Users/a/miniforge3/lib/python3.9/site-packages/sklearn/__init__.py", line 82, in <module>     from .base import clone   File "/Users/a/miniforge3/lib/python3.9/site-packages/sklearn/base.py", line 17, in <module>     from .utils import _IS_32BIT   File "/Users/a/miniforge3/lib/python3.9/site-packages/sklearn/utils/__init__.py", line 28, in <module>     from .fixes import np_version, parse_version   File "/Users/a/miniforge3/lib/python3.9/site-packages/sklearn/utils/fixes.py", line 20, in <module>     import scipy.stats   File "/Users/a/miniforge3/lib/python3.9/site-packages/scipy/stats/__init__.py", line 441, in <module>     from .stats import *   File "/Users/a/miniforge3/lib/python3.9/site-packages/scipy/stats/stats.py", line 37, in <module>     from scipy.spatial.distance import cdist   File "/Users/a/miniforge3/lib/python3.9/site-packages/scipy/spatial/__init__.py", line 98, in <module>     from .qhull import * ImportError: dlopen(/Users/a/miniforge3/lib/python3.9/site-packages/scipy/spatial/qhull.cpython-39-darwin.so, 0x0002): Library not loaded: @rpath/liblapack.3.dylib   Referenced from: /Users/a/miniforge3/lib/python3.9/site-packages/scipy/spatial/qhull.cpython-39-darwin.so   Reason: tried: '/Users/a/miniforge3/lib/liblapack.3.dylib' (no such file), '/Users/a/miniforge3/lib/liblapack.3.dylib' (no such file), '/Users/a/miniforge3/lib/python3.9/site-packages/scipy/spatial/../../../../liblapack.3.dylib' (no such file), '/Users/a/miniforge3/lib/liblapack.3.dylib' (no such file), '/Users/a/miniforge3/lib/liblapack.3.dylib' (no such file), '/Users/a/miniforge3/lib/python3.9/site-packages/scipy/spatial/../../../../liblapack.3.dylib' (no such file), '/Users/a/miniforge3/lib/liblapack.3.dylib' (no such file), '/Users/a/miniforge3/bin/../lib/liblapack.3.dylib' (no such file), '/Users/a/miniforge3/lib/liblapack.3.dylib' (no such file), '/Users/a/miniforge3/bin/../lib/liblapack.3.dylib' (no such file), '/usr/local/lib/liblapack.3.dylib' (no such file), '/usr/lib/liblapack.3.dylib' (no such file) >>>  some people said sklearn cannot be used in M1 Chip, is it right? tensorflow-macos: 2.6.0 tensorflow-metal: 0.2.0 macOS: 12.0.1 Many thanks for any help.
Posted
by
Post not yet marked as solved
25 Replies
10k 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
by
Post not yet marked as solved
1 Replies
379 Views
I'm getting an error very early in the the process and these tutorials seems very simple so I'm stumped. This tutorial seems straightforward but I can't make it past the step where I drag in image sets in. https://developer.apple.com/documentation/createml/creating_an_image_classifier_model video tutorial: https://www.youtube.com/watch?v=DSOknwpCnJ4 I have 1 folder titled "Training Data" with 2 sub-folders "img1" and "img2". When I drag my folder "Training Data" into the Training Data section I get the error: "No training data found. 0 invalid files found." I have no idea what is causing this. Images are .jpg and taken from my phone. I only have 6 total images in the initial test. I've tried it with and without an annotations.json file created in COCO Annotator, that didn't make a difference same error with or without. Big Sur 11.5.2 Create ML 3.0
Posted
by
Post not yet marked as solved
0 Replies
333 Views
I already installed tensorflow latest version using the documentation given (link). But when I tried to run notebook with command "%tensorflow_version 2.x" , its giving error "UsageError: Line magic function %tensorflow_version not found.". Please tell me, what to do ?
Posted
by
006
Post not yet marked as solved
1 Replies
385 Views
Question 1: I'm trying to follow along with the code from WWDC20-10657 , but my Xcode won't recognise MLWordEmbedding . I am importing Natural Language, CoreML and CreateML Question 2: More generally - I have not grasped how an .mlmodel (which I built in Playgrounds from my domain specific text corpus) can be easily converted into a custom sentence embedding. Right now I have 'something' that I can use in that I brute force unpacked the .mlmodel into [key: [vector]] dictionary, which I am now trying the reformat as a custom embedding - but the video implied that the .mlmodel could be used more or less directly.
Posted
by
Post not yet marked as solved
0 Replies
326 Views
I already installed tensorflow latest version using the documentation given (link). But when I tried to run notebook with command "%tensorflow_version 2.x" , its giving error "UsageError: Line magic function %tensorflow_version not found.". Please tell me, what to do ?
Posted
by
006
Post marked as solved
1 Replies
280 Views
Got the following error when added the --encrypt flag to the build phase for my .coreml model file. coremlc: error: generate command model encryption is not supported on the specific deployment target macos. Any insights would be appreciated. Thanks.
Posted
by
Post marked as solved
1 Replies
454 Views
I'm working with a style transfer model trained with pytorch in google colaboratory and then converted to an ML package. When I bring it into xcode and try to preview the asset I see the following error. There was a problem decoding this Core ML document missingMetadataField(named: "inputSchema") I've been able to train and convert models as .mlmodel files, I'm only seeing this issue with .mlpackage files. I'm using xcode 13 beta, which as far as I know is the only version of xcode that can handle ML packages/programs at the moment, and I'm using the coremltools beta to handle the conversion. Prior to the conversion, or if I convert to an ML Model instead it seems to work just fine. Is this a problem with how the model is being structured, or converted? Is this a problem with how I've set up my xcode environment/swift project? Is there some way to update the metadata associated with ML packages to make sure the missing input schema is included?
Posted
by