Skip to content

Signed int is used to store the random seed instead of unsigned #2002

@axim2

Description

@axim2

Prerequisites

Please answer the following questions for yourself before submitting an issue.

  • I am running the latest code. Development is very rapid so there are no tagged versions as of now.
  • I carefully followed the README.md.
  • I searched using keywords relevant to my issue to make sure that I am creating a new issue that is not already open (or closed).
  • I reviewed the Discussions, and have a new bug or useful enhancement to share.

Expected Behavior

Random seed should be stored as uint32_t.

Current Behavior

I've discovered the issue while developing an UI for llama.cpp (https://github.com/axim2/llm-ui): a big enough seed is interpreted as a negative number which leads llama.cpp to generate a new seed instead of using the given one.

main also crashes with core dump if seed over 2^31 is given to it on the command line.

Currently seed = -1 in gpt_params is used to indicate that a new random seed is needed, this can be replaced by having an additional parameter to llama_init_from_file(). Then the seed can be stored as uint32_t without issues.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions