Commit 05872ac
authored
convert : fix big-endian conversion (#17431)
* Fix convert_hf_to_gguf.py script on s390x
Assume converted model data is originally little-endian.
Byteswap data on s390x after reading it to put values in correct presentation
for any transformation needed, like calculating weight tensors.
Then byteswap data to little-endian before passing it to GGUFWriter while
GGUFWriter will byteswap data back to big endian if big endian output is requested.
byteswap(inplace=True) calls don't work with lazy tensor and array wrappers.
Use byteswap with copying data to workaround this behaviour.
* Make GGUFWriter accept tensors in native endianness instead of little-endian
With this change if no byteswapping is actually needed, 2 excessive byteswaps can be omitted on s390x
* Fix byteswapping in convert_hf_to_gguf.py for remote models1 parent 55ab25c commit 05872ac
2 files changed
+42
-6
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
10061 | 10061 | | |
10062 | 10062 | | |
10063 | 10063 | | |
| 10064 | + | |
| 10065 | + | |
| 10066 | + | |
| 10067 | + | |
| 10068 | + | |
| 10069 | + | |
| 10070 | + | |
| 10071 | + | |
| 10072 | + | |
| 10073 | + | |
| 10074 | + | |
| 10075 | + | |
| 10076 | + | |
| 10077 | + | |
| 10078 | + | |
| 10079 | + | |
| 10080 | + | |
| 10081 | + | |
| 10082 | + | |
10064 | 10083 | | |
10065 | 10084 | | |
10066 | 10085 | | |
| |||
10104 | 10123 | | |
10105 | 10124 | | |
10106 | 10125 | | |
| 10126 | + | |
| 10127 | + | |
| 10128 | + | |
| 10129 | + | |
| 10130 | + | |
10107 | 10131 | | |
10108 | | - | |
| 10132 | + | |
| 10133 | + | |
10109 | 10134 | | |
10110 | 10135 | | |
10111 | 10136 | | |
10112 | 10137 | | |
10113 | 10138 | | |
10114 | 10139 | | |
10115 | 10140 | | |
| 10141 | + | |
| 10142 | + | |
| 10143 | + | |
| 10144 | + | |
| 10145 | + | |
10116 | 10146 | | |
| 10147 | + | |
10117 | 10148 | | |
10118 | 10149 | | |
10119 | | - | |
| 10150 | + | |
10120 | 10151 | | |
10121 | 10152 | | |
10122 | 10153 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
4 | 4 | | |
5 | 5 | | |
6 | 6 | | |
| 7 | + | |
7 | 8 | | |
8 | 9 | | |
9 | 10 | | |
| |||
372 | 373 | | |
373 | 374 | | |
374 | 375 | | |
375 | | - | |
376 | | - | |
| 376 | + | |
| 377 | + | |
| 378 | + | |
| 379 | + | |
377 | 380 | | |
378 | 381 | | |
379 | 382 | | |
| |||
399 | 402 | | |
400 | 403 | | |
401 | 404 | | |
402 | | - | |
403 | | - | |
| 405 | + | |
| 406 | + | |
| 407 | + | |
| 408 | + | |
404 | 409 | | |
405 | 410 | | |
406 | 411 | | |
| |||
0 commit comments