Cannot allocate memory in static TLS block

I am trying to test examples in the website. - https://huggingface.co/distilbert-base-uncased-distilled-squad

Fist I tried following code:

from transformers import pipeline
question_answerer = pipeline("question-answering", model='distilbert-base-uncased-distilled-squad')

context = r"""
Extractive Question Answering is the task of extracting an answer from a text given a question. An example     of a
question answering dataset is the SQuAD dataset, which is entirely based on that task. If you would like to fine-tune
a model on a SQuAD task, you may leverage the examples/pytorch/question-answering/run_squad.py script.
"""

result = question_answerer(question="What is a good example of a question answering dataset?",     context=context)
print(f"Answer: '{result['answer']}', score: {round(result['score'], 4)}, start: {result['start']}, end: {result['end']}")

It shows the following error,

print(f"Answer: ‘{result[‘answer’]}’, score: {round(result[‘score’], 4)}, start: {result[‘start’]}, end: {result[‘end’]}")
TypeError: list indices must be integers or slices, not str

When I try following code,

from transformers import DistilBertTokenizer, DistilBertModel
import torch
tokenizer = DistilBertTokenizer.from_pretrained('distilbert-base-uncased-distilled-squad')
model = DistilBertModel.from_pretrained('distilbert-base-uncased-distilled-squad')

question, text = "Who was Jim Henson?", "Jim Henson was a nice puppet"

inputs = tokenizer(question, text, return_tensors="pt")
with torch.no_grad():
    outputs = model(**inputs)

print(outputs)

It given following error,

Traceback (most recent call last):
File “/usr/local/lib/python3.8/dist-packages/transformers/utils/import_utils.py”, line 1002, in _get_module
return importlib.import_module(“.” + module_name, self.name)
File “/usr/lib/python3.8/importlib/init.py”, line 127, in import_module
return _bootstrap._gcd_import(name[level:], package, level)
File “”, line 1014, in _gcd_import
File “”, line 991, in _find_and_load
File “”, line 961, in _find_and_load_unlocked
File “”, line 219, in _call_with_frames_removed
File “”, line 1014, in _gcd_import
File “”, line 991, in _find_and_load
File “”, line 975, in _find_and_load_unlocked
File “”, line 671, in _load_unlocked
File “”, line 848, in exec_module
File “”, line 219, in _call_with_frames_removed
File “/usr/local/lib/python3.8/dist-packages/transformers/data/init.py”, line 30, in
from .metrics import glue_compute_metrics, xnli_compute_metrics
File “/usr/local/lib/python3.8/dist-packages/transformers/data/metrics/init.py”, line 22, in
if is_sklearn_available():
File “/usr/local/lib/python3.8/dist-packages/transformers/utils/import_utils.py”, line 492, in is_sklearn_available
return is_scipy_available() and importlib.util.find_spec(“sklearn.metrics”)
File “/usr/lib/python3.8/importlib/util.py”, line 94, in find_spec
parent = import(parent_name, fromlist=[‘path’])
File “/usr/local/lib/python3.8/dist-packages/sklearn/init.py”, line 83, in
from .utils._show_versions import show_versions
File “/usr/local/lib/python3.8/dist-packages/sklearn/utils/_show_versions.py”, line 14, in
from ._openmp_helpers import _openmp_parallelism_enabled
ImportError: /lib/aarch64-linux-gnu/libgomp.so.1: cannot allocate memory in static TLS block

The above exception was the direct cause of the following exception:

Traceback (most recent call last):
File “/usr/local/lib/python3.8/dist-packages/transformers/utils/import_utils.py”, line 1002, in _get_module
return importlib.import_module(“.” + module_name, self.name)
File “/usr/lib/python3.8/importlib/init.py”, line 127, in import_module
return _bootstrap._gcd_import(name[level:], package, level)
File “”, line 1014, in _gcd_import
File “”, line 991, in _find_and_load
File “”, line 975, in _find_and_load_unlocked
File “”, line 671, in _load_unlocked
File “”, line 848, in exec_module
File “”, line 219, in _call_with_frames_removed
File “/usr/local/lib/python3.8/dist-packages/transformers/models/distilbert/modeling_tf_distilbert.py”, line 34, in
from …modeling_tf_utils import (
File “/usr/local/lib/python3.8/dist-packages/transformers/modeling_tf_utils.py”, line 42, in
from . import DataCollatorWithPadding, DefaultDataCollator
File “”, line 1039, in _handle_fromlist
File “/usr/local/lib/python3.8/dist-packages/transformers/utils/import_utils.py”, line 992, in getattr
module = self._get_module(self._class_to_module[name])
File “/usr/local/lib/python3.8/dist-packages/transformers/utils/import_utils.py”, line 1004, in _get_module
raise RuntimeError(
RuntimeError: Failed to import transformers.data.data_collator because of the following error (look up to see its traceback):
/lib/aarch64-linux-gnu/libgomp.so.1: cannot allocate memory in static TLS block

The above exception was the direct cause of the following exception:

Traceback (most recent call last):
File “/home/user/Desktop/nlp2.py”, line 1, in
from transformers import DistilBertTokenizer, TFDistilBertForQuestionAnswering
File “”, line 1039, in _handle_fromlist
File “/usr/local/lib/python3.8/dist-packages/transformers/utils/import_utils.py”, line 993, in getattr
value = getattr(module, name)
File “/usr/local/lib/python3.8/dist-packages/transformers/utils/import_utils.py”, line 992, in getattr
module = self._get_module(self._class_to_module[name])
File “/usr/local/lib/python3.8/dist-packages/transformers/utils/import_utils.py”, line 1004, in _get_module
raise RuntimeError(
RuntimeError: Failed to import transformers.models.distilbert.modeling_tf_distilbert because of the following error (look up to see its traceback):
Failed to import transformers.data.data_collator because of the following error (look up to see its traceback):
/lib/aarch64-linux-gnu/libgomp.so.1: cannot allocate memory in static TLS block

The I tried following code:

from transformers import DistilBertTokenizer, TFDistilBertForQuestionAnswering
import tensorflow as tf

tokenizer = DistilBertTokenizer.from_pretrained("distilbert-base-uncased-distilled-squad")
model = TFDistilBertForQuestionAnswering.from_pretrained("distilbert-base-uncased-distilled-squad")

question, text = "Who was Jim Henson?", "Jim Henson was a nice puppet"

inputs = tokenizer(question, text, return_tensors="tf")
outputs = model(**inputs)

answer_start_index = int(tf.math.argmax(outputs.start_logits, axis=-1)[0])
answer_end_index = int(tf.math.argmax(outputs.end_logits, axis=-1)[0])

predict_answer_tokens = inputs.input_ids[0, answer_start_index : answer_end_index + 1]
tokenizer.decode(predict_answer_tokens)

That given following error

Some weights of the model checkpoint at distilbert-base-uncased-distilled-squad were not used when initializing DistilBertModel: [‘qa_outputs.weight’, ‘qa_outputs.bias’]

  • This IS expected if you are initializing DistilBertModel from the checkpoint of a model trained on another task or with another architecture (e.g. initializing a BertForSequenceClassification model from a BertForPreTraining model).
  • This IS NOT expected if you are initializing DistilBertModel from the checkpoint of a model that you expect to be exactly identical (initializing a BertForSequenceClassification model from a BertForSequenceClassification model).
    BaseModelOutput(last_hidden_state=tensor([[[nan, nan, nan, …, nan, nan, nan],
    [nan, nan, nan, …, nan, nan, nan],
    [nan, nan, nan, …, nan, nan, nan],
    …,
    [nan, nan, nan, …, nan, nan, nan],
    [nan, nan, nan, …, nan, nan, nan],
    [nan, nan, nan, …, nan, nan, nan]]]), hidden_states=None, attentions=None)

I think all error are relatted to memory allocate. How can i solve this issue?