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

safetensors.tensorflow.save modifies its input argument #480

Closed
2 tasks
allaisandrea opened this issue May 14, 2024 · 1 comment
Closed
2 tasks

safetensors.tensorflow.save modifies its input argument #480

allaisandrea opened this issue May 14, 2024 · 1 comment
Labels

Comments

@allaisandrea
Copy link

System Info

python version: 3.10.13 (main, Nov 19 2023, 17:34:57) [GCC 9.3.0]
tensorflow version: 2.12.0
safetensors version: 0.4.3

Information

  • The official example scripts
  • My own modified scripts

Reproduction

import safetensors.tensorflow
import tensorflow as tf
tensors = {'tensor1': tf.constant([1, 2, 3])}
safetensors.tensorflow.save_file(tensors, '/tmp/tensors.safetensors')
assert isinstance(tensors['tensor1'], tf.Tensor), type(tensors['tensor1'])

The assertion triggers

Traceback (most recent call last):
  ...
    assert isinstance(tensors['tensor1'], tf.Tensor), type(tensors['tensor1'])
AssertionError: <class 'numpy.ndarray'>

This is because this function modifies its argument

Expected behavior

The assertion should not trigger.

Copy link

This issue is stale because it has been open 30 days with no activity. Remove stale label or comment or this will be closed in 5 days.

@github-actions github-actions bot added the Stale label Jun 14, 2024
@github-actions github-actions bot closed this as not planned Won't fix, can't repro, duplicate, stale Jun 19, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

1 participant