File size: 1,939 Bytes
9dca527
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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
52
53
54
55
56
57
58
59
60
61
export CORES=`grep -c ^processor /proc/cpuinfo`
export XLA_PYTHON_CLIENT_PREALLOCATE=false

export HF_PROJECT="long-t5-local-base-dutch-english"
export DATASET="yhavinga/mc4_nl_cleaned"
export DATASET_CONFIG="tiny_en_nl" # Config of the dataset in the Huggingface Hub
export DATASET_SPLIT="train" # Split to use for training tokenizer and model
export CONFIG_NAME="google/long-t5-local-base"
export TOKENIZER_NAME="yhavinga/t5-small-24L-ccmatrix-multi"
export MODEL_PATH="${HOME}/data/${HF_PROJECT}" # Path to the model

mkdir -p "${MODEL_PATH}"

# from paper:
# batch size 128
# input length 4096 output length 910 output - pegasus style
# for span corruption set to seq length 1024

python ../train/run_t5_mlm_flax_pmap.py \
    --output_dir="${MODEL_PATH}" \
    --resume_from_checkpoint="${MODEL_PATH}" \
    --model_type="longt5" \
    --config_name="${CONFIG_NAME}" \
    --tokenizer_name="${TOKENIZER_NAME}" \
    --preprocessing_num_workers="${CORES}" \
    --do_train --do_eval \
    --dataset_name="${DATASET}" \
    --dataset_config_name="${DATASET_CONFIG}" \
    --max_seq_length="1024" \
    --per_device_train_batch_size="8" \
    --per_device_eval_batch_size="8" \
    --gradient_accumulation_steps="16" \
    --mean_noise_span_length="3" \
    --dtype="float32" \
    --optim="adafactor" \
    --learning_rate="0.005" \
    --lr_decay="linear" \
    --overwrite_output_dir \
    --num_train_epochs="8" \
    --logging_steps="20" \
    --save_steps="1000" \
    --eval_steps="2000" \
    --warmup_steps="300" \
    --validation_split_count="15000" \
    --wandb_project="long-t5-local-base" \
    --wandb_job_type="pmap"


#    --max_train_samples="160000" \
#    --max_eval_samples="1000"

#    --model_name_or_path="${MODEL_PATH}" \

#     \

#    --lr_decay="exponential" \
#    --lr_transition_steps="400000" \
#    --lr_decay_rate="0.7" \
#    --lr_staircase="false" \
#    --auth_token="$(cat ~/.huggingface/token)" \