-
Notifications
You must be signed in to change notification settings - Fork 1.6k
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
[docs] Task guides #1332
[docs] Task guides #1332
Conversation
The docs for this PR live here. All of your documentation changes will be reflected on that endpoint. The docs are available until 30 days after the last update. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Super good, thanks! I like the idea of condensing the individual guides into a single one to highlight the commonalities and differences, and to refer to existing docs to avoid duplication.
I ran into a couple of minor errors, please check out my comments.
A prompt can describe a task or provide an example of the task you want the model to learn. Instead of manually creating these prompts, soft prompting methods add learnable parameters to the input embeddings that can be optimized for a specific task while keeping the pretrained model's parameters frozen. This makes it both faster and easier to finetune large language models (LLMs) for new downstream tasks. | ||
|
||
The PEFT library supports several types of prompting methods (p-tuning, prefix tuning, prompt tuning, multitask prompt tuning) and you can learn more about how these methods work conceptually in the [Soft prompts](../conceptual_guides/prompting) guide. If you're interested in applying these methods to other tasks, take a look at our collection of [notebooks](https://huggingface.co/spaces/PEFT/soft-prompting)! | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Would it make sense to start a new subsection here? The two paragraphs before are general intros, what comes next is a concrete guide.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think it's ok to not add a new subsection here. Between the intro paragraphs and the concrete guide is the <Tip>
, which belongs to the intro for setting expectations, and just a short setup to install the necessary libraries. Since it's so short, I don't think we need to break it down so granularly and it could be included in the intro as a transition to the code.
"trainable params: 300,288 || all params: 559,514,880 || trainable%: 0.05366935013417338" | ||
``` | ||
|
||
</hfoption> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Running the code with prefix-tuning or prompt-tuning resulted in errors for me. I had to add:
classes = [k.replace("_", " ") for k in ds["train"].features["Label"].names]
ds = ds.map(
lambda x: {"text_label": [classes[label] for label in x["Label"]]},
batched=True,
num_proc=1,
)
before calling processed_ds = ds.map(...)
, which I just copied from the original docs. Probably it could be added to preprocess_function
to avoid mapping twice.
Thanks for your excellent review as usual @BenjaminBossan! 🔥 I'll wait a bit for the other maintainers to chime in if they want, and if we're all on board, then the next steps would be:
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Great. Let's see what the others have to say.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thank you @stevhliu for consolidating the soft-prompt based methods in a single task guide. I really like the hfoptions
based toggle to see the changes required between these methods while trying to solve a given task. 🔥🚀✨
Left a few comments/nits.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thank you @stevhliu! 🚀
* soft prompt guides * small edits * feedback * feedback
This is a proof-of-concept and not ready to merge or review! I'm starting with the prompt-based methods as an example.
I feel like the task guides kind of take the focus away from how to apply a PEFT method and are more of a guide for how to fine-tune a model for a specific task. Most of the guides' content is about preprocessing and getting a dataset/model ready for a specific task and training it. Only a short section of the guide is dedicated to applying the PEFT method. I think we can point users to the Transformers docs for how-to fine for a specific task and/or link to our notebook collection in our PEFT Hub organization (I'll work on getting this updated and ready!). This way, the focus is less on the specific task and more on the specific PEFT method, and users can generalize this to other tasks. Another benefit is it makes it easier to maintain and keep the docs updated since we don't have to add to the docs for every different task versus PEFT method. This would keep the docs cleaner and more focused I think.
Let me know what you think @BenjaminBossan @pacman100 @younesbelkada!