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

the export model and read_checkpoint is conflict #501

Open
l1351868270 opened this issue Mar 26, 2024 · 2 comments
Open

the export model and read_checkpoint is conflict #501

l1351868270 opened this issue Mar 26, 2024 · 2 comments

Comments

@l1351868270
Copy link

l1351868270 commented Mar 26, 2024

in the export.py file, in the version1_export and version2_export function, have these codes

    # first write out the header. the header will be 256 bytes
    # 1) write magic, which will be uint32 of "ak42" in ASCII
    out_file.write(struct.pack('I', 0x616b3432))
    # 2) write version, which will be int
    out_file.write(struct.pack('i', version))

but, in the run.c, read_checkpoint function, not handle the magic and version bytes.
so, it when i export model use verion 1 or 2, it will have a fatal

malloc failed!

i think, the code in the version1_export and version2_export function should delete, or handle the magic and version bytes in the read_checkpoint function

    char magic[4];
    int version;
    if (fread(&magic, sizeof(unsigned int), 1, file) != 1) { exit(EXIT_FAILURE); }
    printf("magic is %s\n", magic);
    if (fread(&version, sizeof(int), 1, file) != 1) { exit(EXIT_FAILURE); }
    printf("version is %d\n", version);
    ......
    float* weights_ptr = *data + sizeof(Config)/sizeof(float) + 2;
@vikramdattu
Copy link

Hi @l1351868270

I think the issue I get is similar to this: #510
Did you have any directions to how to fix this in run.c?

@jameswdelancey
Copy link
Contributor

Use legacy version for run.c and version 2 for runq.c

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

3 participants