Skip to content
This repository has been archived by the owner on Oct 23, 2023. It is now read-only.

unable to load local .ptl model #211

Open
akash-zdaly opened this issue Apr 11, 2023 · 2 comments
Open

unable to load local .ptl model #211

akash-zdaly opened this issue Apr 11, 2023 · 2 comments

Comments

@akash-zdaly
Copy link

Description

Hi,

I want to load a local model located in my project folder at "./models/model.ptl"

i tried using ,

'''
// const filePath = await MobileModel.download(MODEL_URL);
// model = await torch.jit._loadForMobile('./assets/yolo_zdaly.ptl');
model = await Torch.loadModel(modelPath);
console.log(model);
console.log('Model successfully loaded');

'''

react-native-pytorch-core": "^0.2.4"

Images

image

Website

NA

Credit (optional)

No response

Source Code (optional)

https://github.com/akash-zdaly/objdet

@remod
Copy link

remod commented Apr 15, 2023

I've managed to make it work using

let path = await MobileModel.download(
  require('./models/model.ptl'),
);
let model = await torch.jit._loadForMobile(path);

Note 1: You need to make sure the ptl file is bundled with your app. To achieve this, make sure you've performed this step.

Note 2: Model::download()is deprecated. It's documentation recommends to "Use third-party file downloader (e.g., expo-file-system or react-native-fs)". But I guess as long as other code in this repo is using the function it is still fine to use :)

@bobogogo1990
Copy link

bobogogo1990 commented May 23, 2023

@remod fixed thanks. And vscode show: The signature '(modelPath: ModelPath): Promise' of 'MobileModel.download' is deprecated.ts(6387).

Is there new method?

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants
@remod @bobogogo1990 @akash-zdaly and others