-
-
Save y0mingzhang/e65783e6c92d448ac94062a7f8951a50 to your computer and use it in GitHub Desktop.
check submission zipfile, LLMs-hw2
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import sys, zipfile | |
filename = sys.argv[1] | |
assert filename.endswith(".zip"), "Is this a zip file?" | |
required_files = set([ | |
"model.py", | |
"train.py", | |
"generate.py", | |
"classify.py", | |
"utils.py", | |
]) | |
optional_files = set(["model.pt", "config.yaml"]) | |
expected_files = required_files | optional_files | |
with zipfile.ZipFile(filename, 'r') as zf: | |
found_files = set(zf.namelist()) | |
if required_files - found_files: | |
print("ERROR: These files required for grading are missing:", list(required_files - found_files)) | |
if optional_files - found_files: | |
print("WARNING: model.pt and/or config.yaml are not found, this is ok if your model is too big to upload to Gradescope.") | |
if found_files - expected_files: | |
print("WARNING: These files are not expected:", list(found_files - expected_files)) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment