allenai / allennlp

An open-source NLP research library, built on PyTorch.
http://www.allennlp.org
Apache License 2.0
11.74k stars 2.24k forks source link

Perhaps an example could be provided for each API, which might be more friendly for first-time users. #5678

Closed Stycoo closed 2 years ago

Stycoo commented 2 years ago

Is your feature request related to a problem? Please describe. A clear and concise description of what the problem is. Ex. I'm always frustrated when [...]

Describe the solution you'd like A clear and concise description of what you want to happen.

Describe alternatives you've considered A clear and concise description of any alternative solutions or features you've considered.

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

epwalsh commented 2 years ago

Hi, can you please elaborate? Which API are you talking about?

Stycoo commented 2 years ago

I am so curious how to use “allennlp.data.fields.transformer_text_field” when i want to use allennlp in combination with huggingface transformers.

epwalsh commented 2 years ago

Check out the RoBERTa SNLI model for an example. The config for this model can be found here: https://github.com/allenai/allennlp-models/blob/main/training_config/pair_classification/snli_roberta.jsonnet

This model just uses the BasicClassifier. The important parts of the config are "model.text_field_embedders" which is set to use the pretrained transformer embedder, and "dataset_reader.tokenizer" + "dataset_reader.token_indexers" which are set to use the pretrained transformer tokenizer and pretrained transformer token indexer, respectively.

github-actions[bot] commented 2 years ago

This issue is being closed due to lack of activity. If you think it still needs to be addressed, please comment on this thread 👇