

# coding=utf-8
# Copyright 2020 The HuggingFace Inc. team.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
#     http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.

# this script dumps information about the environment

import os
import sys

import transformers


lowerCAmelCase							:  Union[str, Any]            =						'''3'''

print("""Python version:""", sys.version)
print("""transformers version:""", transformers.__version__)

try:
						import torch

						print("""Torch version:""", torch.__version__)
						print("""Cuda available:""", torch.cuda.is_available())
						print("""Cuda version:""", torch.version.cuda)
						print("""CuDNN version:""", torch.backends.cudnn.version())
						print("""Number of GPUs available:""", torch.cuda.device_count())
						print("""NCCL version:""", torch.cuda.nccl.version())
except ImportError:
						print("""Torch version:""", None)

try:
						import deepspeed

						print("""DeepSpeed version:""", deepspeed.__version__)
except ImportError:
						print("""DeepSpeed version:""", None)

try:
						import tensorflow as tf

						print("""TensorFlow version:""", tf.__version__)
						print("""TF GPUs available:""", bool(tf.config.list_physical_devices("""GPU""")))
						print("""Number of TF GPUs available:""", len(tf.config.list_physical_devices("""GPU""")))
except ImportError:
						print("""TensorFlow version:""", None)








from __future__ import annotations

from collections import deque
from collections.abc import Iterator
from dataclasses import dataclass



@dataclass
class   __lowercase    :




			"""simple docstring"""







			_UpperCAmelCase       :							int
			_UpperCAmelCase       :							int







class   __lowercase    :




			"""simple docstring"""







			def __init__(			self  :					Any       ,						lowerCAmelCase__  :					int):
									SCREAMING_SNAKE_CASE_:			list[list[Edge]]  		=	[[] for _ in range(lowerCAmelCase__)]
									SCREAMING_SNAKE_CASE_:			Dict  		=	size



			def __getitem__(			self  :					Dict       ,						lowerCAmelCase__  :					int):
									return iter(self._graph[vertex])



			@property
			def 	_SCREAMING_SNAKE_CASE      (			self  :					Tuple):
									return self._size



			def 	_SCREAMING_SNAKE_CASE      (			self  :					Dict       ,						lowerCAmelCase__  :					int       ,						lowerCAmelCase__  :					int       ,						lowerCAmelCase__  :					int):
									if weight not in (0, 1):
															raise ValueError("Edge weight must be either 0 or 1.")

									if to_vertex < 0 or to_vertex >= self.size:
															raise ValueError("Vertex indexes must be in [0; size).")

									self._graph[from_vertex].append(Edge(lowerCAmelCase__       ,						lowerCAmelCase__))




			def 	_SCREAMING_SNAKE_CASE      (			self  :					List[Any]       ,						lowerCAmelCase__  :					int       ,						lowerCAmelCase__  :					int):
									SCREAMING_SNAKE_CASE_:			Optional[int]  		=	deque([start_vertex])
									SCREAMING_SNAKE_CASE_:			list[int | None]  		=	[None] * self.size
									SCREAMING_SNAKE_CASE_:			List[Any]  		=	0

									while queue:
															SCREAMING_SNAKE_CASE_:			int  		=	queue.popleft()
															SCREAMING_SNAKE_CASE_:			str  		=	distances[current_vertex]
															if current_distance is None:
																					continue

															for edge in self[current_vertex]:
																					SCREAMING_SNAKE_CASE_:			Optional[int]  		=	current_distance + edge.weight
																					SCREAMING_SNAKE_CASE_:			str  		=	distances[edge.destination_vertex]
																					if (
																					    isinstance(lowerCAmelCase__       ,						lowerCAmelCase__)
																					    and new_distance >= dest_vertex_distance
																					):
																											continue
																					SCREAMING_SNAKE_CASE_:			Any  		=	new_distance
																					if edge.weight == 0:
																											queue.appendleft(edge.destination_vertex)
																					else:
																											queue.append(edge.destination_vertex)

									if distances[finish_vertex] is None:
															raise ValueError("No path from start_vertex to finish_vertex.")

									return distances[finish_vertex]


if __name__ == "__main__":
						import doctest

						doctest.testmod()






