Skip to content

Commit

Permalink
Trying to debug remotely.
Browse files Browse the repository at this point in the history
  • Loading branch information
Narsil committed Jul 29, 2024
1 parent a82254e commit 3a84ffb
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions bindings/python/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -578,13 +578,16 @@ impl Open {
.getattr(intern!(py, "view"))?
.call((), Some(&view_kwargs))?;

println!("Byte order {byteorder}");

if byteorder == "big" {
let version: String =
torch.getattr(intern!(py, "__version__"))?.extract()?;
let version =
Version::from_string(&version).map_err(SafetensorError::new_err)?;
if version >= Version::new(2, 1, 0) {
let dtype: PyObject = get_pydtype(torch, info.dtype, false)?;
println!("Using torch byteswap");
tensor
.getattr(intern!(py, "untyped_storage"))?
.call0()?
Expand All @@ -597,6 +600,7 @@ impl Open {
} else {
let inplace_kwargs = [(intern!(py, "inplace"), false.into_py(py))]
.into_py_dict_bound(py);
println!("Using numpy byteswap");
let numpy = tensor
.getattr(intern!(py, "numpy"))?
.call0()?
Expand Down

0 comments on commit 3a84ffb

Please sign in to comment.