RAG / BAAI_bge-large-en-v1.5 /fixed_chunks /_accelerate.txt_chunk_3.txt
thenativefox
Added split files and tables
939262b
raw
history blame contribute delete
925 Bytes
outputs = model(**batch)
loss = outputs.loss
+ accelerator.backward(loss)
optimizer.step()
lr_scheduler.step()
optimizer.zero_grad()
progress_bar.update(1)
Train
Once you've added the relevant lines of code, launch your training in a script or a notebook like Colaboratory.
Train with a script
If you are running your training from a script, run the following command to create and save a configuration file:
accelerate config
Then launch your training with:
accelerate launch train.py
Train with a notebook
πŸ€— Accelerate can also run in a notebook if you're planning on using Colaboratory's TPUs. Wrap all the code responsible for training in a function, and pass it to [~accelerate.notebook_launcher]:
from accelerate import notebook_launcher
notebook_launcher(training_function)
For more information about πŸ€— Accelerate and its rich features, refer to the documentation.