pytorch-neural-style-transfer-johnson icon indicating copy to clipboard operation
pytorch-neural-style-transfer-johnson copied to clipboard

raise InvalidGitRepositoryError(epath) git.exc.InvalidGitRepositoryError:

Open chengkeng opened this issue 4 years ago • 3 comments

Hi! I tried the example and felt very cool! But when I trained my model, an error occurred in batch = [1501/20695]. The content is as follows:


(neural-style-transfer-fast) C:\MyWork\My_GAN_Work\pytorch-neural-style-transfer-fast-master>python training_script.py --style_img_name guanyu.png Using 165560 datapoints (41390 batches) (MS COCO images) for transformer network training. Learning the style of guanyu.png style image.


Hyperparams: content_weight=1.0, style_weight=400000.0 and tv_weight=0


Logging to console every 500 batches. Saving checkpoint models every 2000 batches. Tensorboard enabled. Run "tensorboard --logdir=runs --samples_per_plugin images=50" from your conda env Open http://localhost:6006/ in your browser and you're ready to use tensorboard!


time elapsed=0.00[min]|epoch=1|batch=[1/20695]|c-loss=0.024014575958251953|s-loss=0.09249082946777344|tv-loss=0.0|total loss=0.11650540542602539 time elapsed=1.18[min]|epoch=1|batch=[501/20695]|c-loss=6.4460309705734256|s-loss=6.1190721788406375|tv-loss=0.0|total loss=12.565103149414062 time elapsed=2.37[min]|epoch=1|batch=[1001/20695]|c-loss=5.169563026428222|s-loss=3.0164252252578736|tv-loss=0.0|total loss=8.185988251686096 time elapsed=3.58[min]|epoch=1|batch=[1501/20695]|c-loss=4.590205996513367|s-loss=2.6954647307395936|tv-loss=0.0|total loss=7.285670727252961 Traceback (most recent call last): File "training_script.py", line 160, in train(training_config) File "training_script.py", line 96, in train training_state = utils.get_training_metadata(training_config) File "C:\MyWork\My_GAN_Work\pytorch-neural-style-transfer-fast-master\utils\utils.py", line 230, in get_training_metadata "commit_hash": git.Repo(search_parent_directories=True).head.object.hexsha, File "C:\Users\Creator\miniconda3\envs\neural-style-transfer-fast\lib\site-packages\git\repo\base.py", line 181, in init raise InvalidGitRepositoryError(epath) git.exc.InvalidGitRepositoryError: C:\MyWork\My_GAN_Work\pytorch-neural-style-transfer-fast-master


I did not find a solution on Google. Is there any way to make it work? I am looking forward to the effect after training! Thank you!

chengkeng avatar Feb 04 '21 14:02 chengkeng

you ever figure this out? having the exact same issue. it's an issue with git pretty sure, not the nst script

slyman928 avatar Apr 18 '21 19:04 slyman928

git clone https://github.com/gordicaleksa/pytorch-neural-style-transfer-johnson

and then follow the setup, should work

slyman928 avatar Apr 20 '21 03:04 slyman928

I can confirm that cloning the repo first eliminates this error.

Originally I had just put the files from the repo into the working directory manually and I too got the above error when I tried to train the network.

robertgoacher avatar May 22 '21 17:05 robertgoacher