ayaanzhaque / instruct-nerf2nerf

Instruct-NeRF2NeRF: Editing 3D Scenes with Instructions (ICCV 2023)
https://instruct-nerf2nerf.github.io/
MIT License
769 stars 64 forks source link

about pix2pix,access huggingface #57

Closed yoker5262 closed 10 months ago

yoker5262 commented 10 months ago

I have another question about pix2pix, code: pipe = StableDiffusionInstructPix2PixPipeline.from_pretrained("timbrooks/instaruct-pix2pix",torch_dtype=torch.float16,safety_checker=None) , In this line of code, there is a download, access huggingface, and write to .cache/huggingface/hub. Why does it need to be accessed every time it is executed?

ayaanzhaque commented 10 months ago

I'm pretty sure diffusers checks if you already have a model downloaded in the cache, and if its downloaded, then it will just load from there. This is probably a better question for the diffusers repo.

yoker5262 commented 10 months ago

url:https://huggingface.co/timbrooks/instruct-pix2pix/tree/main .Whether the model file is downloaded from this URL and placed in the cache. What should I download, because my network speed is not good, I can only use other methods to download to the local, copy to the corresponding .cache floder

ayaanzhaque commented 10 months ago

I am not entirely sure how the huggingface download works, I think you will get a better answer if you ask in the huggingface repo

yoker5262 commented 10 months ago

I think in your code, access huggingface to download files, which files are downloaded? Whether the folder name written in the cache is a fixed name or a random name. What files does pix2pix need to obtain from huggingface during execution?

ayaanzhaque commented 10 months ago

I assume the files to the InstructPix2Pix model are being downloaded. From what I know, it connects to the network to check if the correct files are previously downloaded, and if so, it will just load from cache.

yoker5262 commented 10 months ago

yes,The logic you said is correct. I use the pix2pix part alone. Every time I run pix2pix, it needs to access hugging, and often reports errors due to network connection problems. Use debug to check that the problem appears in the StableDiffusionInstructPix2PixPipeline.from_pretrained() method. There is a model--timbrooks--instruct-pix2pix folder in my cache, so what I don't understand is that my code directly uses pix2pix for image processing, and the img2img method is combined with the prompt instruction. The code executes multiple times because the network connection has an 80% error rate. Now that I was able to execute the script successfully, it proves that the relevant files it needs have been downloaded in the cache. Subsequent executions should no longer use the network to access huggingface, but it turns out that it accesses it every time, at least once. It is not so easy to access huggingface on the Internet in China.

ayaanzhaque commented 10 months ago

Yes, it will access it atleast once. From my understanding, that is the only way to trigger the loading of instructpix2pix from huggingface. I would ask in the huggingface repo on how to avoid the huggingface server check all together.

yoker5262 commented 10 months ago

Will it still access huggingface if the relevant file it needs already exists in my local cache? What code can I modify so that the relevant files it needs exist in my cache and it no longer accesses huggingface?

ayaanzhaque commented 10 months ago

Yes it will do so. you will have to edit huggingface code in order to do this. That is why i suggest you ask on the huggingface repo

yoker5262 commented 10 months ago

ok , I see what you mean. Thank you for your reply