Views
No views yet
Please refer to our new GitHub Wiki which documents our efforts in detail in creating the open source version of GitHub Copilot
["\t\t", " ", " ", " "] and since they are all related to indentation, we initialize the embedding layer of these tokens with the same weights as the \t token already present in the model in hopes the model will learn to associate these whitespace characters with indentation faster. A script to automatically do this can be found here.1./run_clm_streaming_flax.py \
2 --output_dir $HOME/gpt-neo-125M-code-clippy \
3 --model_name_or_path="flax-community/gpt-neo-125M-code-clippy" \
4 --dataset_name $HOME/gpt-code-clippy/data_processing/code_clippy.py \
5 --data_dir /home/shared/code_clippy_data \
6 --text_column_name="text" \
7 --do_train --do_eval \
8 --block_size="2048" \
9 --per_device_train_batch_size="8" \
10 --per_device_eval_batch_size="16" \
11 --preprocessing_num_workers="8" \
12 --learning_rate="1e-4" \
13 --max_steps 100000 \
14 --warmup_steps 2500 \
15 --decay_steps 25000 \
16 --adam_beta1="0.9" \
17 --adam_beta2="0.95" \
18 --weight_decay="0.1" \
19 --overwrite_output_dir \
20 --logging_steps="100" \
21 --eval_steps="500" \
22 --push_to_hub="False" \
23 --report_to="all" \
24 --dtype="bfloat16" \
25 --skip_memory_metrics="True" \
26 --save_steps="500" \
27 --save_total_limit 10 \
28 --gradient_accumulation_steps 16 \
29 --report_to="wandb" \
30 --run_name="125m_1e-4lr_1024bs" \
31 --max_eval_samples 2000 \
32 --save_optimizer true1
2from transformers import AutoModelForCausalLM, AutoTokenizer, FlaxAutoModelForCausalLM
3
4model = AutoModelForCausalLM.from_pretrained("flax-community/gpt-neo-125M-code-clippy")
5
6tokenizer = AutoTokenizer.from_pretrained("flax-community/gpt-neo-125M-code-clippy")
7
8prompt = """def greet(name):
9 '''A function to greet user. Given a user name it should say hello'''
10"""
11
12input_ids = tokenizer(prompt, return_tensors='pt').input_ids.to(device)
13
14start = input_ids.size(1)
15
16out = model.generate(input_ids, do_sample=True, max_length=50, num_beams=2,
17
18 early_stopping=True, eos_token_id=tokenizer.eos_token_id, )
19
20print(tokenizer.decode(out[0][start:]))
21