mirror of
https://github.com/ml-explore/mlx-examples.git
synced 2025-08-29 18:26:37 +08:00
create output dir
This commit is contained in:
parent
c3e51fcf02
commit
b1a4ba0827
@ -8,6 +8,7 @@ from importlib.metadata import version
|
|||||||
from pathlib import Path
|
from pathlib import Path
|
||||||
from typing import Optional
|
from typing import Optional
|
||||||
|
|
||||||
|
import lm_eval
|
||||||
import mlx.core as mx
|
import mlx.core as mx
|
||||||
import mlx.nn as nn
|
import mlx.nn as nn
|
||||||
import numpy as np
|
import numpy as np
|
||||||
@ -323,6 +324,9 @@ def main():
|
|||||||
parser.add_argument("--seed", type=int, default=123, help="Random seed.")
|
parser.add_argument("--seed", type=int, default=123, help="Random seed.")
|
||||||
args = parser.parse_args()
|
args = parser.parse_args()
|
||||||
|
|
||||||
|
output_dir = Path(args.output_dir)
|
||||||
|
output_dir.mkdir(parents=True, exist_ok=True)
|
||||||
|
|
||||||
# Silence tokenizer warnings
|
# Silence tokenizer warnings
|
||||||
os.environ["TOKENIZERS_PARALLELISM"] = "false"
|
os.environ["TOKENIZERS_PARALLELISM"] = "false"
|
||||||
|
|
||||||
@ -341,7 +345,7 @@ def main():
|
|||||||
)
|
)
|
||||||
|
|
||||||
filename = f"eval_{args.model.replace('/', '_')}_{('_'.join(args.tasks))}_{args.num_shots:02d}_v_{version('lm_eval')}.json"
|
filename = f"eval_{args.model.replace('/', '_')}_{('_'.join(args.tasks))}_{args.num_shots:02d}_v_{version('lm_eval')}.json"
|
||||||
output_path = Path(args.output_dir) / filename
|
output_path = output_dir / filename
|
||||||
output_path.write_text(json.dumps(results["results"], indent=4))
|
output_path.write_text(json.dumps(results["results"], indent=4))
|
||||||
print("Results:")
|
print("Results:")
|
||||||
for result in results["results"].values():
|
for result in results["results"].values():
|
||||||
|
Loading…
Reference in New Issue
Block a user