Instructions to use harness-race/opencode-r3 with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Transformers
How to use harness-race/opencode-r3 with Transformers:
# Use a pipeline as a high-level helper from transformers import pipeline pipe = pipeline("object-detection", model="harness-race/opencode-r3")# pip install -U transformers accelerate # Load model directly from transformers import AutoImageProcessor, AutoModelForObjectDetection processor = AutoImageProcessor.from_pretrained("harness-race/opencode-r3") model = AutoModelForObjectDetection.from_pretrained("harness-race/opencode-r3", device_map="auto") - Notebooks
- Google Colab
- Kaggle
Upload train_detr.py with huggingface_hub
Browse files- train_detr.py +2 -3
train_detr.py
CHANGED
|
@@ -141,9 +141,8 @@ model = DetrForObjectDetection.from_pretrained(ARGS.base_model, num_labels=N,
|
|
| 141 |
model.to(device)
|
| 142 |
|
| 143 |
# distinct backbone (frozen-ish) vs head lr
|
| 144 |
-
|
| 145 |
-
head_params = [p for n,p in model.named_parameters() if not n.startswith("backbone") or "layers" not in n]
|
| 146 |
-
bb_params = [p for n,p in model.backbone.named_parameters() if "layers" in n]
|
| 147 |
optim = torch.optim.AdamW([
|
| 148 |
{"params": bb_params, "lr": ARGS.lr/10},
|
| 149 |
{"params": head_params, "lr": ARGS.lr},
|
|
|
|
| 141 |
model.to(device)
|
| 142 |
|
| 143 |
# distinct backbone (frozen-ish) vs head lr
|
| 144 |
+
bb_params = [p for n,p in model.model.backbone.named_parameters() if "layers" in n]
|
| 145 |
+
head_params = [p for n,p in model.named_parameters() if not n.startswith("model.backbone") or "layers" not in n]
|
|
|
|
| 146 |
optim = torch.optim.AdamW([
|
| 147 |
{"params": bb_params, "lr": ARGS.lr/10},
|
| 148 |
{"params": head_params, "lr": ARGS.lr},
|