Guest User

Untitled

a guest
Apr 8th, 2024
6
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 13.32 KB | None | 0 0
  1. PS C:\Users\user> python
  2. Python 3.10.6 (tags/v3.10.6:9c7b4bd, Aug 1 2022, 21:53:49) [MSC v.1932 64 bit (AMD64)] on win32
  3. Type "help", "copyright", "credits" or "license" for more information.
  4. >>> from optimum.onnxruntime import ORTModelForSequenceClassification
  5. >>> from transformers import AutoTokenizer
  6. ... )
  7. config.json: 100%|████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████| 829/829 [00:00<?, ?B/s]
  8. C:\Users\user\.pyenv\pyenv-win\versions\3.10.6\lib\site-packages\huggingface_hub\file_download.py:148: UserWarning: `huggingface_hub` cache-system uses symlinks by default to efficiently store duplicated files but your machine does not support them in C:\Users\user\.cache\huggittps://huggingface.co/docs/huggingface_hub/how-to-cache#limitations.
  9. To support symlinks on Windows, you either need to activate Developer Mode or to run Python as an administrator. In order to see activate developer mode, see this article: https://docs.microsoft.com/en-us/windows/apps/get-started/enable-your-device-for-development
  10. warnings.warn(message)
  11. pytorch_model.bin: 100%|██████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████| 17.6M/17.6M [00:00<00:00, 27.8MB/s]
  12. vocab.txt: 100%|████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████| 232k/232k [00:00<00:00, 6.94MB/s]
  13. tokenizer.json: 100%|███████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████| 466k/466k [00:00<00:00, 15.0MB/s]
  14. special_tokens_map.json: 100%|████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████| 112/112 [00:00<?, ?B/s]
  15. Using the export variant default. Available variants are:
  16. - default: The default ONNX variant.
  17. Using framework PyTorch: 2.2.2+cpu
  18. Overriding 1 configuration item(s)
  19. - use_cache -> False
  20. 2024-04-08 17:55:23.6758212 [E:onnxruntime:Default, provider_bridge_ort.cc:1548 onnxruntime::TryGetProviderInfo_CUDA] D:\a\_work\1\s\onnxruntime\core\session\provider_bridge_ort.cc:1209 onnxruntime::ProviderLibrary::Get [ONNXRuntimeError] : 1 : FAIL : LoadLibrary failed with error 126 "" when trying to load "C:\Users\user\.pyenv\pyenv-win\versions\3.10.6\lib\site-packages\onnxruntime\capi\onnxruntime_providers_cuda.dll"
  21.  
  22. *************** EP Error ***************
  23. EP Error D:\a\_work\1\s\onnxruntime\python\onnxruntime_pybind_state.cc:857 onnxruntime::python::CreateExecutionProviderInstance CUDA_PATH is set but CUDA wasnt able to be loaded. Please install the correct version of CUDA andcuDNN as mentioned in the GPU requirements page (https://onnxruntime.ai/docs/execution-providers/CUDA-ExecutionProvider.html#requirements), make sure they're in the PATH, and that your GPU is supported.
  24. when using ['CUDAExecutionProvider']
  25. Falling back to ['CUDAExecutionProvider', 'CPUExecutionProvider'] and retrying.
  26. ****************************************
  27. 2024-04-08 17:55:23.7325638 [E:onnxruntime:Default, provider_bridge_ort.cc:1548 onnxruntime::TryGetProviderInfo_CUDA] D:\a\_work\1\s\onnxruntime\core\session\provider_bridge_ort.cc:1209 onnxruntime::ProviderLibrary::Get [ONNXRuntimeError] : 1 : FAIL : LoadLibrary failed with error 126 "" when trying to load "C:\Users\user\.pyenv\pyenv-win\versions\3.10.6\lib\site-packages\onnxruntime\capi\onnxruntime_providers_cuda.dll"
  28.  
  29. Traceback (most recent call last):
  30. File "C:\Users\user\.pyenv\pyenv-win\versions\3.10.6\lib\site-packages\onnxruntime\capi\onnxruntime_inference_collection.py", line 419, in __init__
  31. self._create_inference_session(providers, provider_options, disabled_optimizers)
  32. File "C:\Users\user\.pyenv\pyenv-win\versions\3.10.6\lib\site-packages\onnxruntime\capi\onnxruntime_inference_collection.py", line 483, in _create_inference_session
  33. sess.initialize_session(providers, provider_options, disabled_optimizers)
  34. RuntimeError: D:\a\_work\1\s\onnxruntime\python\onnxruntime_pybind_state.cc:857 onnxruntime::python::CreateExecutionProviderInstance CUDA_PATH is set but CUDA wasnt able to be loaded. Please install the correct version of CUDA andcuDNN as mentioned in the GPU requirements page (https://onnxruntime.ai/docs/execution-providers/CUDA-ExecutionProvider.html#requirements), make sure they're in the PATH, and that your GPU is supported.
  35.  
  36.  
  37. The above exception was the direct cause of the following exception:
  38.  
  39. Traceback (most recent call last):
  40. File "<stdin>", line 1, in <module>
  41. File "C:\Users\user\.pyenv\pyenv-win\versions\3.10.6\lib\site-packages\optimum\onnxruntime\modeling_ort.py", line 663, in from_pretrained
  42. return super().from_pretrained(
  43. File "C:\Users\user\.pyenv\pyenv-win\versions\3.10.6\lib\site-packages\optimum\modeling_base.py", line 401, in from_pretrained
  44. return from_pretrained_method(
  45. File "C:\Users\user\.pyenv\pyenv-win\versions\3.10.6\lib\site-packages\optimum\onnxruntime\modeling_ort.py", line 545, in _from_transformers
  46. return cls._export(
  47. File "C:\Users\user\.pyenv\pyenv-win\versions\3.10.6\lib\site-packages\optimum\onnxruntime\modeling_ort.py", line 604, in _export
  48. return cls._from_pretrained(
  49. File "C:\Users\user\.pyenv\pyenv-win\versions\3.10.6\lib\site-packages\optimum\onnxruntime\modeling_ort.py", line 511, in _from_pretrained
  50. model = ORTModel.load_model(
  51. File "C:\Users\user\.pyenv\pyenv-win\versions\3.10.6\lib\site-packages\optimum\onnxruntime\modeling_ort.py", line 374, in load_model
  52. return ort.InferenceSession(
  53.  
  54. >>>
  55. >>> tokenizer = AutoTokenizer.from_pretrained("philschmid/tiny-bert-sst2-distilled")
  56. >>> inputs = tokenizer("expectations were low, actual enjoyment was high", return_tensors="pt", padding=True)
  57. >>>
  58. >>> outputs = ort_model(**inputs)
  59. Traceback (most recent call last):
  60. File "<stdin>", line 1, in <module>
  61. NameError: name 'ort_model' is not defined
  62. Terminate batch job (Y/N)? y
  63. Looking in indexes: https://download.pytorch.org/whl/cu118
  64. Requirement already satisfied: torchvision in c:\users\user\.pyenv\pyenv-win\versions\3.10.6\lib\site-packages (0.17.2)
  65. Collecting torchaudio
  66. Downloading https://download.pytorch.org/whl/cu118/torchaudio-2.2.2%2Bcu118-cp310-cp310-win_amd64.whl (4.0 MB)
  67. ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 4.0/4.0 MB 12.1 MB/s eta 0:00:00
  68. Requirement already satisfied: networkx in c:\users\user\.pyenv\pyenv-win\versions\3.10.6\lib\site-packages (from torch) (3.3)
  69. Requirement already satisfied: fsspec in c:\users\user\.pyenv\pyenv-win\versions\3.10.6\lib\site-packages (from torch) (2024.2.0)
  70. Requirement already satisfied: sympy in c:\users\user\.pyenv\pyenv-win\versions\3.10.6\lib\site-packages (from torch) (1.12)
  71. Requirement already satisfied: jinja2 in c:\users\user\.pyenv\pyenv-win\versions\3.10.6\lib\site-packages (from torch) (3.1.3)
  72. Requirement already satisfied: filelock in c:\users\user\.pyenv\pyenv-win\versions\3.10.6\lib\site-packages (from torch) (3.13.3)
  73. Requirement already satisfied: typing-extensions>=4.8.0 in c:\users\user\.pyenv\pyenv-win\versions\3.10.6\lib\site-packages (from torch) (4.11.0)
  74. Requirement already satisfied: numpy in c:\users\user\.pyenv\pyenv-win\versions\3.10.6\lib\site-packages (from torchvision) (1.26.4)
  75. Requirement already satisfied: pillow!=8.3.*,>=5.3.0 in c:\users\user\.pyenv\pyenv-win\versions\3.10.6\lib\site-packages (from torchvision) (10.3.0)
  76. Collecting torch
  77. Downloading https://download.pytorch.org/whl/cu118/torch-2.2.2%2Bcu118-cp310-cp310-win_amd64.whl (2704.2 MB)
  78. ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 2.7/2.7 GB ? eta 0:00:00
  79. Requirement already satisfied: MarkupSafe>=2.0 in c:\users\user\.pyenv\pyenv-win\versions\3.10.6\lib\site-packages (from jinja2->torch) (2.1.5)
  80. Requirement already satisfied: mpmath>=0.19 in c:\users\user\.pyenv\pyenv-win\versions\3.10.6\lib\site-packages (from sympy->torch) (1.3.0)
  81. Installing collected packages: torch, torchaudio
  82. Attempting uninstall: torch
  83. Found existing installation: torch 2.2.2
  84. Uninstalling torch-2.2.2:
  85. Successfully uninstalled torch-2.2.2
  86. Successfully installed torch-2.2.2+cu118 torchaudio-2.2.2+cu118
  87.  
  88. [notice] A new release of pip available: 22.2.1 -> 24.0
  89. [notice] To update, run: python.exe -m pip install --upgrade pip
  90. PS C:\Users\user> \
  91. \ : The term '\' is not recognized as the name of a cmdlet, function, script file, or operable program. Check the spelling of the name, or if a path was included, verify that the path is correct and try again.
  92. At line:1 char:1
  93. + \
  94. + ~
  95. + CategoryInfo : ObjectNotFound: (\:String) [], CommandNotFoundException
  96. + FullyQualifiedErrorId : CommandNotFoundException
  97.  
  98. PS C:\Users\user>
  99. PS C:\Users\user>
  100. PS C:\Users\user>
  101. PS C:\Users\user>
  102. PS C:\Users\user> python
  103. Python 3.10.6 (tags/v3.10.6:9c7b4bd, Aug 1 2022, 21:53:49) [MSC v.1932 64 bit (AMD64)] on win32
  104. Type "help", "copyright", "credits" or "license" for more information.
  105. >>> from optimum.onnxruntime import ORTModelForSequenceClassification
  106. >>> from transformers import AutoTokenizer
  107. >>>
  108. >>> ort_model = ORTModelForSequenceClassification.from_pretrained(
  109. ... "philschmid/tiny-bert-sst2-distilled",
  110. ... export=True,
  111. ... provider="CUDAExecutionProvider",
  112. ... )
  113. Framework not specified. Using pt to export the model.
  114. Using the export variant default. Available variants are:
  115. - default: The default ONNX variant.
  116. Using framework PyTorch: 2.2.2+cu118
  117. Overriding 1 configuration item(s)
  118. - use_cache -> False
  119. 2024-04-08 18:05:50.9940248 [W:onnxruntime:, session_state.cc:1166 onnxruntime::VerifyEachNodeIsAssignedToAnEp] Some nodes were not assigned to the preferred execution providers which may or may not have an negative impact on performance. e.g. ORT explicitly assigns shape related ops to CPU to improve perf.
  120. 2024-04-08 18:05:51.0097430 [W:onnxruntime:, session_state.cc:1168 onnxruntime::VerifyEachNodeIsAssignedToAnEp] Rerunning with verbose output on a non-minimal build will show node assignments.
  121. >>>
  122. >>> tokenizer = AutoTokenizer.from_pretrained("philschmid/tiny-bert-sst2-distilled")
  123. >>> inputs = tokenizer("expectations were low, actual enjoyment was high", return_tensors="pt", padding=True)
  124. >>>
  125. >>> outputs = ort_model(**inputs)
  126. >>> assert ort_model.providers == ["CUDAExecutionProvider", "CPUExecutionProvider"]
  127. >>> outputs
  128. SequenceClassifierOutput(loss=None, logits=tensor([[ 0.2788, -0.0751]], device='cuda:0'), hidden_states=None, attentions=None)
  129. >>> ort_model.providers
  130. ['CUDAExecutionProvider', 'CPUExecutionProvider']
  131. >>>
Advertisement
Add Comment
Please, Sign In to add comment