How to load a custom model from disk - huggingface

I did a fine tunning on whisper model with custom data and pushed to huggingFace, I clone it and cant make inferences from disk, how I could load from disk and make inference, this is the model link, thanks a lot
https://huggingface.co/kirah/fcv_s2t_2/tree/main

Related

Load a heavy CoreML model from a remote source

We have a situation where we have a heavy CoreML model (170MB~) that we want to include in our iOS app.
Since we don't want the app size to be that large, we created a smaller model (that has lesser performance) that we can include directly and our intention is the download the heavy model upon app start and switch between the two when the heavy model is downloaded.
Our initial thought was to go to Apple's CoreML Model Deployment solution but it quickly turned out to be impossible for us as Apple requires MLModel archives to be up to 50MB.
So the question is, is there an alternative solution to loading a CoreML model from a remote source, similar to Apple's solution, and how would one implement it?
Any help would be appreciated. Thanks!
Put the mlmodel file on a server you own, download it into the app's Documents folder using your favorite method, create a URL to the downloaded file, use MLModel.compileModel(:at) to compile it, initialize the MLModel (or the automatically generated class) using the compiled model.

Building a 3D model Database - Preferably MySql/Postgres/MongoDB

I am currently working on creating a library of 3D models created till date by our in-house 3D modellers using Unity3D/Maya/3ds Max, for further analysis and keeping track of each.
So, my question is how to go about storing them?
So should I store them in a database or use some kind of storage like AWS S3. They are to be stored in .fbx format. Once stored I would want to perform operations on them, like viewing them online, download etc.
Is there any other way/some kind of best practice to do the same
According to Wikipedia .fbx format is represented as "binary or ASCII data". This means that you can hardly analyze it using SQL.
You will probably use a simple BLOB (or other binary type) column to store the model itself. This will allow you to control access to models, share them, add comments, store revisions, etc. For viewing or downloading you will pull the whole file content from the database and serve it as binary data.

Blob data in Ensembles

Im using a strategy where I'm saving images and pdfs as NSData in the respective managed objects where they belong. I'm having a problem syncing with Ensembles that the pdf doesn't always carry over from one device to another. Now I'm not sure if this is due to some flaws in my code or if it's not a good way of syncing chunks of data like this. Does anyone have experience of this?
I'm using Ensembles 2.2 syncing through CloudKit.
Ensembles should handle this fine. I use it for exactly this purpose, syncing image data including PDF.
I would look closer at the handling of the data. Is the value transformer working (if you are using one)? Is the device capable of unpacking and displaying the PDF data?
An alternative to syncing the PDF directly is transforming to a format like PNG before putting it in your store.
Transformable data type is really just binary under the covers with some additional metadata. Have you tested a simple lightweight migration on an existing store? I suspect the migration would work and would leave the existing data in the store.
If you are looking to get the existing binary data actually moved out of the SQLite file then you are looking at something a bit more involved.
A heavy migration will accomplish what you are looking for but if the stores are large it may take took long and potentially not provide enough feedback for a good user experience. I personally do not use heavy migrations, ever, on IOS but it will accomplish your goal.
An export/import will also work. I generally recommend export/import when a lightweight migration won't work. It involves a medium amount of code but in the end you own the code, understand the entire process and can tweak it to your exact needs.

Is UIDocument a suitable strategy for large documents with metadata?

I'm looking into using UIDocument en NSFileWrapper to store 'projects' that contain quite a few large video files and some small text files. There are a few problems that I run into, and I'm starting to wonder if UIDocument is still the right strategy.
Performance
As far as I can tell, NSFileWrapper loads everything in memory. This can be a problem when working with large video files. I think it's possible to work around this by using custom save and load methods that forego the standard NSFileWrapper.
Metadata
I want to display a list of all the documents along with some metadata. This can for example include a preview image, number of recorded scenes, length of videos etc. The only way to fetch this data now is to open each document and retrieve it. Probably quite slow, especially with large documents.
Solutions?
I see two solutions now: ditch UIDocument altogether and go for a custom architecture, or use some kind of centralized metadata file. Drawbacks of the latter is that I have to manage metadata in two separate places and that I need to keep them in sync manually.
Is UIDocument still the way to go here, and if so: What could be a way to solve these problems?
Based on the comments the asker found a way to move forward as such:
drop UIDocument in favor of a Core Data solution. I now save all my
data using Core Data and manually manage the large files on the
filesystem. It works pretty well for me, and I'm glad I made the
switch. The only thing I had to give up was easy iCloud syncing. But
with files as large as these, that wasn't really feasible anyway. It
seems you can create your own file wrapper class to work around some
performance problems with large files.

Core Data & Asset Library

I'm starting a new project (and very new to Core Data) and was curious about how to manage images within Core Data and an Asset Library. I've done some reading and am just unclear on how everything works together.
Is it possible for each Managed Object to have an "asset library" of images? ie. can the asset library be populated with Core Data data.
What is the best way to handle having a large array of images attached to a managed object?
If anyone can point me in a direction of an article/tutorial or provide further guidance, that would be greatly appreciated.
Thanks!
Yes Core Data can handle storing an image asset database as well as the images themselves. Core Data has an option that will let it store large binary objects as files, rather than in the sqlite database itself. Core Data would be effective for storing details about the images and for categorising them into albums, projects etc.. It would also be useful for searching on these attributes.
Typically you would not attach a large array of images to a managed object. An image would be represented by a managed object and one of the attributes of the managed object would be the image (which Core Data might decide to store as a file somewhere).
I think you might be out of luck if you want to use iCloud for replicating this image library because I don't think Core Data will sync these externally stored image files.
https://developer.apple.com/library/ios/releasenotes/General/WhatsNewIniOS/Articles/iOS5.html
Managed objects support two significant new features: ordered relationships, and external storage for attribute values. If you specify that the value of a managed object attribute may be stored as an external record, Core Data heuristically decides on a per-value basis whether it should save the data directly in the database or store a URI to a separate file that it manages for you.
if you store your images in image assets and Managed Object have the "asset library" of images, then you will have the problem on updating the images.
and even if you do not want to ever update the images then why to store it in core data ?
solution is : have the images in image assets and also store the binary data of images in core data in launching the app.
by checking a date of modified coming from a web server you can check whether to update the images or not.
this link is helping you to import anything to core data easily done.

Resources