Skip to content

Add a transformers example - #322

Merged
nzw0301 merged 19 commits into
optuna:mainfrom
ParagEkbote:transformers-example-for-optuna
May 16, 2025
Merged

nzw0301 merged 19 commits into
optuna:mainfrom
ParagEkbote:transformers-example-for-optuna

Conversation

@ParagEkbote

@ParagEkbote ParagEkbote commented Apr 26, 2025 •

Copy link
Copy Markdown
Contributor

Description of the changes

Refs the following issue.

This PR adds an example showing the integration of transformers with optuna. We use the imdb dataset and prajjwal1/bert-tiny as the model. The Best trial is:
BestRun(run_id='1', objective=0.622, hyperparameters={'learning_rate': 3.341916221533824e-05, 'per_device_train_batch_size': 16}, run_summary=None)

Could you please review?

cc: @c-bata

@ParagEkbote

ParagEkbote commented Apr 26, 2025 •

Copy link
Copy Markdown
Contributor Author

It is important to note that since we are using a big model (~67M params) and CPU based systems, the CI checks will take a long time. The example can be executed on a T4 GPU with a duration of (~10 mins).

@nabenabe0928

Copy link
Copy Markdown
Contributor

@kAIto47802 Could you review this PR?

@nabenabe0928

Copy link
Copy Markdown
Contributor

@ParagEkbote

Could you reduce the computational time by using a much smaller model?

#322 (comment)

@ParagEkbote

Copy link
Copy Markdown
Contributor Author

I have updated the example to run on a much smaller model. Now the CI is being completed in a reasonable amount of time :)

cc: @nabenabe0928

@github-actions

github-actions Bot commented May 5, 2025

Copy link
Copy Markdown

This pull request has not seen any recent activity.

@github-actions github-actions Bot added the stale Exempt from stale bot labeling. label May 5, 2025
@ParagEkbote

Copy link
Copy Markdown
Contributor Author

Not stale.

@ParagEkbote

Copy link
Copy Markdown
Contributor Author

Could you please review the changes?

cc: @kAIto47802

@github-actions github-actions Bot removed the stale Exempt from stale bot labeling. label May 6, 2025
@github-actions

Copy link
Copy Markdown

This pull request has not seen any recent activity.

@github-actions github-actions Bot added the stale Exempt from stale bot labeling. label May 13, 2025
@ParagEkbote

Copy link
Copy Markdown
Contributor Author

Not stale.

@ParagEkbote

Copy link
Copy Markdown
Contributor Author

Could you please review?

cc: @kAIto47802

@nzw0301 nzw0301 left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm using transformers nowadays, so let me leave a few suggestions.

Comment thread .github/workflows/transformers.yml Resolved
@github-actions github-actions Bot removed the stale Exempt from stale bot labeling. label May 14, 2025
@c-bata c-bata assigned nzw0301 and unassigned kAIto47802 May 15, 2025
@c-bata

c-bata commented May 15, 2025

Copy link
Copy Markdown
Member

Let me change the reviewer since @nzw0301 started the review for this PR.

@ParagEkbote
ParagEkbote requested a review from nzw0301 May 15, 2025 06:46

@nzw0301 nzw0301 left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you for quickly updating the PR. I would appreciate it if you followed my suggestions carefully, so as not to repeat a similar suggestion or the same suggestion.

Comment thread transformers/transformers_simple.py Resolved
Comment thread transformers/transformers_simple.py Resolved
Comment thread transformers/transformers_simple.py Resolved
Comment thread transformers/transformers_simple.py Resolved
Comment thread transformers/transformers_simple.py Resolved
@ParagEkbote
ParagEkbote requested a review from nzw0301 May 15, 2025 12:39

@nzw0301 nzw0301 left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks. let me leave a few more comments.

Comment thread transformers/transformers_simple.py Resolved
Comment thread transformers/transformers_simple.py Resolved
Comment thread transformers/transformers_simple.py Resolved
Comment thread transformers/transformers_simple.py Resolved
Comment thread transformers/transformers_simple.py Resolved
@nzw0301

nzw0301 commented May 15, 2025 •

Copy link
Copy Markdown
Member

Please kindly stop commenting just Updated as discussed.. I've got too many notifications with uninformative content.

Best regards,

@ParagEkbote
ParagEkbote requested a review from nzw0301 May 15, 2025 14:55
Comment thread transformers/transformers_simple.py Resolved
Comment thread transformers/transformers_simple.py Resolved
@ParagEkbote
ParagEkbote requested a review from nzw0301 May 15, 2025 16:12
@nzw0301 nzw0301 changed the title Add transformers Example for Optuna Add a transformers example May 16, 2025

@nzw0301 nzw0301 left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM. Thanks

@nzw0301
nzw0301 merged commit d55f622 into optuna:main May 16, 2025
@nzw0301 nzw0301 added this to the v4.4.0 milestone May 16, 2025
@ParagEkbote
ParagEkbote deleted the transformers-example-for-optuna branch May 16, 2025 04:37
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants