[{'role': 'system', 'content': "You are an expert in machine learning and your task is to classify code snippets into one of the following categories: ['helper_functions', 'load_data', 'data_exploration', 'data_preprocessing', 'evaluation', 'modelling', 'prediction', 'result_visualization', 'save_results', 'comment_only']."}, {'role': 'user', 'content': 'Identify the single most appropriate category to which the provided code belongs. Provide your response as a single category label without any additional information, commentary, or personal opinions.\\nPython Code:def train_epoch(model, optimizer, train_dl, report_every=10):\n  model.train()\n  step = 0\n  total_loss = 0\n  \n  for texts, offsets, labels in train_dl:\n    texts, offsets, labels = texts.to(device), offsets.to(device), labels.to(device)\n    step += 1\n    optimizer.zero_grad()\n    _, loss = model(texts, offsets, labels)\n    total_loss += loss.item()\n    \n    loss.backward()\n    optimizer.step()\n    \n    if step % report_every == 0:\n      print(f"Step {step}, loss: {total_loss/report_every}")\n      total_loss = 0\n      \ndef evaluate(model, optimizer, valid_dl, probas=False):\n  probas = list()\n  model.eval()\n  predictions = list()\n  total_loss = 0\n  all_labels = list()\n  with torch.no_grad():\n    for texts, offsets, labels in valid_dl:\n      texts, offsets, labels = texts.cuda(), offsets.cuda(), labels.cuda()\n      preds, loss = model(texts, offsets, labels)\n      total_loss += loss.item()\n      probas.append(preds.cpu().detach().numpy())\n      predictions.extend([i.item() for i in preds.max(1)[1]])\n    \n    \n  print(f"Validation loss: {total_loss/len(valid_dl)}")\n  print()\n  print(classification_report(valid_dl.dataset.tensors[2].numpy(), predictions))\n  if probas:\n    return total_loss, np.vstack(probas)\n  return total_loss, predictions'}, {'role': 'assistant', 'content': 'modelling'}]