Hey everyone,
I’d like to know what you think about these two plans.
What are the good and bad points?
If the most important thing is speed, which one is better? Which is it? Is the only difference between them how they organize and abstract code?
Do you know of any code repositories that use both of them? It looks like something I could use as a “template” to change from one system to another.
Thanks a lot!
10 Likes
Lightning AI is Python’s abstraction system. You can write Python code in a few lines, and it has extra features. You can quickly build your own design and start writing code from scratch.
The kissing face transformer training is used a lot to fine-tune freely accessible models. Based on PyTorch, but only for transformers design. This is where you can only work with transformer models.
9 Likes
You could kind of do that. Instead of using the nn module, you could subclass huggingfaces PretrainedModel and have your own custom loss class for forward returns. You could also plug any custom model into the trainer. I sell lightning myself, so I know it’s not worth it.
8 Likes
Thanks for your answer! How do they rate in terms of how well they do? Usually, can speed be exactly the same when switching from one platform to another?
7 Likes
Lightning is used to train LLMs ~40B because it can be expanded and works well with multiple nodes. It’s also easier to try out new technologies than the HF trainer.
5 Likes
I’ve used both, and it really depends on what you need. Transformers Trainer is great for NLP because it’s super integrated with Hugging Face models and does a lot of the training, evaluating, and distributed training for you. It’s useful if you’re really into NLP, but it can feel a bit rigid outside of that. PyTorch Lightning, on the other hand, is more flexible and abstracts PyTorch boilerplate without locking you into a specific domain. It’s better if you want more control and are working on something other than just transformers. Both are good at what they do, but Lightning might give you more room for customization and optimization. I haven’t seen a code repository that uses both, but I think it’s pretty easy to switch from Trainer to Lightning since Lightning is more general-purpose. You could probably adapt an existing HF Trainer script to Lightning without too much trouble.
3 Likes
I don’t think lightning is very adaptable, and I don’t think huggingface is great for classification.
3 Likes
There is a big problem with your claim that lightning isn’t adjustable. You can do as much or as little of the script as you want.
It “got in my way” only when I used LightningCLI, which was jsonargparse’s fault because lightning wasn’t to blame.
3 Likes
Just wondering why you think Huggingface isn’t a good way to group things together.
3 Likes
It’s good, but it’s a pain to classify. I should only have to choose a text column and a name column.
You have to put together the collator and tokenization yourself, though.
2 Likes