Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Display API key invalid when using one's own agent #752

Closed
1 task done
Aq114 opened this issue Jul 2, 2024 · 12 comments
Closed
1 task done

Display API key invalid when using one's own agent #752

Aq114 opened this issue Jul 2, 2024 · 12 comments
Assignees
Labels
bug Something isn't working fixed Bug is resolved

Comments

@Aq114
Copy link

Aq114 commented Jul 2, 2024

Search before asking

  • I have searched the HUB issues and found no similar bug report.

HUB Component

API Key

Bug

I encountered the following issue when using my own agent: Ultralytics HUB: Get API key from https://hub.ultralytics.com/settings?tab=api +keys and then run 'yolo hub login API_KEY'
2024-07-02 11:46:05,977 - hub_sdk.helpers.logger - WARNING - Ultralytics HUB-SDK: Invalid API key ⚠️。 But when I checked the API, there were no errors, and the program eventually terminated unexpectedly: raise RuntimeError (f'DataLoader worker (pid (s) {pids str}) exited unexpectedly ') from e
RuntimeError: DataLoader worker (pid (s) 4168, 9180, 3524, 7872, 7664, 6560) exceeded unexpectedly. How can I solve it?

Environment

windows 11
python 3.11
Ultralytics YOLOv8.2.48 🚀 Python-3.11.9 torch-2.3.1 CUDA:0 (NVIDIA GeForce GTX 1050 Ti, 4096MiB)

Minimal Reproducible Example

Click on the dataset you have uploaded to train the model, use your own proxy, and copy the relevant code to run it in the Python file of PyCharm. After running for a period of time, this prompt will appear. During this period, the training iteration can still be repeated several times, but it will eventually stop unexpectedly.

Additional

No response

@Aq114 Aq114 added the bug Something isn't working label Jul 2, 2024
Copy link

github-actions bot commented Jul 2, 2024

👋 Hello @Aq114, thank you for raising an issue about Ultralytics HUB 🚀! Please visit our HUB Docs to learn more:

  • Quickstart. Start training and deploying YOLO models with HUB in seconds.
  • Datasets: Preparing and Uploading. Learn how to prepare and upload your datasets to HUB in YOLO format.
  • Projects: Creating and Managing. Group your models into projects for improved organization.
  • Models: Training and Exporting. Train YOLOv5 and YOLOv8 models on your custom datasets and export them to various formats for deployment.
  • Integrations. Explore different integration options for your trained models, such as TensorFlow, ONNX, OpenVINO, CoreML, and PaddlePaddle.
  • Ultralytics HUB App. Learn about the Ultralytics App for iOS and Android, which allows you to run models directly on your mobile device.
    • iOS. Learn about YOLO CoreML models accelerated on Apple's Neural Engine on iPhones and iPads.
    • Android. Explore TFLite acceleration on mobile devices.
  • Inference API. Understand how to use the Inference API for running your trained models in the cloud to generate predictions.

If this is a 🐛 Bug Report, please provide screenshots and steps to reproduce your problem to help us get started working on a fix.

If this is a ❓ Question, please provide as much information as possible, including dataset, model, environment details etc. so that we might provide the most helpful response.

We try to respond to all issues as promptly as possible. Thank you for your patience!

@pderrenger
Copy link
Member

@Aq114 hello,

Thank you for reaching out and providing detailed information about the issue you're encountering. To better assist you, it would be very helpful if you could provide a minimal reproducible example of your code. This will allow us to replicate the issue on our end and diagnose the problem more effectively. You can find guidelines on how to create a minimal reproducible example here.

In the meantime, please ensure that you are using the latest versions of all relevant packages, including the Ultralytics HUB SDK and YOLOv8. Sometimes, issues like these are resolved in newer releases.

Regarding the specific error messages:

  • Invalid API Key: Double-check that the API key you are using is correctly copied from the API settings page. Ensure there are no extra spaces or characters.
  • DataLoader worker exited unexpectedly: This could be related to several factors, including memory limitations or issues with the data loading process. You might want to try reducing the number of workers or batch size to see if that mitigates the issue.

Here's a small snippet to adjust the DataLoader parameters:

from ultralytics import YOLO

# Example of reducing the number of workers
model = YOLO('yolov8n.pt')
model.train(data='coco128.yaml', epochs=10, batch_size=8, workers=2)

If you continue to experience issues, please share the minimal reproducible example, and we will investigate further.

Thank you for your cooperation and patience. We look forward to resolving this issue for you.

@Aq114
Copy link
Author

Aq114 commented Jul 2, 2024 via email

@sergiuwaxmann sergiuwaxmann self-assigned this Jul 2, 2024
@sergiuwaxmann
Copy link
Member

@Aq114 Hello!
Maybe you can generate a new API key by deleting your existing one from settings and generating a new one?
SCR-20240702-i81

@Aq114
Copy link
Author

Aq114 commented Jul 2, 2024

Hello, I have tried the method you mentioned and still encounter the same error. The key issue is that when I ran the dataset I customized yesterday and the dataset publicly available on the platform, there were no errors and I was able to successfully train. However, when I modified the customized dataset today (by adding a test set section), this error occurred.

@sergiuwaxmann
Copy link
Member

@Aq114 Looks like your error isn't related to the API key but to the dataset structure.
Please make sure that you using the correct structure we highlighted in our documentation.

@Aq114
Copy link
Author

Aq114 commented Jul 2, 2024

Yes, I have also doubted this issue because the datasets I have successfully trained currently do not have a test set portion, and the custom dataset I made an error in is dividing the original training set into a new training set and a validation set, with the original validation set used as the new test set. But when I use the publicly available wild life dataset with training sets on the platform, it can also run. Thank you very much. I will try to rebuild the dataset again according to the pattern you provided.

@sergiuwaxmann
Copy link
Member

@Aq114 No worries, good luck!

@sergiuwaxmann sergiuwaxmann added the fixed Bug is resolved label Jul 2, 2024
@Aq114
Copy link
Author

Aq114 commented Jul 4, 2024

Unfortunately, I tried again today and unexpectedly failed again, still with this error. I think if there is an error in the construction structure of the dataset, it will fail to upload the dataset because I encountered this error a few days ago and will no longer display the API key during the training process.

@sergiuwaxmann
Copy link
Member

@Aq114 Before you upload your dataset, please make sure you validate it locally.

from ultralytics.hub import check_dataset
check_dataset("path/to/dataset.zip", task="detect")

@Aq114
Copy link
Author

Aq114 commented Jul 4, 2024

Well,I have passed this check and the dataset can be successfully uploaded to the platform. The images and overview, as well as the partition of the dataset, can be displayed on the platform. There was only an error in the training step. Thank you again for your valuable advice and patience!

@pderrenger
Copy link
Member

Hello @Aq114,

Thank you for your patience and for providing additional details. It's great to hear that your dataset passed the validation check and was successfully uploaded to the platform. Given that the issue arises during the training step, let's delve deeper into potential causes and solutions.

  1. DataLoader Worker Exited Unexpectedly: This error often points to issues with data loading or memory constraints. Here are a few steps you can take to troubleshoot:

    • Reduce the Number of Workers: Sometimes, reducing the number of workers can help mitigate this issue. You can do this by setting the workers parameter in your training script.
    • Batch Size: Try reducing the batch size to see if it helps. A smaller batch size can reduce memory usage and potentially resolve the issue.
    • Check for Corrupt Images: Ensure that there are no corrupt images in your dataset. Corrupt files can sometimes cause unexpected crashes during training.
  2. Example Code: If possible, please share a minimal reproducible example of your training script. This will help us replicate the issue on our end and provide a more accurate solution. You can find guidelines on creating a minimal reproducible example here.

  3. Latest Versions: Ensure that you are using the latest versions of all relevant packages, including the Ultralytics HUB SDK and YOLOv8. Sometimes, issues like these are resolved in newer releases.

Here’s a small snippet to adjust the DataLoader parameters:

from ultralytics import YOLO

# Example of reducing the number of workers and batch size
model = YOLO('yolov8n.pt')
model.train(data='path/to/your/dataset.yaml', epochs=10, batch_size=8, workers=2)

If the issue persists, please provide any additional logs or error messages you encounter. This will help us diagnose the problem more effectively.

Thank you for your cooperation and patience. We’re here to help you get this resolved! 😊

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working fixed Bug is resolved
Projects
None yet
Development

No branches or pull requests

3 participants