gitpython detected but not able to write commit SHA to file
tavisc opened this issue · 3 comments
I've finally got this up and running, after dealing with a ton of PyTorch issues. but I keep getting the error "gitpython detected but not able to write commit SHA to file." It doesn't seem to matter as far as I can tell, everything gets correctly written to /output but I just thought I'd see if anyone had a fix or if a fix is even necessary.
Ahh. Did you by any chance download the codebase directly instead of cloning it?
Here's the offending code in app.py
/ diffusion_app.py
:
if "git" in sys.modules:
try:
repo = git.Repo(search_parent_directories=True)
commit_sha = repo.head.object.hexsha
details["commit_sha"] = commit_sha[:6]
except Exception as e:
print("GitPython detected but not able to write commit SHA to file")
print(f"raised Exception {e}")
GitPython is used here to find the current commit ID, so that it can be recorded as run metadata. The most likely reason you are seeing this error, is because GitPython wasn't able to detect the local folder as a repo, which can happen if the repo wasn't cloned.
The only implication is just that when the run metadata is logged with each image, it will not be possible to trace which version of the code base the image is generated from. You might be interested in that info if you are concerned with replicability, but otherwise it's just a warning that doesn't affect the output.
I thought I had cloned it but maybe not. At any rate everything appears to be working so I'm not too bothered. Oddly it DOES write a json file, which appears to contain all the information about each run, while still giving me an error. Here's an example json:
`{
"run_id": "n7iGbbPZ",
"num_steps": 25,
"planned_num_steps": 25,
"text_input": "test image",
"init_image": false,
"image_prompts": false,
"continue_prev_run": false,
"prev_run_id": null,
"seed": 251327559303400,
"Xdim": 250,
"ydim": 250,
"vqgan_ckpt": "vqgan_imagenet_f16_1024",
"start_time": "20220301T161311",
"end_time": "20220301T161327",
"mse_weight": 0,
"mse_weight_decay": 0,
"mse_weight_decay_steps": 0,
"tv_loss_weight": 0.001,
"use_cutout_augmentations": true}`
If I use the same seed on another run I get something that's very close to identical, probably around 98% identical.
Yeah you shouldn't see any issues with the JSON file output, the only thing missing would be the commit ID, which is relevant if you want to reproduce an image from previous versions of the codebase.
Setting the seed for reproduciblity on the same version of the codebase should work fine, you should be getting very similar images as observed. It's difficult to get exactly the same image however due to small amounts of hardware stochasticity (see notes-and-observations#reproducibility).