--- datasets: - squad_v2 license: cc-by-sa-4.0 language: - en metrics: - f1 library_name: transformers --- # Finetuned model for NLP4W Group 30 This QA model was finetuned using our GPU on the squad V2 dataset. Feel free to use the "Inference API" on the right to play around with the model. ## Model Details - Trained using [transformers](https://huggingface.co/docs/transformers) for [python](https://www.python.org/) - Used the [microsoft/xtremedistil-l6-h384-uncased](https://huggingface.co/microsoft/xtremedistil-l6-h384-uncased) model as a base. - Used the [squad_v2](https://huggingface.co/datasets/squad_v2) dataset for training ### Model Description - **Funded by:** Florian Steigleder, Nils Waldraff - **Developed by:** Florian Steigleder, Nils Waldraff - **Shared by:** Florian Steigleder, Nils Waldraff ### Plug'n Play (Python): ```python # prerequisites !pip install transformers from transformers import pipeline # Pipeline is needed to import the model # Loading model & setup model_name_30 = 'FlorianSteigleder/NLP4W_30' model_30 = AutoModelForQuestionAnswering.from_pretrained(model_name_30) # First we load the model from our repo tokenizer_30 = AutoTokenizer.from_pretrained(model_name_30) # Then we load the tokenizer from our repo pipeline_30 = pipeline('question-answering', model=model_30, tokenizer=tokenizer_30) # Then we create an inference pipeline with the model and the tokenizer # Inference Example 1 print(pipeline_30( "Where do I live?", # Question "My name is Caimbeul and I live in Scotland" # Context )) # Full Inference result containing score, start, end and answer -> https://huggingface.co/docs/transformers/en/main_classes/pipelinesa # {'score': 0.9879983067512512, 'start': 34, 'end': 42, 'answer': 'Scotland'} # Inference Example 2 print(pipeline_30( "Which name is also used to describe the Amazon rainforest in English?", # Question """The Amazon rainforest (Portuguese: Floresta Amazônica or Amazônia; Spanish: Selva Amazónica, Amazonía or usually Amazonia; French: Forêt amazonienne; Dutch: Amazoneregenwoud), also known in English as Amazonia or the Amazon Jungle, is a moist broadleaf forest that covers most of the Amazon basin of South America. This basin encompasses 7,000,000 square kilometres (2,700,000 sq mi), of which 5,500,000 square kilometres (2,100,000 sq mi) are covered by the rainforest. This region includes territory belonging to nine nations. The majority of the forest is contained within Brazil, with 60% of the rainforest, followed by Peru with 13%, Colombia with 10%, and with minor amounts in Venezuela, Ecuador, Bolivia, Guyana, Suriname and French Guiana. States or departments in four nations contain "Amazonas" in their names. The Amazon represents over half of the planet's remaining rainforests, and comprises the largest and most biodiverse tract of tropical rainforest in the world, with an estimated 390 billion individual trees divided into 16,000 species.""" # Context )["answer"]) # Answer only output # Amazonia or the Amazon Jungle # Inference Example 3 print(pipeline_30( "Where is New York City?", # Question "New York City is in the United States." # Context )["answer"]) # Germany ```