You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
When I executed transformer models in bfloat16 at HF, I got the incorrect result on s390x. I realized values in weights are different between x86 and s390x. The following is a small reproduction.
Execute the following program on x86
import torch
from safetensors import safe_open
from safetensors.torch import save_file
tensors = {
"weight1": torch.ones((8, 8), dtype=torch.bfloat16),
}
save_file(tensors, "bf16.safetensors")
read_tensors = {}
with safe_open("bf16.safetensors", framework="pt", device="cpu") as f:
for key in f.keys():
read_tensors[key] = f.get_tensor(key)
print(read_tensors)
Copy bf16.safetensors into s390x machine. Then, execute the following program
import torch
from safetensors import safe_open
read_tensors = {}
with safe_open("bf16.safetensors", framework="pt", device="cpu") as f:
for key in f.keys():
read_tensors[key] = f.get_tensor(key)
print(read_tensors)
System Info
Information
Reproduction
When I executed transformer models in bfloat16 at HF, I got the incorrect result on s390x. I realized values in weights are different between x86 and s390x. The following is a small reproduction.
Execute the following program on x86
Copy
bf16.safetensors
into s390x machine. Then, execute the following programThe result is as follows:
Expected behavior
The result on s390x should be as follows:
My colleague is curious whether this code works well.
The text was updated successfully, but these errors were encountered: