File size: 1,555 Bytes
4c28b8d
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
#!/bin/bash

export LC_ALL=C.UTF-8
export LANG=C.UTF-8

export OUTPUT_DIR=/to/our/path
export MODEL_NAME_OR_PATH=t5-base
export NUM_BEAMS=3

export TRAIN_FILE=/to/../train.csv
export VALIDATION_FILE=/to/../dev.csv
export TEST_FILE=/to/../test.csv
export TEXT_COLUMN=inputs
export TARGET_COLUMN=targets
export MAX_SOURCE_LENGTH=128
export MAX_TARGET_LENGTH=1024
export SOURCE_PREFIX=ingredients

export PER_DEVICE_TRAIN_BATCH_SIZE=8
export PER_DEVICE_EVAL_BATCH_SIZE=8
export GRADIENT_ACCUMULATION_STEPS=2
export NUM_TRAIN_EPOCHS=3.0
export LEARNING_RATE=5e-4
export WARMUP_STEPS=5000

python run_ed_recipe_nlg.py \
    --output_dir="$OUTPUT_DIR"  \
    --train_file="$TRAIN_FILE" \
    --validation_file="$VALIDATION_FILE" \
    --test_file="$TEST_FILE" \
    --text_column="$TEXT_COLUMN" \
    --target_column="$TARGET_COLUMN" \
    --source_prefix="$SOURCE_PREFIX: " \
    --max_source_length="$MAX_SOURCE_LENGTH" \
    --max_target_length="$MAX_TARGET_LENGTH" \
    --model_name_or_path="$MODEL_NAME_OR_PATH"  \
    --extra_tokens="" \
    --special_tokens="<sep>,<items>" \
    --per_device_train_batch_size=$PER_DEVICE_TRAIN_BATCH_SIZE \
    --per_device_eval_batch_size=$PER_DEVICE_EVAL_BATCH_SIZE \
    --gradient_accumulation_steps=$GRADIENT_ACCUMULATION_STEPS \
    --num_train_epochs=$NUM_TRAIN_EPOCHS \
    --learning_rate=$LEARNING_RATE \
    --warmup_steps=$WARMUP_STEPS \
    --preprocessing_num_workers=4 \
    --prediction_debug \
    --do_train \
    --do_eval \
    --do_predict \
    --overwrite_output_dir \
    --predict_with_generate