Regression with multiple targets

Hi everyone,

I’m developing a model to predict a numerical (continuous-valued) vector depending on textual inputs. I wanted to check if there was a way to do this in HF before potentially spending more time than necessary going directly into Flax or TF. I know the boiler plate code is heavily in favour of classification tasks and I know the convention for multiple regression would be to set config.num_labels = 1 and override the forward method to use MSELoss. My problem arises when I want to consider multivariate regression over multiple regression (i.e. predicted outputs / labels are in vector form and no longer a single value).

Looking at some of the errors that are being thrown up when I try this, it seems HF is not set up to accept labels that are not single-values. Am I barking up the wrong tree trying to get this to work in HF or should I just head towards more low-level code and code this myself? I thought HF might help save some time, but perhaps that’s not the case.

The trouble I keep running into is connected with the parameter only_1d_for_numpy being set to True in the cast_to_python_objects function (called on line 213 of I can’t see: (a) how I might change that from “easy HF boilerplate code” or (b): that disabling this option would truly solve my problem.

Is there some amazing trick hiding in the weeds that would render this quite simple, which is secretly what I’m hoping for as this will save a lot of potential debugging in the future?