Spaces:
Running
Why have my submission results failed every time?
I submitted the code to you from Huggingface 5 times, but all showed failure. The code I submitted was modified according to the example you provided, so I don't know why it failed. The URL of the code is "https://huggingface.co/xcssgzs/resNet101/tree/main ".
The libraries I used include:
import os
import json
import pandas as pd
import torch
from PIL import Image
from torchvision import transforms
from model import resnet101
where model module is in another file "model.py"
Hi @xcssgzs ,
What is your submission id? Without that we cannot say anything. If it is "1ad7a9ee-51ba-40d1-9505-41bfaa4fdefa," this is your error message.
Traceback (most recent call last):
File "/tmp/model/script.py", line 94, in <module>
predict(test_metadata, root_path)
File "/tmp/model/script.py", line 28, in predict
assert os.path.exists(img_path), "file: '{}' dose not exist.".format(img_path)
AssertionError: file: '/tmp/data/private_testset/d73887c0-2556-4d80-9b88-86dc828362ae.jpg' dose not exist.
It seems that you are loading some images that do not exist.
Please check the sample submission for inspiration on how to submit.
Best,
Lukas
@picekl
Thank you! It is mine.
The image name is obtrained from the file "SnakeCLEF2024_TestMetadata.csv". Is this right?
The root dir is "/tmp/data/private_testset". Is this right?
@picekl
The paths are as follows:
"""
with zipfile.ZipFile("/tmp/data/private_testset.zip", 'r') as zip_ref:
zip_ref.extractall("/tmp/data")
root_path = '/tmp/data/private_testset'
metadata_file_path = "./SnakeCLEF2024_TestMetadata.csv"
"""
The file name is from "./SnakeCLEF2024_TestMetadata.csv" and "SnakeCLEF2024_TestMetadata.csv" is got from "https://huggingface.co/picekl/SnakeCLEF2024-Sample_Submission/tree/main". Is there any errors?
@picekl
I don't need to prepare the file "/tmp/data/private_testset/d73887c0-2556-4d80-9b88-86dc828362ae.jpg" and the dir "/tmp/data/private_testset", do I? This path and data are prepared by the organizer, aren't they?
The images are not there as you commented out the extraction. See your line 66 and 67.
Lukas
@picekl
Thank you very much. I'm very sorry to bother you. It still report an error after removing the comment. Could you send me the error message? The submission ID is "f9eaecf6-98d9-4d01-bb7a-34ffdc3fc8ca"
Dear @xcssgzs ,
Please try to test your submission locally first. We are happy to help you, but our time is limited. Here is your next error.
/tmp/model
Traceback (most recent call last):
File "/tmp/model/script.py", line 94, in <module>
predict(test_metadata, root_path)
File "/tmp/model/script.py", line 30, in predict
img = data_transform(img)
File "/app/env/lib/python3.10/site-packages/torchvision/transforms/transforms.py", line 95, in __call__
img = t(img)
File "/app/env/lib/python3.10/site-packages/torch/nn/modules/module.py", line 1511, in _wrapped_call_impl
return self._call_impl(*args, **kwargs)
File "/app/env/lib/python3.10/site-packages/torch/nn/modules/module.py", line 1520, in _call_impl
return forward_call(*args, **kwargs)
File "/app/env/lib/python3.10/site-packages/torchvision/transforms/transforms.py", line 277, in forward
return F.normalize(tensor, self.mean, self.std, self.inplace)
File "/app/env/lib/python3.10/site-packages/torchvision/transforms/functional.py", line 349, in normalize
return F_t.normalize(tensor, mean=mean, std=std, inplace=inplace)
File "/app/env/lib/python3.10/site-packages/torchvision/transforms/_functional_tensor.py", line 926, in normalize
return tensor.sub_(mean).div_(std)
RuntimeError: The size of tensor a (4) must match the size of tensor b (3) at non-singleton dimension 0
Best,
Lukas
Dear @xcssgzs ,
Here is a text we have in a different thread to prevent any unnecessary submission fails.
Before writing to this thread, ask yourself the following questions and submitt only if you answer YES to all of them.
- Did my code run in a local environment?
- Did I use python 3.10?
- Did you push your code to HugginFace as a model?
- Can your model process 10,000 images in 60 minutes in a similar environment like t4-small?
- Did you use any non-standard library? [if yes, go to a different thread and request it]
❗Please provide your submission ID while asking for an Error Log ❗
Best,
Lukas