Fix lint
Browse files
src/axolotl/prompt_strategies/__init__.py
CHANGED
@@ -1,3 +1,5 @@
|
|
|
|
|
|
1 |
import importlib
|
2 |
|
3 |
|
@@ -7,8 +9,8 @@ def load(strategy, tokenizer, cfg):
|
|
7 |
if strategy.split(".")[-1].startswith("load_"):
|
8 |
load_fn = strategy.split(".")[-1]
|
9 |
strategy = ".".join(strategy.split(".")[:-1])
|
10 |
-
|
11 |
-
|
12 |
-
return
|
13 |
-
except:
|
14 |
-
|
|
|
1 |
+
"""Module to load prompt strategies."""
|
2 |
+
|
3 |
import importlib
|
4 |
|
5 |
|
|
|
9 |
if strategy.split(".")[-1].startswith("load_"):
|
10 |
load_fn = strategy.split(".")[-1]
|
11 |
strategy = ".".join(strategy.split(".")[:-1])
|
12 |
+
mod = importlib.import_module(f".{strategy}", "axolotl.prompt_strategies")
|
13 |
+
func = getattr(mod, load_fn)
|
14 |
+
return func(tokenizer, cfg)
|
15 |
+
except Exception: # pylint: disable=broad-exception-caught
|
16 |
+
return None
|