Skip to Main Content

Dcard Sentiment Fine-tuning (Chinese)

Online Experience

Click here

Results

Untitled

Untitled

截屏2023-05-15 11.53.39.png

截屏2023-05-15 11.54.39.png

Data Description

Dcard is a Taiwanese community forum that organizes posts into topic sections. This project collected posts from Dcard's sentiment section and fine-tuned a model on LLaMA using this data.

Brief Introduction

This project collected text data from Dcard's sentiment section, converted it to plain text, and then fine-tuned the P01son/Linly-Chinese-LLaMA-7b-hf model.

Tutorial

Fine-tune the Model

  1. Install text-generation-webui

    Follow the installation guide for text-generation-webui to install it.

  2. Launch text-generation-webui and select the Model tab from the top options Untitled

  3. In the Model tab, enter P01son/Linly-Chinese-LLaMA-7b-hf, then click Download to download the base model (you can also manually download the model and place it in the models directory of the text-generation-webui installation) Untitled

  4. Download the prepared dcard dataset and place it in the training/datasets directory of the text-generation-webui installation

    Untitled

  5. Switch to the training tab in text-generation-webui

    Untitled

  6. Select the dcard dataset

    Switch to the Raw text file option and select the dcard dataset

    Untitled

  7. Start training

    Use the default parameters for training. If you want to increase the context length, you can increase the cutoff parameter.

    Click Start LoRA Training to begin training.

    You can see the training progress in text-generation-webui.

    Untitled

    Wait for the model to finish training. This usually takes 1-8 hours.

    The output of the training process is saved in the lora directory. You can also interrupt the training process and use the existing checkpoint model in the lora directory.

    Untitled

  8. Use the Model

    Manually create a folder named dcard_m in the lora directory.

    Copy the latest checkpoint model from the folder to the lora directory.

    Untitled

Use the Fine-tuned Model

  1. Switch to the Model tab and select the model first Untitled

  2. Select LoRA. If LoRA does not appear, click the refresh button on the right or check if the LoRA model has been placed in the LoRA directory of text-generation-webui.

    Untitled

  3. Apply LoRA by clicking Apply the selected LoRAs. Untitled

  4. After successful application, a prompt will appear. Untitled

  5. Use the Model

    Switch to the Text generation tab, enter the beginning of the story, and click Generate to automatically generate the rest of the story on the right. Untitled