Skip to content

tests/models/sam_hq/test_modeling_sam_hq.py::SamHQModelIntegrationTest may fail since a lot of cases are lack of set_seed() #42890

@sywangyi

Description

@sywangyi

System Info

transformers built from latest main.

Who can help?

@ydshieh
similar issue may occur in tests/models/sam/test_modeling_sam.py

see https://github.com/sywangyi/transformers/blob/main/src/transformers/models/sam_hq/modeling_sam_hq.py#L1077
randn() is used in positional_embedding, so you need to set_seed() before modeling loading to guarantee the stable output. or else accuracy check will fail.

Information

  • The official example scripts
  • My own modified scripts

Tasks

  • An officially supported task in the examples folder (such as GLUE/SQuAD, ...)
  • My own task or dataset (give details below)

Reproduction

pytest tests/models/sam_hq/test_modeling_sam_hq.py::SamHQModelIntegrationTest

Expected behavior

all pass in cuda.
actual: 11 failed, 3 passed,

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions