Skip to content

Commit 878562b

Browse files
yao-matrixydshieh
andauthored
fix test device spec relative path importing issue (#37190)
Signed-off-by: YAO Matrix <matrix.yao@intel.com> Co-authored-by: Yih-Dar <2521628+ydshieh@users.noreply.github.com>
1 parent 8ebc435 commit 878562b

File tree

1 file changed

+2
-0
lines changed

1 file changed

+2
-0
lines changed

src/transformers/testing_utils.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3005,6 +3005,8 @@ def backend_device_count(device: str):
30053005

30063006
# Try to strip extension for later import – also verifies we are importing a
30073007
# python file.
3008+
device_spec_dir, _ = os.path.split(os.path.realpath(device_spec_path))
3009+
sys.path.append(device_spec_dir)
30083010
try:
30093011
import_name = device_spec_path[: device_spec_path.index(".py")]
30103012
except ValueError as e:

0 commit comments

Comments
 (0)