Downloads · 30 days
13
24% of all-time downloads
FlorianSteigleder/NLP4W_30
NLP4W_30 is a question answering model from FlorianSteigleder. Use it when the input is a question plus a passage. It is set up for transformers. The card lists the license as cc-by-sa-4.0.
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.
Downloads · 30 days
13
24% of all-time downloads
All-time downloads
55
Public
Parameters
22.6M
118 MB on disk
Likes
0
Public
Click a slice to open those files.
.safetensors90.3 MB · 76%
From the Hugging Face model README
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.
# 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