hub-docs icon indicating copy to clipboard operation
hub-docs copied to clipboard

Ability to modify "Use this model with transformers"

Open aCampello opened this issue 3 years ago • 3 comments

Is your feature request related to a problem? Please describe.

On the hub website, when you click "Use this model with transformers" it generates a sample code based on the classname of the model (see picture below)

Screenshot 2022-03-31 at 14 48 37

Describe the solution you'd like It would be good to be able to modify this based on the model card, or some file that you upload to the platform

Describe alternatives you've considered We have a description that works as part of model cards

Additional context Add any other context or screenshots about the feature request here.

aCampello avatar Mar 31 '22 14:03 aCampello

Hey there! This is actually retrieved from the config.json file in the repository (which in your case specifies BertMesh).

What would you like this to look like?

osanseviero avatar Mar 31 '22 14:03 osanseviero

Ohh, I didn't know that. Thanks for the (very quick!) answer. I think in our case it only works if it's AutoModel, otherwise the class doesn't exist

aCampello avatar Mar 31 '22 14:03 aCampello

I see! The solution might be a bit hacky, but you can change the architectures to AutoModel and it should give you what you want, although trust_remote_code=True would still be missing.

@julien-c WDYT of a mechanism to override the inference snippet?

osanseviero avatar Mar 31 '22 20:03 osanseviero