mirror of
				https://github.com/pytorch/pytorch.git
				synced 2025-11-04 08:00:58 +08:00 
			
		
		
		
	Reference: https://docs.astral.sh/ruff/formatter/#f-string-formatting - Change the outer quotes to double quotes for nested f-strings ```diff - f'{", ".join(args)}' + f"{', '.join(args)}" ``` - Change the inner quotes to double quotes for triple f-strings ```diff string = """ - {', '.join(args)} + {", ".join(args)} """ ``` - Join implicitly concatenated strings ```diff - string = "short string " "short string " f"{var}" + string = f"short string short string {var}" ``` Pull Request resolved: https://github.com/pytorch/pytorch/pull/144569 Approved by: https://github.com/Skylion007 ghstack dependencies: #146509
		
			
				
	
	
		
			41 lines
		
	
	
		
			829 B
		
	
	
	
		
			Python
		
	
	
	
	
	
			
		
		
	
	
			41 lines
		
	
	
		
			829 B
		
	
	
	
		
			Python
		
	
	
	
	
	
import argparse
 | 
						|
import sys
 | 
						|
import textwrap
 | 
						|
 | 
						|
import pandas as pd
 | 
						|
 | 
						|
 | 
						|
def check_csv(filename):
 | 
						|
    """
 | 
						|
    Basic accuracy checking.
 | 
						|
    """
 | 
						|
 | 
						|
    df = pd.read_csv(filename)
 | 
						|
 | 
						|
    failed = []
 | 
						|
    for _, row in df.iterrows():
 | 
						|
        model_name = row["name"]
 | 
						|
        status = row["accuracy"]
 | 
						|
        if "pass" not in status:
 | 
						|
            failed.append(model_name)
 | 
						|
 | 
						|
        print(f"{model_name:34} {status}")
 | 
						|
 | 
						|
    if failed:
 | 
						|
        print(
 | 
						|
            textwrap.dedent(
 | 
						|
                f"""
 | 
						|
                Error {len(failed)} models failed
 | 
						|
                    {" ".join(failed)}
 | 
						|
                """
 | 
						|
            )
 | 
						|
        )
 | 
						|
        sys.exit(1)
 | 
						|
 | 
						|
 | 
						|
if __name__ == "__main__":
 | 
						|
    parser = argparse.ArgumentParser()
 | 
						|
    parser.add_argument("--file", "-f", type=str, help="csv file name")
 | 
						|
    args = parser.parse_args()
 | 
						|
    check_csv(args.file)
 |