Difference between model.train and trainer.train

Hello I am new to hugging face. I am trying to train model one data text at a time, I am wondering whether this would be an efficient way of doing it:

   model.train(mode=True)
   outputs = model(input_ids, labels=labels)
   loss = outputs[0]
   loss.backward()
   optimizer.step()
   optimizer.zero_grad()

or I should do:

args = TrainingArguments(
        output_dir="output",
        num_train_epochs=epochs,
        per_device_train_batch_size=batch,
        weight_decay=0.01,
        optim = "adamw_torch"

    )


    trainer = Trainer(
        model=model,
        args=args,
        # data_collator=data_collator,
        train_dataset=train_dataset,
        #eval_dataset=val_dataset,
        compute_metrics=compute_metrics
    )
    trainer.train()

Which would be the most efficient way of going about it and that would lead to the most accurate results. Again, im new to ai in general so bear with me if this is a bad question. Any help would be extremely appreciated thanks