Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

使用 load_model 来加载内存中的模型数据 #516

Closed
bigbao9494 opened this issue Aug 6, 2018 · 5 comments
Closed

使用 load_model 来加载内存中的模型数据 #516

bigbao9494 opened this issue Aug 6, 2018 · 5 comments

Comments

@bigbao9494
Copy link

使用 load_model 来加载内存中的模型数据时返回值显示成功,没有任何错误,但是使用这个net时
网络计算出来的数据不正确,函数原型:int load_model(const unsigned char* mem);
mem是我自己分配内存从文件读入的数据,可以确定读出的数据没有任何问题。

但是使用 load_model的其它两个重载函数:(工作都正常)
int load_model(FILE* fp);
int load_model(const char* modelpath);

不知道大家有没有遇到这样的问题呢,还请指教。

@Alan-Turing-Ko
Copy link

In my case, I got crash in following function.
int Net::load_param(const unsigned char* _mem)
If I comment like following, it works.

    int lr = layer->load_param(pd);
    if (lr != 0)
    {
        fprintf(stderr, "layer load_param failed\n");
        continue;
    }

    layers[i] = layer;
}

/* int blob_index = (int)mem; ------------ Comment This Part
mem += 4;
while (blob_index != -233)
{
Blob& blob = blobs[blob_index];

    // blob specific params
    int pdlr = pd.load_param(mem);
    if (pdlr != 0)
    {
        fprintf(stderr, "ParamDict load_param failed\n");
        continue;
    }

    // set blob params
    blob.int8_scale = pd.get(0, 0.f);

    blob_index = *(int*)mem;
    mem += 4;
}

*/

// fill all blob int8_scale
if (use_int8_inference)
{
    for (int i=0; i<blob_count; i++)

I think there is a problem in model parsing.
Please fix if this is issue.

@nihui
Copy link
Member

nihui commented Aug 6, 2018

git master code is unstable, you may try the release version.
Always update your code, recompile and re-convert your model if you want to use the latest code anyway.

@bigbao9494
Copy link
Author

@nihui
load_model函数这个问题有解决?

@zhaokewei
Copy link

请问load_model函数这个问题解决了吗?我也遇到了这个问题,用的最新的release版本.

@nihui
Copy link
Member

nihui commented Nov 19, 2018

应该没有问题了

This issue was closed.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants