update README and fix token_cls example

This commit is contained in:
Sourab Mangrulkar
2023-02-08 18:54:46 +05:30
parent 73cd16b7b5
commit 8083c9515f
2 changed files with 11 additions and 15 deletions
+8 -2
View File
@@ -127,6 +127,12 @@ Try out the 🤗 Gradio Space which should run seamlessly on a T4 instance:
### Parameter Efficient Tuning of LLMs for RLHF components such as Ranker and Policy [ToDo]
### INT8 training of large models in Colab using PEFT LoRA and bits_and_bytes
Here is now a demo on how to fine tune OPT-6.7b (14GB in fp16) in a Google colab: [![Open In Colab](https://colab.research.google.com/assets/colab-badge.svg)](https://colab.research.google.com/drive/1jCkpikz0J2o20FBQmYmAGdiKmJGOMo-o?usp=sharing)
Here is now a demo on how to fine tune wishper-large (1.5B params) (14GB in fp16) in a Google colab: [ToDo]
### Save compute and storage even for medium and small models
Save storage by avoiding full finetuning of models on each of the downstream tasks/datasets,
@@ -307,12 +313,12 @@ any GPU memory savings. Please refer issue [[FSDP] FSDP with CPU offload consume
2. When using `P_TUNING` or `PROMPT_TUNING` with `SEQ_2_SEQ` task, remember to remove the `num_virtual_token` virtual prompt predictions from the left side of the model outputs during evaluations.
3. `P_TUNING` or `PROMPT_TUNING` doesn't support `generate` functionality of transformers bcause `generate` strictly requires `input_ids`/`decoder_input_ids` but
3. For encoder-decoder models, `P_TUNING` or `PROMPT_TUNING` doesn't support `generate` functionality of transformers because `generate` strictly requires `decoder_input_ids` but
`P_TUNING`/`PROMPT_TUNING` appends soft prompt embeddings to `input_embeds` to create
new `input_embeds` to be given to the model. Therefore, `generate` doesn't support this yet.
## Backlog:
1. Explore and possibly integrate `(IA)^3` and `UniPELT`
1. Explore and possibly integrate `(IA)^3`
2. Add tests
3. Add more use cases and examples
@@ -827,7 +827,7 @@
}
],
"source": [
"from peft import get_peft_config, LoraModel, get_peft_model, LoraConfig, TaskType\n",
"from peft import get_peft_config, PeftModel, get_peft_model, LoraConfig, TaskType\n",
"peft_config = LoraConfig(\n",
" task_type=TaskType.TOKEN_CLS,\n",
" inference_mode=False,\n",
@@ -1070,17 +1070,7 @@
"metadata": {},
"outputs": [],
"source": [
"from peft import get_peft_model_state_dict\n",
"to_return = get_peft_model_state_dict(model)\n"
]
},
{
"cell_type": "code",
"execution_count": 20,
"metadata": {},
"outputs": [],
"source": [
"torch.save(to_return, \"layoutlm_funsd.pt\")"
"model.save_pretrained(\"peft_layoutlm\")\n"
]
},
{
@@ -1097,7 +1087,7 @@
}
],
"source": [
"!du -h \"layoutlm_funsd.pt\""
"!du -h \"peft_layoutlm/adapter_model.bin\""
]
},
{