We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
tune.py
1 parent e101642 commit 78ba790Copy full SHA for 78ba790
python/kernel_launcher/wisdom.py
@@ -4,6 +4,7 @@
4
import math
5
import numpy as np
6
import os.path
7
+import re
8
import socket
9
import subprocess
10
@@ -223,10 +224,11 @@ def _convert_config(config: dict, keys: list):
223
224
225
226
def _wisdom_file(path, key):
- if os.path.isdir(path) and key is not None:
227
- return os.path.join(path, key + ".wisdom")
228
- elif path.endswith(".wisdom"):
+ if path.endswith(".wisdom"):
229
return path
+ elif os.path.isdir(path) and key is not None:
230
+ filename = re.sub("[^0-9a-zA-Z_.-]", "_", key) + ".wisdom"
231
+ return os.path.join(path, filename)
232
else:
233
raise ValueError(f"path must be a directory or a file ending with .wisdom: {path}")
234
0 commit comments