CODE I AM RUNNING:
from transformers import pipeline
classifier = pipeline('sentiment-analysis')
res = classifier("I Love Python.'")
print(res)
ERROR I AM GETTING:
No model was supplied, defaulted to distilbert-base-uncased-finetuned-sst-2-english and revision af0f99b (https://huggingface.co/distilbert-base-uncased-finetuned-sst-2-english).
Using a pipeline without specifying a model name and revision in production is not recommended.
C:\Users\omran\AppData\Local\Programs\Python\Python310\lib\site-packages\torch\serialization.py:871: UserWarning: Failed to initialize NumPy: module compiled against API version 0x10 but this version of numpy is 0xf (Triggered internally at ..\torch\csrc\utils\tensor_numpy.cpp:68.)
obj = cast(Storage, torch._UntypedStorage(nbytes))
Traceback (most recent call last):
File "f:\AIAR\yooo\xox.py", line 5, in <module>
res = classifier("I've been waiting for a HuggingFace course my whole life.'")
File "C:\Users\omran\AppData\Local\Programs\Python\Python310\lib\site-packages\transformers\pipelines\text_classification.py", line 138, in __call__
result = super().__call__(*args, **kwargs)
File "C:\Users\omran\AppData\Local\Programs\Python\Python310\lib\site-packages\transformers\pipelines\base.py", line 1067, in __call__
return self.run_single(inputs, preprocess_params, forward_params,
postprocess_params)
File "C:\Users\omran\AppData\Local\Programs\Python\Python310\lib\site-packages\transformers\pipelines\base.py", line 1075, in run_single
outputs = self.postprocess(model_outputs, **postprocess_params)
File "C:\Users\omran\AppData\Local\Programs\Python\Python310\lib\site-packages\transformers\pipelines\text_classification.py", line 183, in postprocess
outputs = outputs.numpy()
RuntimeError: Numpy is not available
PIP FREEZE: DON'T MIND, I'VE BEEN DOING A LOT OF TRIAL AND ERROR.
UPDATED OUTPUT:
No model was supplied, defaulted to distilbert-base-uncased-finetuned-sst-2-english and revision af0f99b (https://huggingface.co/distilbert-base-uncased-finetuned-sst-2-english). Using a pipeline without specifying a model name and revision in production is not recommended. 2022-08-14 18:45:12.106975: I tensorflow/core/platform/cpu_feature_guard.cc:193] This TensorFlow binary is optimized with oneAPI Deep Neural Network Library (oneDNN) to use the following CPU instructions in performance-critical operations: AVX AVX2 To enable them in other operations, rebuild TensorFlow with the appropriate compiler flags. 2022-08-14 18:45:12.667076: I tensorflow/core/common_runtime/gpu/gpu_device.cc:1532] Created device /job:localhost/replica:0/task:0/device:GPU:0 with 1339 MB memory: -> device: 0, name: NVIDIA GeForce MX230, pci bus id: 0000:01:00.0, compute capability: 6.1 All model checkpoint layers were used when initializing TFDistilBertForSequenceClassification.
All the layers of TFDistilBertForSequenceClassification were initialized from the model checkpoint at distilbert-base-uncased-finetuned-sst-2-english. If your task is similar to the task the model of the checkpoint was trained on, you can already use TFDistilBertForSequenceClassification for predictions without further training.
GETTING THE OUTPUT I WANT:
[{'label': 'POSITIVE', 'score': 0.9973993301391602}]