Skip to content

Instantly share code, notes, and snippets.

@Tob-iee
Created September 13, 2023 14:09
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save Tob-iee/6ade51ce140f743a14ebc110ffc358d2 to your computer and use it in GitHub Desktop.
Save Tob-iee/6ade51ce140f743a14ebc110ffc358d2 to your computer and use it in GitHub Desktop.
Load DETR's object detection model and specify your hyperparameters for the model's training.
# Training the DETR model
model = AutoModelForObjectDetection.from_pretrained(
checkpoint,
id2label=id2label,
label2id=label2id,
ignore_mismatched_sizes=True,
)
training_args = TrainingArguments(
output_dir="detr-resnet-50_finetuned_cppe5",
# overwrite_output_dir= ,
per_device_train_batch_size=8,
num_train_epochs=40,
fp16=False,
save_steps=200,
logging_steps=10,
learning_rate=1e-5,
weight_decay=1e-4,
save_total_limit=2,
remove_unused_columns=False,
push_to_hub=False,
)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment