Instructions to use Terrificfantasm/bert-base-uncased-squad-qa with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Transformers
How to use Terrificfantasm/bert-base-uncased-squad-qa with Transformers:
# Use a pipeline as a high-level helper # Warning: Pipeline type "question-answering" is no longer supported in transformers v5. # You must load the model directly (see below) or downgrade to v4.x with: # pip install "transformers<5.0.0" from transformers import pipeline pipe = pipeline("question-answering", model="Terrificfantasm/bert-base-uncased-squad-qa")# pip install -U transformers accelerate # Load model directly from transformers import AutoTokenizer, AutoModelForQuestionAnswering tokenizer = AutoTokenizer.from_pretrained("Terrificfantasm/bert-base-uncased-squad-qa") model = AutoModelForQuestionAnswering.from_pretrained("Terrificfantasm/bert-base-uncased-squad-qa", device_map="auto") - Notebooks
- Google Colab
- Kaggle
Download utf8_fix.patch from Terrificfantasm/bert-base-uncased-squad-qa: direct link, hf CLI and curl.
- Browser
- Download file 976 Bytes
-
https://huggingface.co/Terrificfantasm/bert-base-uncased-squad-qa/resolve/main/utf8_fix.patch
- Command line
-
hf download hf://Terrificfantasm/bert-base-uncased-squad-qa/utf8_fix.patch
-
curl -L -o utf8_fix.patch https://huggingface.co/Terrificfantasm/bert-base-uncased-squad-qa/resolve/main/utf8_fix.patch
976 Bytes
| --- executed/qa_experiment.py | |
| +++ src/qa_experiment.py | |
| (out/'delivered_model_qa'/'README.md').write_text('---\nlanguage: en\nbase_model: google-bert/bert-base-uncased\ndatasets:\n- rajpurkar/squad\npipeline_tag: question-answering\n---\n# Academic BERT QA\n\n```json\n'+json.dumps(card,indent=2)+'\n```\n',encoding='utf-8') | |
| model=AutoModelForQuestionAnswering.from_pretrained(out/'delivered_model_qa',attn_implementation='sdpa').to(device) | |
| scores,reloaded=evaluate(model,raw['test'],features['test'],cfg,device) | |
| - assert reloaded==json.loads((out/winner/'test_predictions.json').read_text()) | |
| + assert reloaded==json.loads((out/winner/'test_predictions.json').read_text(encoding='utf-8')) | |
| save_json(out/'reload_verification.json',{'all_test_predictions_identical':True,'scores':scores}) | |
| save_json(out/'status.json',{'status':'completed','smoke':cfg.smoke}) | |
| except Exception as exc: | |