allegro/allRank

Only ordinal loss works

sa- opened this issue · 1 comments

sa- commented

When I try to use a different loss function like rankNet, I get this error

ValueError: Target size (torch.Size([2703])) must be the same as input size (torch.Size([2703, 4]))

This is the config that I'm using

{
  "model": {
    "fc_model": {
      "sizes": [
        64
      ],
      "input_norm": false,
      "activation": null,
      "dropout": 0.0
    },
    "transformer": {
      "N": 1,
      "d_ff": 64,
      "h": 1,
      "positional_encoding": null,
      "dropout": 0.0
    },
    "post_model": {
      "output_activation": "Sigmoid",
      "d_output": 4
    }
  },
  "data": {
    "path": "/home/username/data",
    "validation_ds_role": "vali",
    "num_workers": 1,
    "batch_size": 64,
    "slate_length": 240
  },
  "optimizer": {
    "name": "Adam",
    "args": {
      "lr": 0.004
    }
  },
  "lr_scheduler": {
    "name": "StepLR",
    "args": {
      "step_size": 3,
      "gamma": 0.5
    }
  },
  "training": {
    "epochs": 50,
    "early_stopping_patience": 100,
    "gradient_clipping_norm": null
  },
  "val_metric": "ndcg_50",
  "metrics": [
    "ndcg_50"
  ],
  "loss": {
    "name": "rankNet",
    "args": {}
  },
  "expected_metrics" : {
    "val": {
      "ndcg_50": 0.785
    }
  }
}

Have you tried specifying a "d_output": 1 for other models? I think they expect a single output from the model