load_test_dataset.py 6.2 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697
  1. # from datasets import load_dataset
  2. #
  3. # dataset_paths = [
  4. # ['ceval/ceval-exam',
  5. # ['computer_network', 'operating_system', 'computer_architecture', 'college_programming', 'college_physics',
  6. # 'college_chemistry', 'advanced_mathematics', 'probability_and_statistics', 'discrete_mathematics',
  7. # 'electrical_engineer', 'metrology_engineer', 'high_school_mathematics', 'high_school_physics',
  8. # 'high_school_chemistry', 'high_school_biology', 'middle_school_mathematics', 'middle_school_biology',
  9. # 'middle_school_physics', 'middle_school_chemistry', 'veterinary_medicine', 'college_economics',
  10. # 'business_administration', 'marxism', 'mao_zedong_thought', 'education_science', 'teacher_qualification',
  11. # 'high_school_politics', 'high_school_geography', 'middle_school_politics', 'middle_school_geography',
  12. # 'modern_chinese_history', 'ideological_and_moral_cultivation', 'logic', 'law', 'chinese_language_and_literature',
  13. # 'art_studies', 'professional_tour_guide', 'legal_professional', 'high_school_chinese', 'high_school_history',
  14. # 'middle_school_history', 'civil_servant', 'sports_science', 'plant_protection', 'basic_medicine',
  15. # 'clinical_medicine', 'urban_and_rural_planner', 'accountant', 'fire_engineer',
  16. # 'environmental_impact_assessment_engineer', 'tax_accountant', 'physician']], # ceval*
  17. # ['haonan-li/cmmlu', [
  18. # 'agronomy', 'anatomy', 'ancient_chinese', 'arts', 'astronomy', 'business_ethics',
  19. # 'chinese_civil_service_exam', 'chinese_driving_rule', 'chinese_food_culture',
  20. # 'chinese_foreign_policy', 'chinese_history', 'chinese_literature',
  21. # 'chinese_teacher_qualification', 'clinical_knowledge', 'college_actuarial_science',
  22. # 'college_education', 'college_engineering_hydrology', 'college_law',
  23. # 'college_mathematics', 'college_medical_statistics', 'college_medicine',
  24. # 'computer_science', 'computer_security', 'conceptual_physics',
  25. # 'construction_project_management', 'economics', 'education', 'electrical_engineering',
  26. # 'elementary_chinese', 'elementary_commonsense', 'elementary_information_and_technology',
  27. # 'elementary_mathematics', 'ethnology', 'food_science', 'genetics', 'global_facts',
  28. # 'high_school_biology', 'high_school_chemistry', 'high_school_geography',
  29. # 'high_school_mathematics', 'high_school_physics', 'high_school_politics',
  30. # 'human_sexuality', 'international_law', 'journalism', 'jurisprudence',
  31. # 'legal_and_moral_basis', 'logical', 'machine_learning', 'management', 'marketing',
  32. # 'marxist_theory', 'modern_chinese', 'nutrition', 'philosophy', 'professional_accounting',
  33. # 'professional_law', 'professional_medicine', 'professional_psychology',
  34. # 'public_relations', 'security_study', 'sociology', 'sports_science',
  35. # 'traditional_chinese_medicine', 'virology', 'world_history', 'world_religions'
  36. # ]], # cmmlu*
  37. # ['tyouisen/aclue',
  38. # ['polysemy_resolution', 'poetry_sentiment_analysis', 'named_entity_recognition', 'basic_ancient_chinese',
  39. # 'poetry_context_prediction', 'sentence_segmentation', 'couplet_prediction', 'poetry_appreciate',
  40. # 'ancient_chinese_culture', 'ancient_phonetics', 'homographic_character_resolution', 'ancient_literature',
  41. # 'ancient_medical', 'poetry_quality_assessment', 'reading_comprehension']], # aclue
  42. # ['juletxara/mgsm', ['zh']], # mgsm_direct_zh
  43. # ['openbookqa', ['main']], # openbookqa
  44. # ['ZoneTwelve/tmmluplus',
  45. # ['dentistry', 'traditional_chinese_medicine_clinical_medicine', 'clinical_psychology', 'technical',
  46. # 'culinary_skills', 'mechanical', 'logic_reasoning', 'real_estate', 'general_principles_of_law', 'finance_banking',
  47. # 'anti_money_laundering', 'ttqav2', 'marketing_management', 'business_management', 'organic_chemistry',
  48. # 'advance_chemistry', 'physics', 'secondary_physics', 'human_behavior', 'national_protection', 'jce_humanities',
  49. # 'politic_science', 'agriculture', 'official_document_management', 'financial_analysis', 'pharmacy',
  50. # 'educational_psychology', 'statistics_and_machine_learning', 'management_accounting', 'introduction_to_law',
  51. # 'computer_science', 'veterinary_pathology', 'accounting', 'fire_science', 'optometry', 'insurance_studies',
  52. # 'pharmacology', 'taxation', 'education_(profession_level)', 'economics', 'veterinary_pharmacology',
  53. # 'nautical_science', 'occupational_therapy_for_psychological_disorders', 'trust_practice', 'geography_of_taiwan',
  54. # 'physical_education', 'auditing', 'administrative_law', 'basic_medical_science', 'macroeconomics', 'trade',
  55. # 'chinese_language_and_literature', 'tve_design', 'junior_science_exam', 'junior_math_exam', 'junior_chinese_exam',
  56. # 'junior_social_studies', 'tve_mathematics', 'tve_chinese_language', 'tve_natural_sciences', 'junior_chemistry',
  57. # 'music', 'education', 'three_principles_of_people', 'taiwanese_hokkien', 'engineering_math', 'linear_algebra']]
  58. # # tmmluplus
  59. #
  60. # ]
  61. #
  62. # for dataset_path in dataset_paths:
  63. # for dataset_name in dataset_path[1]:
  64. # datasets = load_dataset(dataset_path[0], dataset_name, cache_dir='./test_dataset_cache')
  65. #
  66. # """
  67. # export HF_HUB_OFFLINE=1 && lm_eval --model hf --model_args pretrained=/xxx/minimind/minimind-v2-small/,device=cuda,dtype=auto --tasks ceval* --batch_size 8 --trust_remote_code
  68. # """
  69. """
  70. $env:HF_HUB_OFFLINE=1; lm_eval --model hf --model_args pretrained=../minimind-v2-small/,device=cuda,dtype=auto --tasks ceval* --batch_size 8 --trust_remote_code
  71. """
  72. import subprocess
  73. # 定义要执行的命令
  74. command = (
  75. 'set HF_HUB_OFFLINE=1 & '
  76. 'lm_eval --model hf --model_args pretrained=../minimind-v2-small/,device=cuda,dtype=auto '
  77. '--tasks ceval* --batch_size 8 --trust_remote_code'
  78. )
  79. # 使用 subprocess 执行命令
  80. try:
  81. process = subprocess.run(
  82. command,
  83. shell=True,
  84. check=True,
  85. text=True,
  86. stdout=subprocess.PIPE,
  87. stderr=subprocess.PIPE,
  88. )
  89. # 打印命令的输出
  90. print("STDOUT:", process.stdout)
  91. print("STDERR:", process.stderr)
  92. except subprocess.CalledProcessError as e:
  93. print(f"命令执行失败,返回码: {e.returncode}")
  94. print("STDERR:", e.stderr)