浏览代码

rm python 3.11 idiom

Guillaume Wenzek 1 年之前
父节点
当前提交
b7b31a3978
共有 2 个文件被更改,包括 2 次插入2 次删除
  1. 1 1
      ggml/ggml.py
  2. 1 1
      ggml/third_party_ggml.py

+ 1 - 1
ggml/ggml.py

@@ -141,7 +141,7 @@ def _strided_to_numpy(tensor_p: ggml_tensor_p) -> np.ndarray:
     res = _void_p_to_np_array(tensor.data, tuple(full_shape), numpy_dtype(tensor.type))
     res = _void_p_to_np_array(tensor.data, tuple(full_shape), numpy_dtype(tensor.type))
 
 
     # Extract the correct slice
     # Extract the correct slice
-    res = res[*(slice(0, n) for n in t_shape)]
+    res = res.__getitem__(*[slice(0, n) for n in t_shape])
     # TODO: we could handle transposition here
     # TODO: we could handle transposition here
 
 
     return res
     return res

+ 1 - 1
ggml/third_party_ggml.py

@@ -60,7 +60,7 @@ from typing import Type
 from typing import Callable
 from typing import Callable
 from typing import Tuple
 from typing import Tuple
 from typing import Dict
 from typing import Dict
-from typing import Self
+from typing_extensions import Self
 from typing import Any
 from typing import Any
 from pathlib import Path
 from pathlib import Path
 from typing import List, Optional, Sequence, Union
 from typing import List, Optional, Sequence, Union