1
-
2
1
import json
3
- import shlex
4
2
from pathlib import Path
5
3
from typing import List
6
4
@@ -26,7 +24,7 @@ class TestQuantizationW4A4_FP4:
26
24
"""
27
25
28
26
@pytest .mark .parametrize (
29
- "script_filename" ,
27
+ ( "script_filename" ) ,
30
28
[
31
29
pytest .param ("llama3_example.py" ),
32
30
pytest .param ("llama4_example.py" ),
@@ -43,15 +41,13 @@ def test_quantization_w4a4_fp4_example_script(
43
41
44
42
assert result .returncode == 0 , gen_cmd_fail_message (command , result )
45
43
46
- # verify that the expected directory got generated
47
- nvfp4_dirs : List [Path ] = list (Path .cwd ().glob ("*-NVFP4" ))
48
- assert (len (nvfp4_dirs )) == 1 , (
49
- f"unexpectedly found more than one generated folder: { nvfp4_dirs } "
50
- )
51
- print ("generated model directory:/n" )
52
- print (list (nvfp4_dirs [0 ].iterdir ()))
44
+ # verify the expected directory was generated
45
+ nvfp4_dirs : List [Path ] = list (tmp_path .rglob ("*-NVFP4" ))
46
+ assert (
47
+ len (nvfp4_dirs )
48
+ ) == 1 , f"did not find exactly one generated folder: { nvfp4_dirs } "
53
49
54
- # is the generated content in the expected format?
55
- config_json = json .loads (Path (nvfp4_dirs [0 ] / "config.json" ).read_text ())
50
+ # verify the format in the generated config
51
+ config_json = json .loads ((nvfp4_dirs [0 ] / "config.json" ).read_text ())
56
52
config_format = config_json ["quantization_config" ]["format" ]
57
- assert ( config_format == "nvfp4-pack-quantized" )
53
+ assert config_format == "nvfp4-pack-quantized"
0 commit comments