nlpxucan / WizardLM

LLMs build upon Evol Insturct: WizardLM, WizardCoder, WizardMath
9.27k stars 716 forks source link

Instruction fine-tuning based on the `WizardLM/WizardCoder-15B-V1.0` model, but the result only outputs `<|endoftext|>` #95

Open chen-lee-li opened 1 year ago

chen-lee-li commented 1 year ago

Based on the "WizardLM/WizardCoder-15B-V1.0" model, I used 78533 pieces of data to fine-tune the instructions. The dataset format is as follows:

image

For example: instruction input output
Writing unit test code for a method @Override public boolean put(Interval interval, T value) { if (value == null) { throw new NullPointerException(); } Object values = getValuesArray(); int valuesLength = Array.getLength(values); final int index = putInner(interval.getLow(), interval.getHigh()); if (index < 0) { int insertIndex = -index - 1; if (size - 1 < valuesLength) { if (insertIndex < size - 1) { System.arraycopy(values, insertIndex, values, insertIndex + 1, size - insertIndex - 1); } Array.set(values, insertIndex, value); } else { Object newArray = Array.newInstance(values.getClass().getComponentType(), valuesLength + 1); System.arraycopy(values, 0, newArray, 0, insertIndex); System.arraycopy(values, insertIndex, newArray, insertIndex + 1, valuesLength - insertIndex); Array.set(newArray, insertIndex, value); setValuesArray(newArray); } return true; } else { Array.set(values, index, value); } return false; } @Test public void testPutOne() { for (IntervalMap set : getAllInstances()) { Object[] defaultValues = getTestValues(set); Assert.assertTrue(set.put(new Interval(1.0, 2.0), defaultValues[0])); testValues(set, new Interval[] { new Interval(1.0, 2.0) }, new Object[] { defaultValues[0] }); } }

The instruction fine-tuning script is as follows:

deepspeed train_wizardcoder.py \
    --model_name_or_path "/data/models/WizardLM/WizardCoder-15B-V1.0" \
    --data_path "/data/datasets/java_wizard" \
    --output_dir "/data/models/wizard_java_from_starchat" \
    --num_train_epochs 3 \
    --model_max_length 2048 \
    --per_device_train_batch_size 4\
    --per_device_eval_batch_size 1 \
    --gradient_accumulation_steps 2 \
    --evaluation_strategy "no" \
    --save_strategy "steps" \
    --save_steps 50 \
    --save_total_limit 2 \
    --learning_rate 2e-5 \
    --warmup_steps 30 \
    --logging_steps 2 \
    --lr_scheduler_type "cosine" \
    --gradient_checkpointing True \
    --deepspeed configs/deepspeed_config.json \
    --fp16 True 2>&1 | tee /data/logs/deep.log

But when I use the fine-tuning to end the generated model for model prediction, enter the following command:

Below is an instruction that describes a task, paired with an inputthat provides further contextWrite a response that appropriately completes the request.

### Instruction:
Writing unit test code for a method

### Input:
@Override 
public boolean put(Interval interval, T value) {
    if (value == null) {
        throw new NullPointerException();
    }
    Object values = getValuesArray();
    int valuesLength = Array.getLength(values);
    final int index = putInner(interval.getLow(), interval.getHigh());
    if (index < 0) {
        int insertIndex = -index - 1;
        if (size - 1 < valuesLength) {
            if (insertIndex < size - 1) {
                System.arraycopy(values, insertIndex, values, insertIndex + 1, size - insertIndex - 1);
            }
            Array.set(values, insertIndex, value);
        } else {
            Object newArray = Array.newInstance(values.getClass().getComponentType(), valuesLength + 1);
            System.arraycopy(values, 0, newArray, 0, insertIndex);
            System.arraycopy(values, insertIndex, newArray, insertIndex + 1, valuesLength - insertIndex);
            Array.set(newArray, insertIndex, value);
            setValuesArray(newArray);
        }
        return true;
    } else {
        Array.set(values, index, value);
    }
    return false;
}
### Response:

but what is returned is:

Below is an instruction that describes a task, paired with an inputthat provides further contextWrite a response that appropriately completes the request.

### Instruction:
Writing unit test code for a method

### Input:
@Override 
public boolean put(Interval interval, T value) {
    if (value == null) {
        throw new NullPointerException();
    }
    Object values = getValuesArray();
    int valuesLength = Array.getLength(values);
    final int index = putInner(interval.getLow(), interval.getHigh());
    if (index < 0) {
        int insertIndex = -index - 1;
        if (size - 1 < valuesLength) {
            if (insertIndex < size - 1) {
                System.arraycopy(values, insertIndex, values, insertIndex + 1, size - insertIndex - 1);
            }
            Array.set(values, insertIndex, value);
        } else {
            Object newArray = Array.newInstance(values.getClass().getComponentType(), valuesLength + 1);
            System.arraycopy(values, 0, newArray, 0, insertIndex);
            System.arraycopy(values, insertIndex, newArray, insertIndex + 1, valuesLength - insertIndex);
            Array.set(newArray, insertIndex, value);
            setValuesArray(newArray);
        }
        return true;
    } else {
        Array.set(values, index, value);
    }
    return false;
}
### Response:<|endoftext|>

Compared with the input command, his result is only <|endoftext|> more.

What is the problem? I wonder if there is a better way to solve this problem? Or is there a better way to do instruction fine-tuning for WizardLM/WizardCoder-15B-V1.0?

ChiYeungLaw commented 1 year ago

I think you can check this issue #92