When I try to run autotrain for a simple two-category image classifier I keep getting this error:
ValueError(f"{self.train_data} should contain at least 2 subfolders.")
I have zipped folder a named “train” and within it are two subfolders named “positive” and “negative” each with png or jpg files named exactly positive.1.jpg, etc exactly as the docs recommend.
At first glance, it looks fine. The suspicious thing is the zip? It seems that not only files, but also entire directories are compressed, including the directory structure, or vice versa.
Also, it seems that it doesn’t work if you set a specific file or directory name, such as “train”. In HF, there are quite a few things that are hard-coded by file name…
Thanks so much, John6666! I see what you’re saying, and I read the blog post, which does have a different approach to file hierarchies than what I saw in the documentation. I’ll try some of these approaches. I was following this format (a single .zip file with two subfolders):
Both of these were written by HF staff… Well, it’s not just HF, but sometimes documents are wrong, or they get out of date, or the library has a bug.
Maybe only the zip extraction is buggy.
Another possibility is that the handling of jpg files in the HF library is buggy sometimes. If you use png, it’ll be stable. But that’s a rare case.
are you sure you have 2 folders when zip is extracted and not one folder with two subfolders inside? more often, its the first case. when zip is extracted it must produce two folders and NOT one folder with two sub-folders inside.
, yes, abhishek, that was the “super basic” thing I was missing–thanks so much!
I had zipped a folder with two subfolders, not created a zip archive from two folders. I’ll post on Autotrain next time—although this was still a very quick reply, much appreciated.