Skip to content

numpy break change np.fromstring binary mode removed #1343

@xiaoyao9184

Description

@xiaoyao9184

System Info

pip show numpy
Name: numpy
Version: 2.3.0

Environment/Platform

  • Website/web-app
  • Browser extension
  • Server-side (e.g., Node.js, Deno, Bun)
  • Desktop app (e.g., Electron)
  • Other (e.g., VSCode extension)

Description

Convert model to ONNX

Reproduction

python -m scripts.convert --quantize --model_id Qwen/Qwen2.5-0.5B-Instruct

Traceback (most recent call last):
  File "<frozen runpy>", line 198, in _run_module_as_main
  File "<frozen runpy>", line 88, in _run_code
  File "/home/ubuntu/code/transformers.js/scripts/convert.py", line 456, in <module>
    main()
  File "/home/ubuntu/code/transformers.js/scripts/convert.py", line 428, in main
    quantize(
  File "/home/ubuntu/code/transformers.js/scripts/quantize.py", line 309, in quantize
    quantize_fp16(
  File "/home/ubuntu/code/transformers.js/scripts/quantize.py", line 217, in quantize_fp16
    model_fp16 = float16.convert_float_to_float16(
                 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/ubuntu/code/transformers.js/scripts/float16.py", line 255, in convert_float_to_float16
    value_info_block_list = process_tensor_in_node(
                            ^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/ubuntu/code/transformers.js/scripts/float16.py", line 510, in process_tensor_in_node
    convert_tensor_float_to_float16(
  File "/home/ubuntu/code/transformers.js/scripts/float16.py", line 138, in convert_tensor_float_to_float16
    float32_list = np.fromstring(tensor.raw_data, dtype="float32")
                   ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
ValueError: The binary mode of fromstring is removed, use frombuffer instead

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions