[GH-ISSUE #64] Evaluation with ImageNet #60

Closed
opened 2026-10-31 21:10:22 +00:00 by bsakaguchi · 2 comments
Owner

Originally created by @meigaoms on GitHub (Mar 22, 2021).
Original GitHub issue: https://github.com/openai/CLIP/issues/64

Hi there,
"A logistic regression classifier using scikit-learn’s L-BFGS implementation" is used in A.3 Evaluation. It's a brilliant choice for its simplicity for a fair comparison. This classifier works well for most datasets, but takes me a very long time for ImageNet dataset, about 8 days with a single CPU. Could you shed some lights on how to speed it up?
Thank you in advance.

Originally created by @meigaoms on GitHub (Mar 22, 2021). Original GitHub issue: https://github.com/openai/CLIP/issues/64 Hi there, "A logistic regression classifier using scikit-learn’s L-BFGS implementation" is used in A.3 Evaluation. It's a brilliant choice for its simplicity for a fair comparison. This classifier works well for most datasets, but takes me a very long time for ImageNet dataset, about 8 days with a single CPU. Could you shed some lights on how to speed it up? Thank you in advance.
Author
Owner

@jongwook commented on GitHub (Mar 22, 2021):

We used a quite beefy machine with many CPU cores to run each logistic regression taking about 2 days, but it took more than a week for us to finish the hyperparameter sweep. This was okay for this project as a one-off task, but we're looking into ways to perform logistic regression on distributed GPUs so that it can produce equivalent results as sklearn's while running faster.

Using Adam or SGD with momentum instead of L-BFGS allows to use faster mini-batch training instead of full-batch training, but it's tricky to get the optimal result from it, and the gap seems to vary between models/datasets. This was precisely the reason why we sticked to scikit-learn.

During earlier iterations on the project, we used a subset of 50,000 random samples from the dataset for validation, which can be run quite faster.

Btw, we haven't got a chance to look into #45 yet. Thanks for your patience!

<!-- gh-comment-id:804444364 --> @jongwook commented on GitHub (Mar 22, 2021): We used a quite beefy machine with many CPU cores to run each logistic regression taking about 2 days, but it took more than a week for us to finish the hyperparameter sweep. This was okay for this project as a one-off task, but we're looking into ways to perform logistic regression on distributed GPUs so that it can produce equivalent results as sklearn's while running faster. Using Adam or SGD with momentum instead of L-BFGS allows to use faster mini-batch training instead of full-batch training, but it's tricky to get the optimal result from it, and the gap seems to vary between models/datasets. This was precisely the reason why we sticked to scikit-learn. During earlier iterations on the project, we used a subset of 50,000 random samples from the dataset for validation, which can be run quite faster. Btw, we haven't got a chance to look into #45 yet. Thanks for your patience!
Author
Owner

@meigaoms commented on GitHub (Mar 25, 2021):

Exactly! The hyperparameter sweep takes most of the time. Thanks a lot.
I found cuML has a GPU version logistic regression with L-bfgs for multinomial classification. Unfortunately, its L-bfgs implementation with L2 regularization is not exactly the same as sklearn's, so it fails to produce an equivalent result still.

<!-- gh-comment-id:806389007 --> @meigaoms commented on GitHub (Mar 25, 2021): Exactly! The hyperparameter sweep takes most of the time. Thanks a lot. I found [cuML](https://docs.rapids.ai/api/cuml/stable/api.html#logistic-regression) has a GPU version logistic regression with L-bfgs for multinomial classification. Unfortunately, its L-bfgs implementation with L2 regularization is not exactly the same as sklearn's, so it fails to produce an equivalent result still.
Sign in to join this conversation.
No labels
pull-request
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
openai/CLIP#60
No description provided.