Only output tensor from huggingface model
I am trying to use a huggingface model with a pre-existing training framework. The issue is that instead of the model returning a pytorch tensor, its returning a ClassifierOutput object.Is there a way to have the model return a pytorch tensor using configs or at the initialization? I could only find a way to return a tuple, but I only want the output tensor.
2022-09-14T11:36:11Z
You can define a new class that extends from the Hugging Face model, overrideforwardto first callforwardfrom  the base class and then only return the thing you care about.
2022-09-14T11:39:56Z
Thanks for the answer. I came up with the same solution and it works! Its not as pretty as just doingmodel = SomeModel(output_only_tensor=True), but it gets the job done.I thought this might be a more common issue and that there would be an easier way to do this, but I guess not