Fix directory creation issue in adapter file copying
Browse files- adapter.py +4 -0
adapter.py
CHANGED
|
@@ -86,10 +86,14 @@ for file in UTILITY_FILES:
|
|
| 86 |
src = os.path.join(current_dir, file)
|
| 87 |
dst = os.path.join(current_dir, 'ablang2', 'pretrained_utils', file)
|
| 88 |
if os.path.exists(src) and not os.path.exists(dst):
|
|
|
|
|
|
|
| 89 |
shutil.copy2(src, dst)
|
| 90 |
|
| 91 |
# Also copy encodings.py as encodings.py (original name)
|
| 92 |
if os.path.exists('ablang_encodings.py') and not os.path.exists('ablang2/pretrained_utils/encodings.py'):
|
|
|
|
|
|
|
| 93 |
shutil.copy2('ablang_encodings.py', 'ablang2/pretrained_utils/encodings.py')
|
| 94 |
|
| 95 |
# Now import using the original structure
|
|
|
|
| 86 |
src = os.path.join(current_dir, file)
|
| 87 |
dst = os.path.join(current_dir, 'ablang2', 'pretrained_utils', file)
|
| 88 |
if os.path.exists(src) and not os.path.exists(dst):
|
| 89 |
+
# Ensure the destination directory exists
|
| 90 |
+
os.makedirs(os.path.dirname(dst), exist_ok=True)
|
| 91 |
shutil.copy2(src, dst)
|
| 92 |
|
| 93 |
# Also copy encodings.py as encodings.py (original name)
|
| 94 |
if os.path.exists('ablang_encodings.py') and not os.path.exists('ablang2/pretrained_utils/encodings.py'):
|
| 95 |
+
# Ensure the destination directory exists
|
| 96 |
+
os.makedirs('ablang2/pretrained_utils', exist_ok=True)
|
| 97 |
shutil.copy2('ablang_encodings.py', 'ablang2/pretrained_utils/encodings.py')
|
| 98 |
|
| 99 |
# Now import using the original structure
|