0

I was trying to follow this tutorial do AI image generation on a remote server: https://youtu.be/tgRiZzwSdXg

And I am getting stuck at this stage:

notebook screenshot

Apparently it needs me to log into github before it will download the images. Normally this would be trivial but this isn't running in a normal terminal, and I cannot give it any input to log me in. You can see in the attached screen shot with the output right below the code block. Does anyone know how I'm supposed to do this?

player0
  • 124,011
  • 12
  • 67
  • 124
  • There's directions at the site you link to under the description of the video (toggle 'Show more' to see the rest of the text) how to fix that: "Download my repo by replacing the cell by: .... " with `./gdrive upload ./trained_models --recursive`. – Wayne Oct 17 '22 at 17:56
  • But if I were to encounter this sort of problem again in the future, how would I give it my git credentials? – Jarrett A. Oct 18 '22 at 21:21
  • Your topic tags make me think you want to focus on Jupyter...There's extensions for helping Jupyter users work with git. For example, [jupyterlab-git](https://github.com/jupyterlab/jupyterlab-git). However, you may want to understand what the `!git clone ...` line is doing better if you don't already know. The exclamation point sends things outside of Jupyter to your machine's shell in a temporary shell instance where everything after the exclamation point is run and then any output is sent back to the notebook and the temporary shell instance is shut down. So you have to provide your ... – Wayne Oct 19 '22 at 15:17
  • credentials in the same line. So what you are really asking is more along the lines of [this](https://stackoverflow.com/a/10054470/8508004) where the answers involve providing everything in one line. You'd just put on the exclamation point so you can run it in the Jupyter notebook. However, keep in mind you wrote "I was trying to follow this tutorial do AI image generation on a remote server". Is the 'remote server' purely your own? Otherwise security is an issue. So make sure you only use the token based ones, see the comments towards the bottom ... – Wayne Oct 19 '22 at 15:25
  • .. , such as [here](https://stackoverflow.com/questions/10054318/how-do-i-provide-a-username-and-password-when-running-git-clone-gitremote-git#comment115607447_10054470). Especially note the warnings, such as [here](https://stackoverflow.com/questions/10054318/how-do-i-provide-a-username-and-password-when-running-git-clone-gitremote-git#comment129804399_10054470). ( I think GitHub has now mainly blocked the routes that use passwords though. Although you may not know that before you go ahead and try on the remote sever and provide it with your password inadvertently.) – Wayne Oct 19 '22 at 16:27
  • I knew from working with sessions served via mybinder.org that for **public repositories** it won't ask you for your credentials when you try to clone an entire repository, and so I've now posted a solution that will work using git and just requires a small tweak to the code you showed. – Wayne Oct 19 '22 at 16:29

1 Answers1

0

I think I've come up with what is going on and how to easily work around it for this case, yet still use git. (The developer offers an non-git route that I reference in the comment below the OP.) You shouldn't need credentials because this is a public repo. Since you have git working on your machine, you should be good. (I can tell git it working because it says it is cloning in that first line below the code in your image instead of saying git isn't recognized.) Try this in Jupyter on your remote machine:

dataset="style_ddim"
#!git clone https://github.com/aitrepreneur/SD-Regularization-Images-Style-Dreambooth-{dataset}.git
!git clone https://github.com/aitrepreneur/SD-Regularization-Images-Style-Dreambooth.git
!mkdir -p regularization_images/{dataset}
!mv -v SD-Regularization-Images-Style-Dreambooth/{dataset}/*.* regularization_images/{dataset}

That version of the steps should work in Jupyter on your remote server without making the cell keep sitting there running and asking you for a username. (Which you cannot provide post-execution because the way the exclamation point sends things to the shell and how Jupyter cells work.)

All I have done is comment out the original line that was getting a specific folder and replaced it with a line cloning the whole repository.
It seems Github treats the ability of getting a specific directory directly as an 'advanced' ability and wants your GitHub credentials for that. Like it would want them for cloning a private repository. Cloning an entire public repository doesn't trigger that need.

What I said in my comments about how you really would provide your credentials on one line holds and the associated security risks, but all that isn't necessary in this case. And you shouldn't need credentials for git cloning public repositories. So the paradigm of just using !git clone ... without credentials inside Jupyter cells should hold if you need to use a similar approach to get something from git. In this case we didn't need to adjust any of the subsequent handling of the cloned contents after; however, that may not always be the case.


Note:
I would have noted that you could just adjust the git clone line earlier if you had included code along with with your image. People trying to help you want it easy. They don't want to type a lot of code that you had as code text and thus could have easily provided in your post. In general, avoid images or only use them as a minor supplement to show behavior. This and more is touched on in How do I ask a good question?. (People trying to help also don't want to go digging elsewhere for code where only a link to a video is provided. Video is farther from code than a screenshot.)
I will say that your use of an image to show the output was definitely justified and helped me match up what I was seeing with yours and know you had git working. With all the symbols and weird characters there it would have been hard to get just right in text only. So why it is best to avoid images, there definitely is a case for 'reserved use' along with text descriptions and code.

Wayne
  • 6,607
  • 8
  • 36
  • 93