Skip to content

Commit 77012b7

Browse files
fix bug for python 3.7 to python 3.10 (#178)
* fix bug for python 3.7 to python 3.10 * fix tensor fusion bug Paddle#55279 --------- Co-authored-by: Liujie0926 <[email protected]>
1 parent 08c44d7 commit 77012b7

File tree

3 files changed

+7
-9
lines changed

3 files changed

+7
-9
lines changed

passl/core/param_fuse.py

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -201,10 +201,8 @@ def _convert_buffer(self, param, p_shape, align):
201201

202202
# Convert the param value
203203
tmp_tensor = self.buffer._slice(self._fill, var_end)
204-
if in_dygraph_mode():
205-
tmp_tensor = tmp_tensor.value().get_tensor()
206-
param.value().get_tensor()._share_data_with(tmp_tensor)
207-
param.value().get_tensor()._set_dims(p_shape)
204+
tmp_tensor._share_buffer_to(param)
205+
param.get_tensor()._set_dims(p_shape)
208206

209207
self._fill = offset
210208

passl/models/utils/pos_embed.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -67,7 +67,7 @@ def get_1d_sincos_pos_embed_from_grid(embed_dim, pos):
6767
out: (M, D)
6868
"""
6969
assert embed_dim % 2 == 0
70-
omega = np.arange(embed_dim // 2, dtype=np.float)
70+
omega = np.arange(embed_dim // 2, dtype=np.float32)
7171
omega /= embed_dim / 2.
7272
omega = 1. / 10000**omega # (D/2,)
7373

requirements.txt

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ prettytable
88
tqdm
99
visualdl
1010
scikit-learn>=0.23.2
11-
opencv-python>=4.2.0.32
12-
onnxruntime-gpu==1.10.0
13-
onnx==1.9.0
14-
paddle2onnx==0.9.4
11+
opencv-python
12+
onnxruntime-gpu
13+
onnx
14+
paddle2onnx

0 commit comments

Comments
 (0)