Add files using upload-large-folder tool
Browse filesThis view is limited to 50 files because it contains too many changes.
See raw diff
- videollama2/lib/python3.10/site-packages/torch/ao/pruning/_experimental/pruner/__pycache__/FPGM_pruner.cpython-310.pyc +0 -0
- videollama2/lib/python3.10/site-packages/torch/ao/pruning/_experimental/pruner/__pycache__/__init__.cpython-310.pyc +0 -0
- videollama2/lib/python3.10/site-packages/torch/ao/pruning/_experimental/pruner/__pycache__/base_structured_sparsifier.cpython-310.pyc +0 -0
- videollama2/lib/python3.10/site-packages/torch/ao/pruning/_experimental/pruner/__pycache__/lstm_saliency_pruner.cpython-310.pyc +0 -0
- videollama2/lib/python3.10/site-packages/torch/ao/pruning/_experimental/pruner/__pycache__/prune_functions.cpython-310.pyc +0 -0
- videollama2/lib/python3.10/site-packages/torch/ao/pruning/_experimental/pruner/__pycache__/saliency_pruner.cpython-310.pyc +0 -0
- videollama2/lib/python3.10/site-packages/torch/ao/pruning/scheduler/__init__.py +0 -0
- videollama2/lib/python3.10/site-packages/torch/ao/pruning/scheduler/base_scheduler.py +159 -0
- videollama2/lib/python3.10/site-packages/torch/ao/pruning/scheduler/cubic_scheduler.py +107 -0
- videollama2/lib/python3.10/site-packages/torch/ao/pruning/scheduler/lambda_scheduler.py +47 -0
- videollama2/lib/python3.10/site-packages/torch/include/ATen/ops/linalg_lu_factor_ex_cuda_dispatch.h +25 -0
- videollama2/lib/python3.10/site-packages/torch/include/ATen/ops/new_ones.h +97 -0
- videollama2/lib/python3.10/site-packages/torch/include/ATen/ops/pairwise_distance_ops.h +28 -0
- videollama2/lib/python3.10/site-packages/torch/include/ATen/ops/pinverse.h +30 -0
- videollama2/lib/python3.10/site-packages/torch/include/ATen/ops/to_sparse_native.h +22 -0
- videollama2/lib/python3.10/site-packages/torch/include/ATen/ops/unflatten_dense_tensors.h +30 -0
- videollama2/lib/python3.10/site-packages/torch/include/ATen/ops/upsample_nearest1d_ops.h +50 -0
- vllm/lib/python3.10/site-packages/wandb/vendor/graphql-core-1.1/__pycache__/setup.cpython-310.pyc +0 -0
- vllm/lib/python3.10/site-packages/wandb/vendor/graphql-core-1.1/wandb_graphql/error/__pycache__/__init__.cpython-310.pyc +0 -0
- vllm/lib/python3.10/site-packages/wandb/vendor/graphql-core-1.1/wandb_graphql/error/__pycache__/base.cpython-310.pyc +0 -0
- vllm/lib/python3.10/site-packages/wandb/vendor/graphql-core-1.1/wandb_graphql/error/__pycache__/format_error.cpython-310.pyc +0 -0
- vllm/lib/python3.10/site-packages/wandb/vendor/graphql-core-1.1/wandb_graphql/error/__pycache__/located_error.cpython-310.pyc +0 -0
- vllm/lib/python3.10/site-packages/wandb/vendor/graphql-core-1.1/wandb_graphql/error/base.py +42 -0
- vllm/lib/python3.10/site-packages/wandb/vendor/graphql-core-1.1/wandb_graphql/type/__init__.py +67 -0
- vllm/lib/python3.10/site-packages/wandb/vendor/graphql-core-1.1/wandb_graphql/type/__pycache__/__init__.cpython-310.pyc +0 -0
- vllm/lib/python3.10/site-packages/wandb/vendor/graphql-core-1.1/wandb_graphql/type/__pycache__/definition.cpython-310.pyc +0 -0
- vllm/lib/python3.10/site-packages/wandb/vendor/graphql-core-1.1/wandb_graphql/type/__pycache__/directives.cpython-310.pyc +0 -0
- vllm/lib/python3.10/site-packages/wandb/vendor/graphql-core-1.1/wandb_graphql/type/__pycache__/introspection.cpython-310.pyc +0 -0
- vllm/lib/python3.10/site-packages/wandb/vendor/graphql-core-1.1/wandb_graphql/type/__pycache__/scalars.cpython-310.pyc +0 -0
- vllm/lib/python3.10/site-packages/wandb/vendor/graphql-core-1.1/wandb_graphql/type/__pycache__/schema.cpython-310.pyc +0 -0
- vllm/lib/python3.10/site-packages/wandb/vendor/graphql-core-1.1/wandb_graphql/type/__pycache__/typemap.cpython-310.pyc +0 -0
- vllm/lib/python3.10/site-packages/wandb/vendor/graphql-core-1.1/wandb_graphql/type/definition.py +619 -0
- vllm/lib/python3.10/site-packages/wandb/vendor/graphql-core-1.1/wandb_graphql/type/directives.py +132 -0
- vllm/lib/python3.10/site-packages/wandb/vendor/graphql-core-1.1/wandb_graphql/type/introspection.py +440 -0
- vllm/lib/python3.10/site-packages/wandb/vendor/graphql-core-1.1/wandb_graphql/type/scalars.py +131 -0
- vllm/lib/python3.10/site-packages/wandb/vendor/graphql-core-1.1/wandb_graphql/type/schema.py +100 -0
- vllm/lib/python3.10/site-packages/wandb/vendor/graphql-core-1.1/wandb_graphql/type/typemap.py +145 -0
- vllm/lib/python3.10/site-packages/wandb/vendor/pynvml/__init__.py +0 -0
- vllm/lib/python3.10/site-packages/wandb/vendor/pynvml/__pycache__/__init__.cpython-310.pyc +0 -0
- vllm/lib/python3.10/site-packages/wandb/vendor/pynvml/pynvml.py +0 -0
- vllm/lib/python3.10/site-packages/wandb/vendor/watchdog_0_9_0/wandb_watchdog/__init__.py +17 -0
- vllm/lib/python3.10/site-packages/wandb/vendor/watchdog_0_9_0/wandb_watchdog/events.py +615 -0
- vllm/lib/python3.10/site-packages/wandb/vendor/watchdog_0_9_0/wandb_watchdog/observers/__init__.py +98 -0
- vllm/lib/python3.10/site-packages/wandb/vendor/watchdog_0_9_0/wandb_watchdog/observers/__pycache__/__init__.cpython-310.pyc +0 -0
- vllm/lib/python3.10/site-packages/wandb/vendor/watchdog_0_9_0/wandb_watchdog/observers/__pycache__/api.cpython-310.pyc +0 -0
- vllm/lib/python3.10/site-packages/wandb/vendor/watchdog_0_9_0/wandb_watchdog/observers/__pycache__/fsevents.cpython-310.pyc +0 -0
- vllm/lib/python3.10/site-packages/wandb/vendor/watchdog_0_9_0/wandb_watchdog/observers/__pycache__/fsevents2.cpython-310.pyc +0 -0
- vllm/lib/python3.10/site-packages/wandb/vendor/watchdog_0_9_0/wandb_watchdog/observers/__pycache__/inotify.cpython-310.pyc +0 -0
- vllm/lib/python3.10/site-packages/wandb/vendor/watchdog_0_9_0/wandb_watchdog/observers/__pycache__/inotify_buffer.cpython-310.pyc +0 -0
- vllm/lib/python3.10/site-packages/wandb/vendor/watchdog_0_9_0/wandb_watchdog/observers/__pycache__/inotify_c.cpython-310.pyc +0 -0
videollama2/lib/python3.10/site-packages/torch/ao/pruning/_experimental/pruner/__pycache__/FPGM_pruner.cpython-310.pyc
ADDED
|
Binary file (3.58 kB). View file
|
|
|
videollama2/lib/python3.10/site-packages/torch/ao/pruning/_experimental/pruner/__pycache__/__init__.cpython-310.pyc
ADDED
|
Binary file (513 Bytes). View file
|
|
|
videollama2/lib/python3.10/site-packages/torch/ao/pruning/_experimental/pruner/__pycache__/base_structured_sparsifier.cpython-310.pyc
ADDED
|
Binary file (6.69 kB). View file
|
|
|
videollama2/lib/python3.10/site-packages/torch/ao/pruning/_experimental/pruner/__pycache__/lstm_saliency_pruner.cpython-310.pyc
ADDED
|
Binary file (1.98 kB). View file
|
|
|
videollama2/lib/python3.10/site-packages/torch/ao/pruning/_experimental/pruner/__pycache__/prune_functions.cpython-310.pyc
ADDED
|
Binary file (10.2 kB). View file
|
|
|
videollama2/lib/python3.10/site-packages/torch/ao/pruning/_experimental/pruner/__pycache__/saliency_pruner.cpython-310.pyc
ADDED
|
Binary file (1.41 kB). View file
|
|
|
videollama2/lib/python3.10/site-packages/torch/ao/pruning/scheduler/__init__.py
ADDED
|
File without changes
|
videollama2/lib/python3.10/site-packages/torch/ao/pruning/scheduler/base_scheduler.py
ADDED
|
@@ -0,0 +1,159 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
|
| 2 |
+
from torch.ao.pruning import BaseSparsifier
|
| 3 |
+
|
| 4 |
+
from functools import wraps
|
| 5 |
+
import warnings
|
| 6 |
+
import weakref
|
| 7 |
+
|
| 8 |
+
__all__ = ["BaseScheduler"]
|
| 9 |
+
|
| 10 |
+
class BaseScheduler:
|
| 11 |
+
|
| 12 |
+
def __init__(self, sparsifier, last_epoch=-1, verbose=False):
|
| 13 |
+
|
| 14 |
+
# Attach sparsifier
|
| 15 |
+
if not isinstance(sparsifier, BaseSparsifier):
|
| 16 |
+
raise TypeError(f'{type(sparsifier).__name__} is not an instance of torch.ao.pruning.BaseSparsifier')
|
| 17 |
+
self.sparsifier = sparsifier
|
| 18 |
+
|
| 19 |
+
# Initialize epoch and base sparsity levels
|
| 20 |
+
|
| 21 |
+
self.base_sl = [group['sparsity_level'] for group in sparsifier.groups]
|
| 22 |
+
self.last_epoch = last_epoch
|
| 23 |
+
|
| 24 |
+
# Following https://github.com/pytorch/pytorch/issues/20124
|
| 25 |
+
# We would like to ensure that `scheduler.step()` is called after
|
| 26 |
+
# `sparsifier.step()`
|
| 27 |
+
def with_counter(method):
|
| 28 |
+
if getattr(method, '_with_counter', False):
|
| 29 |
+
# `sparsifier.step()` has already been replaced, return.
|
| 30 |
+
return method
|
| 31 |
+
|
| 32 |
+
# Keep a weak reference to the sparsifier instance to prevent
|
| 33 |
+
# cyclic references.
|
| 34 |
+
instance_ref = weakref.ref(method.__self__)
|
| 35 |
+
# Get the unbound method for the same purpose.
|
| 36 |
+
func = method.__func__
|
| 37 |
+
cls = instance_ref().__class__
|
| 38 |
+
del method
|
| 39 |
+
|
| 40 |
+
@wraps(func)
|
| 41 |
+
def wrapper(*args, **kwargs):
|
| 42 |
+
instance = instance_ref()
|
| 43 |
+
instance._step_count += 1 # type: ignore[union-attr]
|
| 44 |
+
wrapped = func.__get__(instance, cls)
|
| 45 |
+
return wrapped(*args, **kwargs)
|
| 46 |
+
|
| 47 |
+
# Note that the returned function here is no longer a bound method,
|
| 48 |
+
# so attributes like `__func__` and `__self__` no longer exist.
|
| 49 |
+
wrapper._with_counter = True # type: ignore[attr-defined]
|
| 50 |
+
return wrapper
|
| 51 |
+
|
| 52 |
+
self.sparsifier.step = with_counter(self.sparsifier.step) # type: ignore[assignment]
|
| 53 |
+
self.sparsifier._step_count = 0 # type: ignore[attr-defined]
|
| 54 |
+
self._step_count: int = 0
|
| 55 |
+
self.verbose = verbose
|
| 56 |
+
|
| 57 |
+
# Housekeeping
|
| 58 |
+
self._get_sl_called_within_step: bool = False
|
| 59 |
+
|
| 60 |
+
self.step()
|
| 61 |
+
|
| 62 |
+
def state_dict(self):
|
| 63 |
+
"""Returns the state of the scheduler as a :class:`dict`.
|
| 64 |
+
|
| 65 |
+
It contains an entry for every variable in self.__dict__ which
|
| 66 |
+
is not the sparsifier.
|
| 67 |
+
"""
|
| 68 |
+
return {key: value for key, value in self.__dict__.items() if key != 'sparsifier'}
|
| 69 |
+
|
| 70 |
+
def load_state_dict(self, state_dict):
|
| 71 |
+
"""Loads the schedulers state.
|
| 72 |
+
|
| 73 |
+
Args:
|
| 74 |
+
state_dict (dict): scheduler state. Should be an object returned
|
| 75 |
+
from a call to :meth:`state_dict`.
|
| 76 |
+
"""
|
| 77 |
+
self.__dict__.update(state_dict)
|
| 78 |
+
|
| 79 |
+
def get_last_sl(self):
|
| 80 |
+
""" Return last computed sparsity level by current scheduler.
|
| 81 |
+
"""
|
| 82 |
+
return self._last_sl
|
| 83 |
+
|
| 84 |
+
def get_sl(self):
|
| 85 |
+
# Compute sparsity level using chainable form of the scheduler
|
| 86 |
+
# Note: This method is not intended to be called directly, and is only
|
| 87 |
+
# used by the ".step" method. Use .get_last_sl() instead.
|
| 88 |
+
if not self._get_sl_called_within_step:
|
| 89 |
+
warnings.warn(
|
| 90 |
+
"To get the last sparsity level computed by the scheduler, "
|
| 91 |
+
"please use `get_last_sl()`.")
|
| 92 |
+
raise NotImplementedError
|
| 93 |
+
|
| 94 |
+
def print_sl(self, is_verbose, group, sl, epoch=None):
|
| 95 |
+
"""Display the current sparsity level.
|
| 96 |
+
"""
|
| 97 |
+
if is_verbose:
|
| 98 |
+
if epoch is None:
|
| 99 |
+
print(f'Adjusting sparsity level of group {group} to {sl:.4e}.')
|
| 100 |
+
else:
|
| 101 |
+
print(f'Epoch {epoch:5d}: adjusting sparsity level of group {group} to {sl:.4e}.')
|
| 102 |
+
|
| 103 |
+
def __repr__(self):
|
| 104 |
+
format_string = self.__class__.__name__ + ' ('
|
| 105 |
+
format_string += '\n'
|
| 106 |
+
format_string += f'Sparsifier {self.sparsifier}\n'
|
| 107 |
+
format_string += f' base_sl: {self.base_sl}\n'
|
| 108 |
+
format_string += ')'
|
| 109 |
+
return format_string
|
| 110 |
+
|
| 111 |
+
def step(self, epoch=None):
|
| 112 |
+
# Raise warning if trying to call scheduler step before the sparsifier.
|
| 113 |
+
# https://github.com/pytorch/pytorch/issues/20124
|
| 114 |
+
if self._step_count == 1:
|
| 115 |
+
if not hasattr(self.sparsifier.step, "_with_counter"):
|
| 116 |
+
warnings.warn("Seems like `sparsifier.step()` has been overridden after sparsity scheduler "
|
| 117 |
+
"initialization. Please, make sure to call `sparsifier.step()` before "
|
| 118 |
+
"`scheduler.step()`.", UserWarning)
|
| 119 |
+
|
| 120 |
+
# Just check if there were two first scheduler.step() calls before sparsifier.step()
|
| 121 |
+
elif self.sparsifier._step_count < 1: # type: ignore[attr-defined]
|
| 122 |
+
warnings.warn("Detected call of `scheduler.step()` before `sparsifier.step()`. "
|
| 123 |
+
"You have to make sure you run the sparsifier.step() BEFORE any "
|
| 124 |
+
"calls to the scheduler.step().", UserWarning)
|
| 125 |
+
self._step_count += 1
|
| 126 |
+
|
| 127 |
+
class _enable_get_sl_call:
|
| 128 |
+
|
| 129 |
+
def __init__(self, o):
|
| 130 |
+
self.o = o
|
| 131 |
+
|
| 132 |
+
def __enter__(self):
|
| 133 |
+
self.o._get_sl_called_within_step = True
|
| 134 |
+
return self
|
| 135 |
+
|
| 136 |
+
def __exit__(self, type, value, traceback):
|
| 137 |
+
self.o._get_sl_called_within_step = False
|
| 138 |
+
|
| 139 |
+
with _enable_get_sl_call(self):
|
| 140 |
+
self.last_epoch += 1
|
| 141 |
+
values = self.get_sl()
|
| 142 |
+
|
| 143 |
+
for i, data in enumerate(zip(self.sparsifier.groups, values)):
|
| 144 |
+
param_group, sl = data
|
| 145 |
+
param_group['sparsity_level'] = sl
|
| 146 |
+
self.print_sl(self.verbose, i, sl, epoch)
|
| 147 |
+
|
| 148 |
+
self._last_sl = [group['sparsity_level'] for group in self.sparsifier.groups]
|
| 149 |
+
self.sparsifier.enable_mask_update = True
|
| 150 |
+
|
| 151 |
+
def _make_sure_a_list(self, var):
|
| 152 |
+
r"""Utility that extends it to the same length as the .groups, ensuring it is a list"""
|
| 153 |
+
n = len(self.sparsifier.groups)
|
| 154 |
+
if not isinstance(var, (list, tuple)):
|
| 155 |
+
return [var] * n
|
| 156 |
+
else:
|
| 157 |
+
if len(var) != n:
|
| 158 |
+
raise ValueError(f"Expected variable of length {n}, but got {len(var)}")
|
| 159 |
+
return list(var) # We want the result to be in a list, not tuple
|
videollama2/lib/python3.10/site-packages/torch/ao/pruning/scheduler/cubic_scheduler.py
ADDED
|
@@ -0,0 +1,107 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
import warnings
|
| 2 |
+
|
| 3 |
+
from .base_scheduler import BaseScheduler
|
| 4 |
+
|
| 5 |
+
__all__ = ["CubicSL"]
|
| 6 |
+
|
| 7 |
+
def _clamp(x, lo, hi):
|
| 8 |
+
return max(lo, min(hi, x))
|
| 9 |
+
|
| 10 |
+
|
| 11 |
+
class CubicSL(BaseScheduler):
|
| 12 |
+
r"""Sets the sparsity level of each parameter group to the final sl
|
| 13 |
+
plus a given exponential function.
|
| 14 |
+
|
| 15 |
+
.. math::
|
| 16 |
+
|
| 17 |
+
s_i = s_f + (s_0 - s_f) \cdot \left( 1 - \frac{t - t_0}{n\Delta t} \right)^3
|
| 18 |
+
|
| 19 |
+
where :math:`s_i` is the sparsity at epoch :math:`t`, :math;`s_f` is the final
|
| 20 |
+
sparsity level, :math:`f(i)` is the function to be applied to the current epoch
|
| 21 |
+
:math:`t`, initial epoch :math:`t_0`, and final epoch :math:`t_f`.
|
| 22 |
+
:math:`\Delta t` is used to control how often the update of the sparsity level
|
| 23 |
+
happens. By default,
|
| 24 |
+
|
| 25 |
+
Args:
|
| 26 |
+
sparsifier (BaseSparsifier): Wrapped sparsifier.
|
| 27 |
+
init_sl (int, list): Initial level of sparsity
|
| 28 |
+
init_t (int, list): Initial step, when pruning starts
|
| 29 |
+
delta_t (int, list): Pruning frequency
|
| 30 |
+
total_t (int, list): Total number of pruning steps
|
| 31 |
+
initially_zero (bool, list): If True, sets the level of sparsity to 0
|
| 32 |
+
before init_t (:math:`t_0`). Otherwise, the sparsity level before
|
| 33 |
+
init_t (:math:`t_0`) is set to init_sl(:math:`s_0`)
|
| 34 |
+
last_epoch (int): The index of last epoch. Default: -1.
|
| 35 |
+
verbose (bool): If ``True``, prints a message to stdout for
|
| 36 |
+
each update. Default: ``False``.
|
| 37 |
+
"""
|
| 38 |
+
def __init__(self,
|
| 39 |
+
sparsifier,
|
| 40 |
+
init_sl=0.0,
|
| 41 |
+
init_t=0,
|
| 42 |
+
delta_t=10,
|
| 43 |
+
total_t=100,
|
| 44 |
+
initially_zero=False,
|
| 45 |
+
last_epoch=-1,
|
| 46 |
+
verbose=False
|
| 47 |
+
):
|
| 48 |
+
self.sparsifier = sparsifier
|
| 49 |
+
|
| 50 |
+
self.init_sl = self._make_sure_a_list(init_sl)
|
| 51 |
+
self.init_t = self._make_sure_a_list(init_t)
|
| 52 |
+
self.delta_t = self._make_sure_a_list(delta_t)
|
| 53 |
+
self.total_t = self._make_sure_a_list(total_t)
|
| 54 |
+
|
| 55 |
+
self.initially_zero = self._make_sure_a_list(initially_zero)
|
| 56 |
+
|
| 57 |
+
super().__init__(sparsifier, last_epoch, verbose)
|
| 58 |
+
|
| 59 |
+
@staticmethod
|
| 60 |
+
def sparsity_compute_fn(s_0, s_f, t, t_0, dt, n, initially_zero=False):
|
| 61 |
+
r""""Computes the current level of sparsity.
|
| 62 |
+
|
| 63 |
+
Based on https://arxiv.org/pdf/1710.01878.pdf
|
| 64 |
+
|
| 65 |
+
Args:
|
| 66 |
+
s_0: Initial level of sparsity, :math:`s_i`
|
| 67 |
+
s_f: Target level of sparsity, :math:`s_f`
|
| 68 |
+
t: Current step, :math:`t`
|
| 69 |
+
t_0: Initial step, :math:`t_0`
|
| 70 |
+
dt: Pruning frequency, :math:`\Delta T`
|
| 71 |
+
n: Pruning steps, :math:`n`
|
| 72 |
+
initially_zero: Sets the level of sparsity to 0 before t_0.
|
| 73 |
+
If False, sets to s_0
|
| 74 |
+
|
| 75 |
+
Returns:
|
| 76 |
+
The sparsity level :math:`s_t` at the current step :math:`t`
|
| 77 |
+
"""
|
| 78 |
+
if initially_zero and t < t_0:
|
| 79 |
+
return 0
|
| 80 |
+
s_t = s_f + (s_0 - s_f) * (1.0 - (t - t_0) / (dt * n)) ** 3
|
| 81 |
+
s_t = _clamp(s_t, s_0, s_f)
|
| 82 |
+
return s_t
|
| 83 |
+
|
| 84 |
+
def get_sl(self):
|
| 85 |
+
if not self._get_sl_called_within_step:
|
| 86 |
+
warnings.warn(
|
| 87 |
+
"To get the last sparsity level computed by the scheduler, "
|
| 88 |
+
"please use `get_last_sl()`.")
|
| 89 |
+
return [
|
| 90 |
+
self.sparsity_compute_fn(
|
| 91 |
+
s_0=initial_sparsity,
|
| 92 |
+
s_f=final_sparsity,
|
| 93 |
+
t=self.last_epoch,
|
| 94 |
+
t_0=initial_epoch,
|
| 95 |
+
dt=delta_epoch,
|
| 96 |
+
n=interval_epochs,
|
| 97 |
+
initially_zero=initially_zero
|
| 98 |
+
) for initial_sparsity, final_sparsity, initial_epoch, delta_epoch, interval_epochs, initially_zero in
|
| 99 |
+
zip(
|
| 100 |
+
self.init_sl,
|
| 101 |
+
self.base_sl,
|
| 102 |
+
self.init_t,
|
| 103 |
+
self.delta_t,
|
| 104 |
+
self.total_t,
|
| 105 |
+
self.initially_zero
|
| 106 |
+
)
|
| 107 |
+
]
|
videollama2/lib/python3.10/site-packages/torch/ao/pruning/scheduler/lambda_scheduler.py
ADDED
|
@@ -0,0 +1,47 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
import warnings
|
| 2 |
+
|
| 3 |
+
from .base_scheduler import BaseScheduler
|
| 4 |
+
|
| 5 |
+
__all__ = ["LambdaSL"]
|
| 6 |
+
|
| 7 |
+
class LambdaSL(BaseScheduler):
|
| 8 |
+
"""Sets the sparsity level of each parameter group to the final sl
|
| 9 |
+
times a given function. When last_epoch=-1, sets initial sl as zero.
|
| 10 |
+
Args:
|
| 11 |
+
sparsifier (BaseSparsifier): Wrapped sparsifier.
|
| 12 |
+
sl_lambda (function or list): A function which computes a multiplicative
|
| 13 |
+
factor given an integer parameter epoch, or a list of such
|
| 14 |
+
functions, one for each group in sparsifier.param_groups.
|
| 15 |
+
last_epoch (int): The index of last epoch. Default: -1.
|
| 16 |
+
verbose (bool): If ``True``, prints a message to stdout for
|
| 17 |
+
each update. Default: ``False``.
|
| 18 |
+
Example:
|
| 19 |
+
>>> # Assuming sparsifier has two groups.
|
| 20 |
+
>>> lambda1 = lambda epoch: epoch // 30
|
| 21 |
+
>>> lambda2 = lambda epoch: 0.95 ** epoch
|
| 22 |
+
>>> # xdoctest: +SKIP
|
| 23 |
+
>>> scheduler = LambdaSL(sparsifier, sl_lambda=[lambda1, lambda2])
|
| 24 |
+
>>> for epoch in range(100):
|
| 25 |
+
>>> train(...)
|
| 26 |
+
>>> validate(...)
|
| 27 |
+
>>> scheduler.step()
|
| 28 |
+
"""
|
| 29 |
+
|
| 30 |
+
def __init__(self, sparsifier, sl_lambda, last_epoch=-1, verbose=False):
|
| 31 |
+
self.sparsifier = sparsifier
|
| 32 |
+
|
| 33 |
+
if not isinstance(sl_lambda, list) and not isinstance(sl_lambda, tuple):
|
| 34 |
+
self.sl_lambdas = [sl_lambda] * len(sparsifier.groups)
|
| 35 |
+
else:
|
| 36 |
+
if len(sl_lambda) != len(sparsifier.groups):
|
| 37 |
+
raise ValueError(f"Expected {len(sparsifier.groups)} lr_lambdas, but got {len(sl_lambda)}")
|
| 38 |
+
self.sl_lambdas = list(sl_lambda)
|
| 39 |
+
super().__init__(sparsifier, last_epoch, verbose)
|
| 40 |
+
|
| 41 |
+
def get_sl(self):
|
| 42 |
+
if not self._get_sl_called_within_step:
|
| 43 |
+
warnings.warn(
|
| 44 |
+
"To get the last sparsity level computed by the scheduler, "
|
| 45 |
+
"please use `get_last_sl()`.")
|
| 46 |
+
return [base_sl * lmbda(self.last_epoch)
|
| 47 |
+
for lmbda, base_sl in zip(self.sl_lambdas, self.base_sl)]
|
videollama2/lib/python3.10/site-packages/torch/include/ATen/ops/linalg_lu_factor_ex_cuda_dispatch.h
ADDED
|
@@ -0,0 +1,25 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
#pragma once
|
| 2 |
+
// @generated by torchgen/gen.py from DispatchKeyFunction.h
|
| 3 |
+
|
| 4 |
+
// NB: The implementing C++ file is RegisterDispatchKey.cpp
|
| 5 |
+
|
| 6 |
+
// The only #includes we need are for custom classes that have defaults in the C++ API
|
| 7 |
+
#include <c10/core/MemoryFormat.h>
|
| 8 |
+
#include <c10/core/Scalar.h>
|
| 9 |
+
#include <ATen/core/Reduction.h>
|
| 10 |
+
|
| 11 |
+
// Forward declarations of any types needed in the operator signatures.
|
| 12 |
+
// We can't directly include these classes because it will cause circular include dependencies.
|
| 13 |
+
// This file is included by TensorBody.h, which defines the Tensor class.
|
| 14 |
+
#include <ATen/core/ATen_fwd.h>
|
| 15 |
+
|
| 16 |
+
namespace at {
|
| 17 |
+
|
| 18 |
+
namespace cuda {
|
| 19 |
+
|
| 20 |
+
TORCH_API ::std::tuple<at::Tensor,at::Tensor,at::Tensor> linalg_lu_factor_ex(const at::Tensor & A, bool pivot=true, bool check_errors=false);
|
| 21 |
+
TORCH_API ::std::tuple<at::Tensor &,at::Tensor &,at::Tensor &> linalg_lu_factor_ex_out(at::Tensor & LU, at::Tensor & pivots, at::Tensor & info, const at::Tensor & A, bool pivot=true, bool check_errors=false);
|
| 22 |
+
TORCH_API ::std::tuple<at::Tensor &,at::Tensor &,at::Tensor &> linalg_lu_factor_ex_outf(const at::Tensor & A, bool pivot, bool check_errors, at::Tensor & LU, at::Tensor & pivots, at::Tensor & info);
|
| 23 |
+
|
| 24 |
+
} // namespace cuda
|
| 25 |
+
} // namespace at
|
videollama2/lib/python3.10/site-packages/torch/include/ATen/ops/new_ones.h
ADDED
|
@@ -0,0 +1,97 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
#pragma once
|
| 2 |
+
|
| 3 |
+
// @generated by torchgen/gen.py from Function.h
|
| 4 |
+
|
| 5 |
+
#include <ATen/Context.h>
|
| 6 |
+
#include <ATen/DeviceGuard.h>
|
| 7 |
+
#include <ATen/TensorUtils.h>
|
| 8 |
+
#include <ATen/TracerMode.h>
|
| 9 |
+
#include <ATen/core/Generator.h>
|
| 10 |
+
#include <ATen/core/Reduction.h>
|
| 11 |
+
#include <ATen/core/Tensor.h>
|
| 12 |
+
#include <c10/core/Scalar.h>
|
| 13 |
+
#include <c10/core/Storage.h>
|
| 14 |
+
#include <c10/core/TensorOptions.h>
|
| 15 |
+
#include <c10/util/Deprecated.h>
|
| 16 |
+
#include <c10/util/Optional.h>
|
| 17 |
+
|
| 18 |
+
|
| 19 |
+
|
| 20 |
+
#include <ATen/ops/new_ones_ops.h>
|
| 21 |
+
|
| 22 |
+
namespace at {
|
| 23 |
+
|
| 24 |
+
|
| 25 |
+
namespace symint {
|
| 26 |
+
template <typename T, typename = std::enable_if_t<std::is_same<T, int64_t>::value>>
|
| 27 |
+
at::Tensor new_ones(const at::Tensor & self, at::IntArrayRef size, at::TensorOptions options={}) {
|
| 28 |
+
return at::_ops::new_ones::call(self, c10::fromIntArrayRefSlow(size), optTypeMetaToScalarType(options.dtype_opt()), options.layout_opt(), options.device_opt(), options.pinned_memory_opt());
|
| 29 |
+
}
|
| 30 |
+
}
|
| 31 |
+
|
| 32 |
+
namespace symint {
|
| 33 |
+
template <typename T, typename = std::enable_if_t<std::is_same<T, int64_t>::value>>
|
| 34 |
+
at::Tensor new_ones(const at::Tensor & self, at::IntArrayRef size, c10::optional<at::ScalarType> dtype, c10::optional<at::Layout> layout, c10::optional<at::Device> device, c10::optional<bool> pin_memory) {
|
| 35 |
+
return at::_ops::new_ones::call(self, c10::fromIntArrayRefSlow(size), dtype, layout, device, pin_memory);
|
| 36 |
+
}
|
| 37 |
+
}
|
| 38 |
+
|
| 39 |
+
namespace symint {
|
| 40 |
+
template <typename T, typename = std::enable_if_t<std::is_same<T, c10::SymInt>::value>>
|
| 41 |
+
at::Tensor new_ones(const at::Tensor & self, c10::SymIntArrayRef size, at::TensorOptions options={}) {
|
| 42 |
+
return at::_ops::new_ones::call(self, size, optTypeMetaToScalarType(options.dtype_opt()), options.layout_opt(), options.device_opt(), options.pinned_memory_opt());
|
| 43 |
+
}
|
| 44 |
+
}
|
| 45 |
+
|
| 46 |
+
namespace symint {
|
| 47 |
+
template <typename T, typename = std::enable_if_t<std::is_same<T, c10::SymInt>::value>>
|
| 48 |
+
at::Tensor new_ones(const at::Tensor & self, c10::SymIntArrayRef size, c10::optional<at::ScalarType> dtype, c10::optional<at::Layout> layout, c10::optional<at::Device> device, c10::optional<bool> pin_memory) {
|
| 49 |
+
return at::_ops::new_ones::call(self, size, dtype, layout, device, pin_memory);
|
| 50 |
+
}
|
| 51 |
+
}
|
| 52 |
+
|
| 53 |
+
// aten::new_ones.out(Tensor self, SymInt[] size, *, Tensor(a!) out) -> Tensor(a!)
|
| 54 |
+
inline at::Tensor & new_ones_out(at::Tensor & out, const at::Tensor & self, at::IntArrayRef size) {
|
| 55 |
+
return at::_ops::new_ones_out::call(self, c10::fromIntArrayRefSlow(size), out);
|
| 56 |
+
}
|
| 57 |
+
namespace symint {
|
| 58 |
+
template <typename T, typename = std::enable_if_t<std::is_same<T, int64_t>::value>>
|
| 59 |
+
at::Tensor & new_ones_out(at::Tensor & out, const at::Tensor & self, at::IntArrayRef size) {
|
| 60 |
+
return at::_ops::new_ones_out::call(self, c10::fromIntArrayRefSlow(size), out);
|
| 61 |
+
}
|
| 62 |
+
}
|
| 63 |
+
|
| 64 |
+
// aten::new_ones.out(Tensor self, SymInt[] size, *, Tensor(a!) out) -> Tensor(a!)
|
| 65 |
+
inline at::Tensor & new_ones_outf(const at::Tensor & self, at::IntArrayRef size, at::Tensor & out) {
|
| 66 |
+
return at::_ops::new_ones_out::call(self, c10::fromIntArrayRefSlow(size), out);
|
| 67 |
+
}
|
| 68 |
+
namespace symint {
|
| 69 |
+
template <typename T, typename = std::enable_if_t<std::is_same<T, int64_t>::value>>
|
| 70 |
+
at::Tensor & new_ones_outf(const at::Tensor & self, at::IntArrayRef size, at::Tensor & out) {
|
| 71 |
+
return at::_ops::new_ones_out::call(self, c10::fromIntArrayRefSlow(size), out);
|
| 72 |
+
}
|
| 73 |
+
}
|
| 74 |
+
|
| 75 |
+
// aten::new_ones.out(Tensor self, SymInt[] size, *, Tensor(a!) out) -> Tensor(a!)
|
| 76 |
+
inline at::Tensor & new_ones_symint_out(at::Tensor & out, const at::Tensor & self, c10::SymIntArrayRef size) {
|
| 77 |
+
return at::_ops::new_ones_out::call(self, size, out);
|
| 78 |
+
}
|
| 79 |
+
namespace symint {
|
| 80 |
+
template <typename T, typename = std::enable_if_t<std::is_same<T, c10::SymInt>::value>>
|
| 81 |
+
at::Tensor & new_ones_out(at::Tensor & out, const at::Tensor & self, c10::SymIntArrayRef size) {
|
| 82 |
+
return at::_ops::new_ones_out::call(self, size, out);
|
| 83 |
+
}
|
| 84 |
+
}
|
| 85 |
+
|
| 86 |
+
// aten::new_ones.out(Tensor self, SymInt[] size, *, Tensor(a!) out) -> Tensor(a!)
|
| 87 |
+
inline at::Tensor & new_ones_symint_outf(const at::Tensor & self, c10::SymIntArrayRef size, at::Tensor & out) {
|
| 88 |
+
return at::_ops::new_ones_out::call(self, size, out);
|
| 89 |
+
}
|
| 90 |
+
namespace symint {
|
| 91 |
+
template <typename T, typename = std::enable_if_t<std::is_same<T, c10::SymInt>::value>>
|
| 92 |
+
at::Tensor & new_ones_outf(const at::Tensor & self, c10::SymIntArrayRef size, at::Tensor & out) {
|
| 93 |
+
return at::_ops::new_ones_out::call(self, size, out);
|
| 94 |
+
}
|
| 95 |
+
}
|
| 96 |
+
|
| 97 |
+
}
|
videollama2/lib/python3.10/site-packages/torch/include/ATen/ops/pairwise_distance_ops.h
ADDED
|
@@ -0,0 +1,28 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
#pragma once
|
| 2 |
+
|
| 3 |
+
// @generated by torchgen/gen.py from Operator.h
|
| 4 |
+
|
| 5 |
+
#include <tuple>
|
| 6 |
+
#include <vector>
|
| 7 |
+
|
| 8 |
+
// Forward declarations of any types needed in the operator signatures.
|
| 9 |
+
// We can't directly include these classes because it will cause circular include dependencies.
|
| 10 |
+
// This file is included by TensorBody.h, which defines the Tensor class.
|
| 11 |
+
#include <ATen/core/ATen_fwd.h>
|
| 12 |
+
|
| 13 |
+
namespace at {
|
| 14 |
+
namespace _ops {
|
| 15 |
+
|
| 16 |
+
|
| 17 |
+
struct TORCH_API pairwise_distance {
|
| 18 |
+
using schema = at::Tensor (const at::Tensor &, const at::Tensor &, double, double, bool);
|
| 19 |
+
using ptr_schema = schema*;
|
| 20 |
+
// See Note [static constexpr char* members for windows NVCC]
|
| 21 |
+
STATIC_CONSTEXPR_STR_INL_EXCEPT_WIN_CUDA(name, "aten::pairwise_distance")
|
| 22 |
+
STATIC_CONSTEXPR_STR_INL_EXCEPT_WIN_CUDA(overload_name, "")
|
| 23 |
+
STATIC_CONSTEXPR_STR_INL_EXCEPT_WIN_CUDA(schema_str, "pairwise_distance(Tensor x1, Tensor x2, float p=2, float eps=1e-06, bool keepdim=False) -> Tensor")
|
| 24 |
+
static at::Tensor call(const at::Tensor & x1, const at::Tensor & x2, double p, double eps, bool keepdim);
|
| 25 |
+
static at::Tensor redispatch(c10::DispatchKeySet dispatchKeySet, const at::Tensor & x1, const at::Tensor & x2, double p, double eps, bool keepdim);
|
| 26 |
+
};
|
| 27 |
+
|
| 28 |
+
}} // namespace at::_ops
|
videollama2/lib/python3.10/site-packages/torch/include/ATen/ops/pinverse.h
ADDED
|
@@ -0,0 +1,30 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
#pragma once
|
| 2 |
+
|
| 3 |
+
// @generated by torchgen/gen.py from Function.h
|
| 4 |
+
|
| 5 |
+
#include <ATen/Context.h>
|
| 6 |
+
#include <ATen/DeviceGuard.h>
|
| 7 |
+
#include <ATen/TensorUtils.h>
|
| 8 |
+
#include <ATen/TracerMode.h>
|
| 9 |
+
#include <ATen/core/Generator.h>
|
| 10 |
+
#include <ATen/core/Reduction.h>
|
| 11 |
+
#include <ATen/core/Tensor.h>
|
| 12 |
+
#include <c10/core/Scalar.h>
|
| 13 |
+
#include <c10/core/Storage.h>
|
| 14 |
+
#include <c10/core/TensorOptions.h>
|
| 15 |
+
#include <c10/util/Deprecated.h>
|
| 16 |
+
#include <c10/util/Optional.h>
|
| 17 |
+
|
| 18 |
+
|
| 19 |
+
|
| 20 |
+
#include <ATen/ops/pinverse_ops.h>
|
| 21 |
+
|
| 22 |
+
namespace at {
|
| 23 |
+
|
| 24 |
+
|
| 25 |
+
// aten::pinverse(Tensor self, float rcond=1e-15) -> Tensor
|
| 26 |
+
inline at::Tensor pinverse(const at::Tensor & self, double rcond=1e-15) {
|
| 27 |
+
return at::_ops::pinverse::call(self, rcond);
|
| 28 |
+
}
|
| 29 |
+
|
| 30 |
+
}
|
videollama2/lib/python3.10/site-packages/torch/include/ATen/ops/to_sparse_native.h
ADDED
|
@@ -0,0 +1,22 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
#pragma once
|
| 2 |
+
|
| 3 |
+
// @generated by torchgen/gen.py from NativeFunction.h
|
| 4 |
+
|
| 5 |
+
#include <c10/core/Scalar.h>
|
| 6 |
+
#include <c10/core/Storage.h>
|
| 7 |
+
#include <c10/core/TensorOptions.h>
|
| 8 |
+
#include <c10/util/Deprecated.h>
|
| 9 |
+
#include <c10/util/Optional.h>
|
| 10 |
+
#include <c10/core/QScheme.h>
|
| 11 |
+
#include <ATen/core/Reduction.h>
|
| 12 |
+
#include <ATen/core/Tensor.h>
|
| 13 |
+
#include <tuple>
|
| 14 |
+
#include <vector>
|
| 15 |
+
|
| 16 |
+
|
| 17 |
+
namespace at {
|
| 18 |
+
namespace native {
|
| 19 |
+
TORCH_API at::Tensor to_sparse(const at::Tensor & self, int64_t sparse_dim);
|
| 20 |
+
TORCH_API at::Tensor to_sparse(const at::Tensor & self, c10::optional<at::Layout> layout=c10::nullopt, at::OptionalIntArrayRef blocksize=c10::nullopt, c10::optional<int64_t> dense_dim=c10::nullopt);
|
| 21 |
+
} // namespace native
|
| 22 |
+
} // namespace at
|
videollama2/lib/python3.10/site-packages/torch/include/ATen/ops/unflatten_dense_tensors.h
ADDED
|
@@ -0,0 +1,30 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
#pragma once
|
| 2 |
+
|
| 3 |
+
// @generated by torchgen/gen.py from Function.h
|
| 4 |
+
|
| 5 |
+
#include <ATen/Context.h>
|
| 6 |
+
#include <ATen/DeviceGuard.h>
|
| 7 |
+
#include <ATen/TensorUtils.h>
|
| 8 |
+
#include <ATen/TracerMode.h>
|
| 9 |
+
#include <ATen/core/Generator.h>
|
| 10 |
+
#include <ATen/core/Reduction.h>
|
| 11 |
+
#include <ATen/core/Tensor.h>
|
| 12 |
+
#include <c10/core/Scalar.h>
|
| 13 |
+
#include <c10/core/Storage.h>
|
| 14 |
+
#include <c10/core/TensorOptions.h>
|
| 15 |
+
#include <c10/util/Deprecated.h>
|
| 16 |
+
#include <c10/util/Optional.h>
|
| 17 |
+
|
| 18 |
+
|
| 19 |
+
|
| 20 |
+
#include <ATen/ops/unflatten_dense_tensors_ops.h>
|
| 21 |
+
|
| 22 |
+
namespace at {
|
| 23 |
+
|
| 24 |
+
|
| 25 |
+
// aten::unflatten_dense_tensors(Tensor flat, Tensor[] tensors) -> Tensor[]
|
| 26 |
+
inline ::std::vector<at::Tensor> unflatten_dense_tensors(const at::Tensor & flat, at::TensorList tensors) {
|
| 27 |
+
return at::_ops::unflatten_dense_tensors::call(flat, tensors);
|
| 28 |
+
}
|
| 29 |
+
|
| 30 |
+
}
|
videollama2/lib/python3.10/site-packages/torch/include/ATen/ops/upsample_nearest1d_ops.h
ADDED
|
@@ -0,0 +1,50 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
#pragma once
|
| 2 |
+
|
| 3 |
+
// @generated by torchgen/gen.py from Operator.h
|
| 4 |
+
|
| 5 |
+
#include <tuple>
|
| 6 |
+
#include <vector>
|
| 7 |
+
|
| 8 |
+
// Forward declarations of any types needed in the operator signatures.
|
| 9 |
+
// We can't directly include these classes because it will cause circular include dependencies.
|
| 10 |
+
// This file is included by TensorBody.h, which defines the Tensor class.
|
| 11 |
+
#include <ATen/core/ATen_fwd.h>
|
| 12 |
+
|
| 13 |
+
namespace at {
|
| 14 |
+
namespace _ops {
|
| 15 |
+
|
| 16 |
+
|
| 17 |
+
struct TORCH_API upsample_nearest1d_vec {
|
| 18 |
+
using schema = at::Tensor (const at::Tensor &, at::OptionalSymIntArrayRef, c10::optional<at::ArrayRef<double>>);
|
| 19 |
+
using ptr_schema = schema*;
|
| 20 |
+
// See Note [static constexpr char* members for windows NVCC]
|
| 21 |
+
STATIC_CONSTEXPR_STR_INL_EXCEPT_WIN_CUDA(name, "aten::upsample_nearest1d")
|
| 22 |
+
STATIC_CONSTEXPR_STR_INL_EXCEPT_WIN_CUDA(overload_name, "vec")
|
| 23 |
+
STATIC_CONSTEXPR_STR_INL_EXCEPT_WIN_CUDA(schema_str, "upsample_nearest1d.vec(Tensor input, SymInt[]? output_size, float[]? scale_factors) -> Tensor")
|
| 24 |
+
static at::Tensor call(const at::Tensor & input, at::OptionalSymIntArrayRef output_size, c10::optional<at::ArrayRef<double>> scale_factors);
|
| 25 |
+
static at::Tensor redispatch(c10::DispatchKeySet dispatchKeySet, const at::Tensor & input, at::OptionalSymIntArrayRef output_size, c10::optional<at::ArrayRef<double>> scale_factors);
|
| 26 |
+
};
|
| 27 |
+
|
| 28 |
+
struct TORCH_API upsample_nearest1d_out {
|
| 29 |
+
using schema = at::Tensor & (const at::Tensor &, c10::SymIntArrayRef, c10::optional<double>, at::Tensor &);
|
| 30 |
+
using ptr_schema = schema*;
|
| 31 |
+
// See Note [static constexpr char* members for windows NVCC]
|
| 32 |
+
STATIC_CONSTEXPR_STR_INL_EXCEPT_WIN_CUDA(name, "aten::upsample_nearest1d")
|
| 33 |
+
STATIC_CONSTEXPR_STR_INL_EXCEPT_WIN_CUDA(overload_name, "out")
|
| 34 |
+
STATIC_CONSTEXPR_STR_INL_EXCEPT_WIN_CUDA(schema_str, "upsample_nearest1d.out(Tensor self, SymInt[1] output_size, float? scales=None, *, Tensor(a!) out) -> Tensor(a!)")
|
| 35 |
+
static at::Tensor & call(const at::Tensor & self, c10::SymIntArrayRef output_size, c10::optional<double> scales, at::Tensor & out);
|
| 36 |
+
static at::Tensor & redispatch(c10::DispatchKeySet dispatchKeySet, const at::Tensor & self, c10::SymIntArrayRef output_size, c10::optional<double> scales, at::Tensor & out);
|
| 37 |
+
};
|
| 38 |
+
|
| 39 |
+
struct TORCH_API upsample_nearest1d {
|
| 40 |
+
using schema = at::Tensor (const at::Tensor &, c10::SymIntArrayRef, c10::optional<double>);
|
| 41 |
+
using ptr_schema = schema*;
|
| 42 |
+
// See Note [static constexpr char* members for windows NVCC]
|
| 43 |
+
STATIC_CONSTEXPR_STR_INL_EXCEPT_WIN_CUDA(name, "aten::upsample_nearest1d")
|
| 44 |
+
STATIC_CONSTEXPR_STR_INL_EXCEPT_WIN_CUDA(overload_name, "")
|
| 45 |
+
STATIC_CONSTEXPR_STR_INL_EXCEPT_WIN_CUDA(schema_str, "upsample_nearest1d(Tensor self, SymInt[1] output_size, float? scales=None) -> Tensor")
|
| 46 |
+
static at::Tensor call(const at::Tensor & self, c10::SymIntArrayRef output_size, c10::optional<double> scales);
|
| 47 |
+
static at::Tensor redispatch(c10::DispatchKeySet dispatchKeySet, const at::Tensor & self, c10::SymIntArrayRef output_size, c10::optional<double> scales);
|
| 48 |
+
};
|
| 49 |
+
|
| 50 |
+
}} // namespace at::_ops
|
vllm/lib/python3.10/site-packages/wandb/vendor/graphql-core-1.1/__pycache__/setup.cpython-310.pyc
ADDED
|
Binary file (2.42 kB). View file
|
|
|
vllm/lib/python3.10/site-packages/wandb/vendor/graphql-core-1.1/wandb_graphql/error/__pycache__/__init__.cpython-310.pyc
ADDED
|
Binary file (428 Bytes). View file
|
|
|
vllm/lib/python3.10/site-packages/wandb/vendor/graphql-core-1.1/wandb_graphql/error/__pycache__/base.cpython-310.pyc
ADDED
|
Binary file (1.89 kB). View file
|
|
|
vllm/lib/python3.10/site-packages/wandb/vendor/graphql-core-1.1/wandb_graphql/error/__pycache__/format_error.cpython-310.pyc
ADDED
|
Binary file (573 Bytes). View file
|
|
|
vllm/lib/python3.10/site-packages/wandb/vendor/graphql-core-1.1/wandb_graphql/error/__pycache__/located_error.cpython-310.pyc
ADDED
|
Binary file (944 Bytes). View file
|
|
|
vllm/lib/python3.10/site-packages/wandb/vendor/graphql-core-1.1/wandb_graphql/error/base.py
ADDED
|
@@ -0,0 +1,42 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
from ..language.location import get_location
|
| 2 |
+
|
| 3 |
+
|
| 4 |
+
class GraphQLError(Exception):
|
| 5 |
+
__slots__ = 'message', 'nodes', 'stack', 'original_error', '_source', '_positions'
|
| 6 |
+
|
| 7 |
+
def __init__(self, message, nodes=None, stack=None, source=None, positions=None):
|
| 8 |
+
super(GraphQLError, self).__init__(message)
|
| 9 |
+
self.message = message
|
| 10 |
+
self.nodes = nodes
|
| 11 |
+
self.stack = stack
|
| 12 |
+
self._source = source
|
| 13 |
+
self._positions = positions
|
| 14 |
+
|
| 15 |
+
@property
|
| 16 |
+
def source(self):
|
| 17 |
+
if self._source:
|
| 18 |
+
return self._source
|
| 19 |
+
if self.nodes:
|
| 20 |
+
node = self.nodes[0]
|
| 21 |
+
return node and node.loc and node.loc.source
|
| 22 |
+
|
| 23 |
+
@property
|
| 24 |
+
def positions(self):
|
| 25 |
+
if self._positions:
|
| 26 |
+
return self._positions
|
| 27 |
+
if self.nodes is not None:
|
| 28 |
+
node_positions = [node.loc and node.loc.start for node in self.nodes]
|
| 29 |
+
if any(node_positions):
|
| 30 |
+
return node_positions
|
| 31 |
+
|
| 32 |
+
def reraise(self):
|
| 33 |
+
if self.stack:
|
| 34 |
+
raise self.with_traceback(self.stack)
|
| 35 |
+
else:
|
| 36 |
+
raise self
|
| 37 |
+
|
| 38 |
+
@property
|
| 39 |
+
def locations(self):
|
| 40 |
+
source = self.source
|
| 41 |
+
if self.positions and source:
|
| 42 |
+
return [get_location(source, pos) for pos in self.positions]
|
vllm/lib/python3.10/site-packages/wandb/vendor/graphql-core-1.1/wandb_graphql/type/__init__.py
ADDED
|
@@ -0,0 +1,67 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
# flake8: noqa
|
| 2 |
+
from .definition import ( # no import order
|
| 3 |
+
GraphQLScalarType,
|
| 4 |
+
GraphQLObjectType,
|
| 5 |
+
GraphQLField,
|
| 6 |
+
GraphQLArgument,
|
| 7 |
+
GraphQLInterfaceType,
|
| 8 |
+
GraphQLUnionType,
|
| 9 |
+
GraphQLEnumType,
|
| 10 |
+
GraphQLEnumValue,
|
| 11 |
+
GraphQLInputObjectType,
|
| 12 |
+
GraphQLInputObjectField,
|
| 13 |
+
GraphQLList,
|
| 14 |
+
GraphQLNonNull,
|
| 15 |
+
get_named_type,
|
| 16 |
+
is_abstract_type,
|
| 17 |
+
is_composite_type,
|
| 18 |
+
is_input_type,
|
| 19 |
+
is_leaf_type,
|
| 20 |
+
is_type,
|
| 21 |
+
get_nullable_type,
|
| 22 |
+
is_output_type
|
| 23 |
+
)
|
| 24 |
+
from .directives import (
|
| 25 |
+
# "Enum" of Directive locations
|
| 26 |
+
DirectiveLocation,
|
| 27 |
+
|
| 28 |
+
# Directive definition
|
| 29 |
+
GraphQLDirective,
|
| 30 |
+
|
| 31 |
+
# Built-in directives defined by the Spec
|
| 32 |
+
specified_directives,
|
| 33 |
+
GraphQLSkipDirective,
|
| 34 |
+
GraphQLIncludeDirective,
|
| 35 |
+
GraphQLDeprecatedDirective,
|
| 36 |
+
|
| 37 |
+
# Constant Deprecation Reason
|
| 38 |
+
DEFAULT_DEPRECATION_REASON,
|
| 39 |
+
)
|
| 40 |
+
from .scalars import ( # no import order
|
| 41 |
+
GraphQLInt,
|
| 42 |
+
GraphQLFloat,
|
| 43 |
+
GraphQLString,
|
| 44 |
+
GraphQLBoolean,
|
| 45 |
+
GraphQLID,
|
| 46 |
+
)
|
| 47 |
+
from .schema import GraphQLSchema
|
| 48 |
+
|
| 49 |
+
from .introspection import (
|
| 50 |
+
# "Enum" of Type Kinds
|
| 51 |
+
TypeKind,
|
| 52 |
+
|
| 53 |
+
# GraphQL Types for introspection.
|
| 54 |
+
__Schema,
|
| 55 |
+
__Directive,
|
| 56 |
+
__DirectiveLocation,
|
| 57 |
+
__Type,
|
| 58 |
+
__Field,
|
| 59 |
+
__InputValue,
|
| 60 |
+
__EnumValue,
|
| 61 |
+
__TypeKind,
|
| 62 |
+
|
| 63 |
+
# Meta-field definitions.
|
| 64 |
+
SchemaMetaFieldDef,
|
| 65 |
+
TypeMetaFieldDef,
|
| 66 |
+
TypeNameMetaFieldDef
|
| 67 |
+
)
|
vllm/lib/python3.10/site-packages/wandb/vendor/graphql-core-1.1/wandb_graphql/type/__pycache__/__init__.cpython-310.pyc
ADDED
|
Binary file (1.48 kB). View file
|
|
|
vllm/lib/python3.10/site-packages/wandb/vendor/graphql-core-1.1/wandb_graphql/type/__pycache__/definition.cpython-310.pyc
ADDED
|
Binary file (18.6 kB). View file
|
|
|
vllm/lib/python3.10/site-packages/wandb/vendor/graphql-core-1.1/wandb_graphql/type/__pycache__/directives.cpython-310.pyc
ADDED
|
Binary file (3.06 kB). View file
|
|
|
vllm/lib/python3.10/site-packages/wandb/vendor/graphql-core-1.1/wandb_graphql/type/__pycache__/introspection.cpython-310.pyc
ADDED
|
Binary file (12.9 kB). View file
|
|
|
vllm/lib/python3.10/site-packages/wandb/vendor/graphql-core-1.1/wandb_graphql/type/__pycache__/scalars.cpython-310.pyc
ADDED
|
Binary file (3.35 kB). View file
|
|
|
vllm/lib/python3.10/site-packages/wandb/vendor/graphql-core-1.1/wandb_graphql/type/__pycache__/schema.cpython-310.pyc
ADDED
|
Binary file (4.02 kB). View file
|
|
|
vllm/lib/python3.10/site-packages/wandb/vendor/graphql-core-1.1/wandb_graphql/type/__pycache__/typemap.cpython-310.pyc
ADDED
|
Binary file (4.67 kB). View file
|
|
|
vllm/lib/python3.10/site-packages/wandb/vendor/graphql-core-1.1/wandb_graphql/type/definition.py
ADDED
|
@@ -0,0 +1,619 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
from collections.abc import Mapping, Hashable
|
| 2 |
+
import collections
|
| 3 |
+
import copy
|
| 4 |
+
|
| 5 |
+
from ..language import ast
|
| 6 |
+
from ..pyutils.cached_property import cached_property
|
| 7 |
+
from ..pyutils.ordereddict import OrderedDict
|
| 8 |
+
from ..utils.assert_valid_name import assert_valid_name
|
| 9 |
+
|
| 10 |
+
|
| 11 |
+
def is_type(type):
|
| 12 |
+
return isinstance(type, (
|
| 13 |
+
GraphQLScalarType,
|
| 14 |
+
GraphQLObjectType,
|
| 15 |
+
GraphQLInterfaceType,
|
| 16 |
+
GraphQLUnionType,
|
| 17 |
+
GraphQLEnumType,
|
| 18 |
+
GraphQLInputObjectType,
|
| 19 |
+
GraphQLList,
|
| 20 |
+
GraphQLNonNull
|
| 21 |
+
))
|
| 22 |
+
|
| 23 |
+
|
| 24 |
+
def is_input_type(type):
|
| 25 |
+
named_type = get_named_type(type)
|
| 26 |
+
return isinstance(named_type, (
|
| 27 |
+
GraphQLScalarType,
|
| 28 |
+
GraphQLEnumType,
|
| 29 |
+
GraphQLInputObjectType,
|
| 30 |
+
))
|
| 31 |
+
|
| 32 |
+
|
| 33 |
+
def is_output_type(type):
|
| 34 |
+
named_type = get_named_type(type)
|
| 35 |
+
return isinstance(named_type, (
|
| 36 |
+
GraphQLScalarType,
|
| 37 |
+
GraphQLObjectType,
|
| 38 |
+
GraphQLInterfaceType,
|
| 39 |
+
GraphQLUnionType,
|
| 40 |
+
GraphQLEnumType
|
| 41 |
+
))
|
| 42 |
+
|
| 43 |
+
|
| 44 |
+
def is_leaf_type(type):
|
| 45 |
+
return isinstance(type, (
|
| 46 |
+
GraphQLScalarType,
|
| 47 |
+
GraphQLEnumType,
|
| 48 |
+
))
|
| 49 |
+
|
| 50 |
+
|
| 51 |
+
def is_composite_type(type):
|
| 52 |
+
named_type = get_named_type(type)
|
| 53 |
+
return isinstance(named_type, (
|
| 54 |
+
GraphQLObjectType,
|
| 55 |
+
GraphQLInterfaceType,
|
| 56 |
+
GraphQLUnionType,
|
| 57 |
+
))
|
| 58 |
+
|
| 59 |
+
|
| 60 |
+
def is_abstract_type(type):
|
| 61 |
+
return isinstance(type, (
|
| 62 |
+
GraphQLInterfaceType,
|
| 63 |
+
GraphQLUnionType
|
| 64 |
+
))
|
| 65 |
+
|
| 66 |
+
|
| 67 |
+
def get_nullable_type(type):
|
| 68 |
+
if isinstance(type, GraphQLNonNull):
|
| 69 |
+
return type.of_type
|
| 70 |
+
return type
|
| 71 |
+
|
| 72 |
+
|
| 73 |
+
def get_named_type(type):
|
| 74 |
+
unmodified_type = type
|
| 75 |
+
while isinstance(unmodified_type, (GraphQLList, GraphQLNonNull)):
|
| 76 |
+
unmodified_type = unmodified_type.of_type
|
| 77 |
+
|
| 78 |
+
return unmodified_type
|
| 79 |
+
|
| 80 |
+
|
| 81 |
+
class GraphQLType(object):
|
| 82 |
+
__slots__ = 'name',
|
| 83 |
+
|
| 84 |
+
def __str__(self):
|
| 85 |
+
return self.name
|
| 86 |
+
|
| 87 |
+
def is_same_type(self, other):
|
| 88 |
+
return self.__class__ is other.__class__ and self.name == other.name
|
| 89 |
+
|
| 90 |
+
|
| 91 |
+
def none_func(x):
|
| 92 |
+
None
|
| 93 |
+
|
| 94 |
+
|
| 95 |
+
class GraphQLScalarType(GraphQLType):
|
| 96 |
+
"""Scalar Type Definition
|
| 97 |
+
|
| 98 |
+
The leaf values of any request and input values to arguments are
|
| 99 |
+
Scalars (or Enums) and are defined with a name and a series of coercion
|
| 100 |
+
functions used to ensure validity.
|
| 101 |
+
|
| 102 |
+
Example:
|
| 103 |
+
|
| 104 |
+
def coerce_odd(value):
|
| 105 |
+
if value % 2 == 1:
|
| 106 |
+
return value
|
| 107 |
+
return None
|
| 108 |
+
|
| 109 |
+
OddType = GraphQLScalarType(name='Odd', serialize=coerce_odd)
|
| 110 |
+
"""
|
| 111 |
+
|
| 112 |
+
__slots__ = 'name', 'description', 'serialize', 'parse_value', 'parse_literal'
|
| 113 |
+
|
| 114 |
+
def __init__(self, name, description=None, serialize=None, parse_value=None, parse_literal=None):
|
| 115 |
+
assert name, 'Type must be named.'
|
| 116 |
+
assert_valid_name(name)
|
| 117 |
+
self.name = name
|
| 118 |
+
self.description = description
|
| 119 |
+
|
| 120 |
+
assert callable(serialize), (
|
| 121 |
+
'{} must provide "serialize" function. If this custom Scalar is '
|
| 122 |
+
'also used as an input type, ensure "parse_value" and "parse_literal" '
|
| 123 |
+
'functions are also provided.'
|
| 124 |
+
).format(self)
|
| 125 |
+
|
| 126 |
+
if parse_value is not None or parse_literal is not None:
|
| 127 |
+
assert callable(parse_value) and callable(parse_literal), (
|
| 128 |
+
'{} must provide both "parse_value" and "parse_literal" functions.'.format(self)
|
| 129 |
+
)
|
| 130 |
+
|
| 131 |
+
self.serialize = serialize
|
| 132 |
+
self.parse_value = parse_value or none_func
|
| 133 |
+
self.parse_literal = parse_literal or none_func
|
| 134 |
+
|
| 135 |
+
def __str__(self):
|
| 136 |
+
return self.name
|
| 137 |
+
|
| 138 |
+
|
| 139 |
+
class GraphQLObjectType(GraphQLType):
|
| 140 |
+
"""Object Type Definition
|
| 141 |
+
|
| 142 |
+
Almost all of the GraphQL types you define will be object types.
|
| 143 |
+
Object types have a name, but most importantly describe their fields.
|
| 144 |
+
|
| 145 |
+
Example:
|
| 146 |
+
|
| 147 |
+
AddressType = GraphQLObjectType('Address', {
|
| 148 |
+
'street': GraphQLField(GraphQLString),
|
| 149 |
+
'number': GraphQLField(GraphQLInt),
|
| 150 |
+
'formatted': GraphQLField(GraphQLString,
|
| 151 |
+
resolver=lambda obj, args, context, info: obj.number + ' ' + obj.street),
|
| 152 |
+
})
|
| 153 |
+
|
| 154 |
+
When two types need to refer to each other, or a type needs to refer to
|
| 155 |
+
itself in a field, you can use a static method to supply the fields
|
| 156 |
+
lazily.
|
| 157 |
+
|
| 158 |
+
Example:
|
| 159 |
+
|
| 160 |
+
PersonType = GraphQLObjectType('Person', lambda: {
|
| 161 |
+
'name': GraphQLField(GraphQLString),
|
| 162 |
+
'bestFriend': GraphQLField(PersonType)
|
| 163 |
+
})
|
| 164 |
+
"""
|
| 165 |
+
def __init__(self, name, fields, interfaces=None, is_type_of=None, description=None):
|
| 166 |
+
assert name, 'Type must be named.'
|
| 167 |
+
assert_valid_name(name)
|
| 168 |
+
self.name = name
|
| 169 |
+
self.description = description
|
| 170 |
+
|
| 171 |
+
if is_type_of is not None:
|
| 172 |
+
assert callable(is_type_of), '{} must provide "is_type_of" as a function.'.format(self)
|
| 173 |
+
|
| 174 |
+
self.is_type_of = is_type_of
|
| 175 |
+
self._fields = fields
|
| 176 |
+
self._provided_interfaces = interfaces
|
| 177 |
+
self._interfaces = None
|
| 178 |
+
|
| 179 |
+
@cached_property
|
| 180 |
+
def fields(self):
|
| 181 |
+
return define_field_map(self, self._fields)
|
| 182 |
+
|
| 183 |
+
@cached_property
|
| 184 |
+
def interfaces(self):
|
| 185 |
+
return define_interfaces(self, self._provided_interfaces)
|
| 186 |
+
|
| 187 |
+
|
| 188 |
+
def define_field_map(type, field_map):
|
| 189 |
+
if callable(field_map):
|
| 190 |
+
field_map = field_map()
|
| 191 |
+
|
| 192 |
+
assert isinstance(field_map, Mapping) and len(field_map) > 0, (
|
| 193 |
+
'{} fields must be a mapping (dict / OrderedDict) with field names as keys or a '
|
| 194 |
+
'function which returns such a mapping.'
|
| 195 |
+
).format(type)
|
| 196 |
+
|
| 197 |
+
for field_name, field in field_map.items():
|
| 198 |
+
assert_valid_name(field_name)
|
| 199 |
+
field_args = getattr(field, 'args', None)
|
| 200 |
+
|
| 201 |
+
if field_args:
|
| 202 |
+
assert isinstance(field_args, Mapping), (
|
| 203 |
+
'{}.{} args must be a mapping (dict / OrderedDict) with argument names as keys.'.format(type,
|
| 204 |
+
field_name)
|
| 205 |
+
)
|
| 206 |
+
|
| 207 |
+
for arg_name, arg in field_args.items():
|
| 208 |
+
assert_valid_name(arg_name)
|
| 209 |
+
|
| 210 |
+
return OrderedDict(field_map)
|
| 211 |
+
|
| 212 |
+
|
| 213 |
+
def define_interfaces(type, interfaces):
|
| 214 |
+
if callable(interfaces):
|
| 215 |
+
interfaces = interfaces()
|
| 216 |
+
|
| 217 |
+
if interfaces is None:
|
| 218 |
+
interfaces = []
|
| 219 |
+
|
| 220 |
+
assert isinstance(interfaces, (list, tuple)), (
|
| 221 |
+
'{} interfaces must be a list/tuple or a function which returns a list/tuple.'.format(type)
|
| 222 |
+
)
|
| 223 |
+
|
| 224 |
+
for interface in interfaces:
|
| 225 |
+
assert isinstance(interface, GraphQLInterfaceType), (
|
| 226 |
+
'{} may only implement Interface types, it cannot implement: {}.'.format(type, interface)
|
| 227 |
+
)
|
| 228 |
+
|
| 229 |
+
if not callable(interface.resolve_type):
|
| 230 |
+
assert callable(type.is_type_of), (
|
| 231 |
+
'Interface Type {} does not provide a "resolve_type" function '
|
| 232 |
+
'and implementing Type {} does not provide a "is_type_of" '
|
| 233 |
+
'function. There is no way to resolve this implementing type '
|
| 234 |
+
'during execution.'
|
| 235 |
+
).format(interface, type)
|
| 236 |
+
|
| 237 |
+
return interfaces
|
| 238 |
+
|
| 239 |
+
|
| 240 |
+
class GraphQLField(object):
|
| 241 |
+
__slots__ = 'type', 'args', 'resolver', 'deprecation_reason', 'description'
|
| 242 |
+
|
| 243 |
+
def __init__(self, type, args=None, resolver=None, deprecation_reason=None, description=None):
|
| 244 |
+
self.type = type
|
| 245 |
+
self.args = args or OrderedDict()
|
| 246 |
+
self.resolver = resolver
|
| 247 |
+
self.deprecation_reason = deprecation_reason
|
| 248 |
+
self.description = description
|
| 249 |
+
|
| 250 |
+
def __eq__(self, other):
|
| 251 |
+
return (
|
| 252 |
+
self is other or (
|
| 253 |
+
isinstance(other, GraphQLField) and
|
| 254 |
+
self.type == other.type and
|
| 255 |
+
self.args == other.args and
|
| 256 |
+
self.resolver == other.resolver and
|
| 257 |
+
self.deprecation_reason == other.deprecation_reason and
|
| 258 |
+
self.description == other.description
|
| 259 |
+
)
|
| 260 |
+
)
|
| 261 |
+
|
| 262 |
+
def __hash__(self):
|
| 263 |
+
return id(self)
|
| 264 |
+
|
| 265 |
+
|
| 266 |
+
class GraphQLArgument(object):
|
| 267 |
+
__slots__ = 'type', 'default_value', 'description', 'out_name'
|
| 268 |
+
|
| 269 |
+
def __init__(self, type, default_value=None, description=None, out_name=None):
|
| 270 |
+
self.type = type
|
| 271 |
+
self.default_value = default_value
|
| 272 |
+
self.description = description
|
| 273 |
+
self.out_name = out_name
|
| 274 |
+
|
| 275 |
+
def __eq__(self, other):
|
| 276 |
+
return (
|
| 277 |
+
self is other or (
|
| 278 |
+
isinstance(other, GraphQLArgument) and
|
| 279 |
+
self.type == other.type and
|
| 280 |
+
self.default_value == other.default_value and
|
| 281 |
+
self.description == other.description and
|
| 282 |
+
self.out_name == other.out_name
|
| 283 |
+
)
|
| 284 |
+
)
|
| 285 |
+
|
| 286 |
+
def __hash__(self):
|
| 287 |
+
return id(self)
|
| 288 |
+
|
| 289 |
+
|
| 290 |
+
class GraphQLInterfaceType(GraphQLType):
|
| 291 |
+
"""Interface Type Definition
|
| 292 |
+
|
| 293 |
+
When a field can return one of a heterogeneous set of types, a Interface type is used to describe what types are possible,
|
| 294 |
+
what fields are in common across all types, as well as a function to determine which type is actually used when the field is resolved.
|
| 295 |
+
|
| 296 |
+
Example:
|
| 297 |
+
|
| 298 |
+
EntityType = GraphQLInterfaceType(
|
| 299 |
+
name='Entity',
|
| 300 |
+
fields={
|
| 301 |
+
'name': GraphQLField(GraphQLString),
|
| 302 |
+
})
|
| 303 |
+
"""
|
| 304 |
+
|
| 305 |
+
def __init__(self, name, fields=None, resolve_type=None, description=None):
|
| 306 |
+
assert name, 'Type must be named.'
|
| 307 |
+
assert_valid_name(name)
|
| 308 |
+
self.name = name
|
| 309 |
+
self.description = description
|
| 310 |
+
|
| 311 |
+
if resolve_type is not None:
|
| 312 |
+
assert callable(resolve_type), '{} must provide "resolve_type" as a function.'.format(self)
|
| 313 |
+
|
| 314 |
+
self.resolve_type = resolve_type
|
| 315 |
+
self._fields = fields
|
| 316 |
+
|
| 317 |
+
@cached_property
|
| 318 |
+
def fields(self):
|
| 319 |
+
return define_field_map(self, self._fields)
|
| 320 |
+
|
| 321 |
+
|
| 322 |
+
class GraphQLUnionType(GraphQLType):
|
| 323 |
+
"""Union Type Definition
|
| 324 |
+
|
| 325 |
+
When a field can return one of a heterogeneous set of types, a Union type is used to describe what types are possible
|
| 326 |
+
as well as providing a function to determine which type is actually used when the field is resolved.
|
| 327 |
+
|
| 328 |
+
Example:
|
| 329 |
+
|
| 330 |
+
class PetType(GraphQLUnionType):
|
| 331 |
+
name = 'Pet'
|
| 332 |
+
types = [DogType, CatType]
|
| 333 |
+
|
| 334 |
+
def resolve_type(self, value):
|
| 335 |
+
if isinstance(value, Dog):
|
| 336 |
+
return DogType()
|
| 337 |
+
if isinstance(value, Cat):
|
| 338 |
+
return CatType()
|
| 339 |
+
"""
|
| 340 |
+
|
| 341 |
+
def __init__(self, name, types=None, resolve_type=None, description=None):
|
| 342 |
+
assert name, 'Type must be named.'
|
| 343 |
+
assert_valid_name(name)
|
| 344 |
+
self.name = name
|
| 345 |
+
self.description = description
|
| 346 |
+
|
| 347 |
+
if resolve_type is not None:
|
| 348 |
+
assert callable(resolve_type), '{} must provide "resolve_type" as a function.'.format(self)
|
| 349 |
+
|
| 350 |
+
self.resolve_type = resolve_type
|
| 351 |
+
self._types = types
|
| 352 |
+
|
| 353 |
+
@cached_property
|
| 354 |
+
def types(self):
|
| 355 |
+
return define_types(self, self._types)
|
| 356 |
+
|
| 357 |
+
|
| 358 |
+
def define_types(union_type, types):
|
| 359 |
+
if callable(types):
|
| 360 |
+
types = types()
|
| 361 |
+
|
| 362 |
+
assert isinstance(types, (list, tuple)) and len(
|
| 363 |
+
types) > 0, 'Must provide types for Union {}.'.format(union_type.name)
|
| 364 |
+
has_resolve_type_fn = callable(union_type.resolve_type)
|
| 365 |
+
|
| 366 |
+
for type in types:
|
| 367 |
+
assert isinstance(type, GraphQLObjectType), (
|
| 368 |
+
'{} may only contain Object types, it cannot contain: {}.'.format(union_type, type)
|
| 369 |
+
)
|
| 370 |
+
|
| 371 |
+
if not has_resolve_type_fn:
|
| 372 |
+
assert callable(type.is_type_of), (
|
| 373 |
+
'Union Type {} does not provide a "resolve_type" function '
|
| 374 |
+
'and possible Type {} does not provide a "is_type_of" '
|
| 375 |
+
'function. There is no way to resolve this possible type '
|
| 376 |
+
'during execution.'
|
| 377 |
+
).format(union_type, type)
|
| 378 |
+
|
| 379 |
+
return types
|
| 380 |
+
|
| 381 |
+
|
| 382 |
+
class GraphQLEnumType(GraphQLType):
|
| 383 |
+
"""Enum Type Definition
|
| 384 |
+
|
| 385 |
+
Some leaf values of requests and input values are Enums. GraphQL serializes Enum values as strings,
|
| 386 |
+
however internally Enums can be represented by any kind of type, often integers.
|
| 387 |
+
|
| 388 |
+
Example:
|
| 389 |
+
|
| 390 |
+
RGBType = GraphQLEnumType(
|
| 391 |
+
name='RGB',
|
| 392 |
+
values=OrderedDict([
|
| 393 |
+
('RED', GraphQLEnumValue(0)),
|
| 394 |
+
('GREEN', GraphQLEnumValue(1)),
|
| 395 |
+
('BLUE', GraphQLEnumValue(2))
|
| 396 |
+
])
|
| 397 |
+
)
|
| 398 |
+
|
| 399 |
+
Note: If a value is not provided in a definition, the name of the enum value will be used as it's internal value.
|
| 400 |
+
"""
|
| 401 |
+
|
| 402 |
+
def __init__(self, name, values, description=None):
|
| 403 |
+
assert name, 'Type must provide name.'
|
| 404 |
+
assert_valid_name(name)
|
| 405 |
+
self.name = name
|
| 406 |
+
self.description = description
|
| 407 |
+
|
| 408 |
+
self.values = define_enum_values(self, values)
|
| 409 |
+
|
| 410 |
+
def serialize(self, value):
|
| 411 |
+
if isinstance(value, Hashable):
|
| 412 |
+
enum_value = self._value_lookup.get(value)
|
| 413 |
+
|
| 414 |
+
if enum_value:
|
| 415 |
+
return enum_value.name
|
| 416 |
+
|
| 417 |
+
return None
|
| 418 |
+
|
| 419 |
+
def parse_value(self, value):
|
| 420 |
+
if isinstance(value, Hashable):
|
| 421 |
+
enum_value = self._name_lookup.get(value)
|
| 422 |
+
|
| 423 |
+
if enum_value:
|
| 424 |
+
return enum_value.value
|
| 425 |
+
|
| 426 |
+
return None
|
| 427 |
+
|
| 428 |
+
def parse_literal(self, value_ast):
|
| 429 |
+
if isinstance(value_ast, ast.EnumValue):
|
| 430 |
+
enum_value = self._name_lookup.get(value_ast.value)
|
| 431 |
+
|
| 432 |
+
if enum_value:
|
| 433 |
+
return enum_value.value
|
| 434 |
+
|
| 435 |
+
@cached_property
|
| 436 |
+
def _value_lookup(self):
|
| 437 |
+
return {value.value: value for value in self.values}
|
| 438 |
+
|
| 439 |
+
@cached_property
|
| 440 |
+
def _name_lookup(self):
|
| 441 |
+
return {value.name: value for value in self.values}
|
| 442 |
+
|
| 443 |
+
|
| 444 |
+
def define_enum_values(type, value_map):
|
| 445 |
+
assert isinstance(value_map, Mapping) and len(value_map) > 0, (
|
| 446 |
+
'{} values must be a mapping (dict / OrderedDict) with value names as keys.'.format(type)
|
| 447 |
+
)
|
| 448 |
+
|
| 449 |
+
values = []
|
| 450 |
+
if not isinstance(value_map, (collections.OrderedDict, OrderedDict)):
|
| 451 |
+
value_map = OrderedDict(sorted(list(value_map.items())))
|
| 452 |
+
|
| 453 |
+
for value_name, value in value_map.items():
|
| 454 |
+
assert_valid_name(value_name)
|
| 455 |
+
assert isinstance(value, GraphQLEnumValue), (
|
| 456 |
+
'{}.{} must be an instance of GraphQLEnumValue, but got: {}'.format(type, value_name, value)
|
| 457 |
+
)
|
| 458 |
+
value = copy.copy(value)
|
| 459 |
+
value.name = value_name
|
| 460 |
+
if value.value is None:
|
| 461 |
+
value.value = value_name
|
| 462 |
+
|
| 463 |
+
values.append(value)
|
| 464 |
+
|
| 465 |
+
return values
|
| 466 |
+
|
| 467 |
+
|
| 468 |
+
class GraphQLEnumValue(object):
|
| 469 |
+
__slots__ = 'name', 'value', 'deprecation_reason', 'description'
|
| 470 |
+
|
| 471 |
+
def __init__(self, value=None, deprecation_reason=None, description=None, name=None):
|
| 472 |
+
self.name = name
|
| 473 |
+
self.value = value
|
| 474 |
+
self.deprecation_reason = deprecation_reason
|
| 475 |
+
self.description = description
|
| 476 |
+
|
| 477 |
+
def __eq__(self, other):
|
| 478 |
+
return (
|
| 479 |
+
self is other or (
|
| 480 |
+
isinstance(other, GraphQLEnumValue) and
|
| 481 |
+
self.name == other.name and
|
| 482 |
+
self.value == other.value and
|
| 483 |
+
self.deprecation_reason == other.deprecation_reason and
|
| 484 |
+
self.description == other.description
|
| 485 |
+
)
|
| 486 |
+
)
|
| 487 |
+
|
| 488 |
+
|
| 489 |
+
class GraphQLInputObjectType(GraphQLType):
|
| 490 |
+
"""Input Object Type Definition
|
| 491 |
+
|
| 492 |
+
An input object defines a structured collection of fields which may be
|
| 493 |
+
supplied to a field argument.
|
| 494 |
+
|
| 495 |
+
Using `NonNull` will ensure that a value must be provided by the query
|
| 496 |
+
|
| 497 |
+
Example:
|
| 498 |
+
|
| 499 |
+
NonNullFloat = GraphQLNonNull(GraphQLFloat())
|
| 500 |
+
|
| 501 |
+
class GeoPoint(GraphQLInputObjectType):
|
| 502 |
+
name = 'GeoPoint'
|
| 503 |
+
fields = {
|
| 504 |
+
'lat': GraphQLInputObjectField(NonNullFloat),
|
| 505 |
+
'lon': GraphQLInputObjectField(NonNullFloat),
|
| 506 |
+
'alt': GraphQLInputObjectField(GraphQLFloat(),
|
| 507 |
+
default_value=0)
|
| 508 |
+
}
|
| 509 |
+
"""
|
| 510 |
+
def __init__(self, name, fields, description=None):
|
| 511 |
+
assert name, 'Type must be named.'
|
| 512 |
+
self.name = name
|
| 513 |
+
self.description = description
|
| 514 |
+
|
| 515 |
+
self._fields = fields
|
| 516 |
+
|
| 517 |
+
@cached_property
|
| 518 |
+
def fields(self):
|
| 519 |
+
return self._define_field_map()
|
| 520 |
+
|
| 521 |
+
def _define_field_map(self):
|
| 522 |
+
fields = self._fields
|
| 523 |
+
if callable(fields):
|
| 524 |
+
fields = fields()
|
| 525 |
+
|
| 526 |
+
assert isinstance(fields, Mapping) and len(fields) > 0, (
|
| 527 |
+
'{} fields must be a mapping (dict / OrderedDict) with field names as keys or a '
|
| 528 |
+
'function which returns such a mapping.'
|
| 529 |
+
).format(self)
|
| 530 |
+
if not isinstance(fields, (collections.OrderedDict, OrderedDict)):
|
| 531 |
+
fields = OrderedDict(sorted(list(fields.items())))
|
| 532 |
+
|
| 533 |
+
for field_name, field in fields.items():
|
| 534 |
+
assert_valid_name(field_name)
|
| 535 |
+
|
| 536 |
+
return fields
|
| 537 |
+
|
| 538 |
+
|
| 539 |
+
class GraphQLInputObjectField(object):
|
| 540 |
+
__slots__ = 'type', 'default_value', 'description', 'out_name'
|
| 541 |
+
|
| 542 |
+
def __init__(self, type, default_value=None, description=None, out_name=None):
|
| 543 |
+
self.type = type
|
| 544 |
+
self.default_value = default_value
|
| 545 |
+
self.description = description
|
| 546 |
+
self.out_name = out_name
|
| 547 |
+
|
| 548 |
+
def __eq__(self, other):
|
| 549 |
+
return (
|
| 550 |
+
self is other or (
|
| 551 |
+
isinstance(other, GraphQLInputObjectField) and
|
| 552 |
+
self.type == other.type and
|
| 553 |
+
self.description == other.description and
|
| 554 |
+
self.out_name == other.out_name
|
| 555 |
+
)
|
| 556 |
+
)
|
| 557 |
+
|
| 558 |
+
|
| 559 |
+
class GraphQLList(GraphQLType):
|
| 560 |
+
"""List Modifier
|
| 561 |
+
|
| 562 |
+
A list is a kind of type marker, a wrapping type which points to another
|
| 563 |
+
type. Lists are often created within the context of defining the fields
|
| 564 |
+
of an object type.
|
| 565 |
+
|
| 566 |
+
Example:
|
| 567 |
+
|
| 568 |
+
class PersonType(GraphQLObjectType):
|
| 569 |
+
name = 'Person'
|
| 570 |
+
|
| 571 |
+
def get_fields(self):
|
| 572 |
+
return {
|
| 573 |
+
'parents': GraphQLField(GraphQLList(PersonType())),
|
| 574 |
+
'children': GraphQLField(GraphQLList(PersonType())),
|
| 575 |
+
}
|
| 576 |
+
"""
|
| 577 |
+
__slots__ = 'of_type',
|
| 578 |
+
|
| 579 |
+
def __init__(self, type):
|
| 580 |
+
assert is_type(type), 'Can only create List of a GraphQLType but got: {}.'.format(type)
|
| 581 |
+
self.of_type = type
|
| 582 |
+
|
| 583 |
+
def __str__(self):
|
| 584 |
+
return '[' + str(self.of_type) + ']'
|
| 585 |
+
|
| 586 |
+
def is_same_type(self, other):
|
| 587 |
+
return isinstance(other, GraphQLList) and self.of_type.is_same_type(other.of_type)
|
| 588 |
+
|
| 589 |
+
|
| 590 |
+
class GraphQLNonNull(GraphQLType):
|
| 591 |
+
"""Non-Null Modifier
|
| 592 |
+
|
| 593 |
+
A non-null is a kind of type marker, a wrapping type which points to another type. Non-null types enforce that their values are never null
|
| 594 |
+
and can ensure an error is raised if this ever occurs during a request. It is useful for fields which you can make a strong guarantee on
|
| 595 |
+
non-nullability, for example usually the id field of a database row will never be null.
|
| 596 |
+
|
| 597 |
+
Example:
|
| 598 |
+
|
| 599 |
+
class RowType(GraphQLObjectType):
|
| 600 |
+
name = 'Row'
|
| 601 |
+
fields = {
|
| 602 |
+
'id': GraphQLField(type=GraphQLNonNull(GraphQLString()))
|
| 603 |
+
}
|
| 604 |
+
|
| 605 |
+
Note: the enforcement of non-nullability occurs within the executor.
|
| 606 |
+
"""
|
| 607 |
+
__slots__ = 'of_type',
|
| 608 |
+
|
| 609 |
+
def __init__(self, type):
|
| 610 |
+
assert is_type(type) and not isinstance(type, GraphQLNonNull), (
|
| 611 |
+
'Can only create NonNull of a Nullable GraphQLType but got: {}.'.format(type)
|
| 612 |
+
)
|
| 613 |
+
self.of_type = type
|
| 614 |
+
|
| 615 |
+
def __str__(self):
|
| 616 |
+
return str(self.of_type) + '!'
|
| 617 |
+
|
| 618 |
+
def is_same_type(self, other):
|
| 619 |
+
return isinstance(other, GraphQLNonNull) and self.of_type.is_same_type(other.of_type)
|
vllm/lib/python3.10/site-packages/wandb/vendor/graphql-core-1.1/wandb_graphql/type/directives.py
ADDED
|
@@ -0,0 +1,132 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
from collections.abc import Iterable, Mapping
|
| 2 |
+
|
| 3 |
+
from ..pyutils.ordereddict import OrderedDict
|
| 4 |
+
from ..utils.assert_valid_name import assert_valid_name
|
| 5 |
+
from .definition import GraphQLArgument, GraphQLNonNull, is_input_type
|
| 6 |
+
from .scalars import GraphQLBoolean, GraphQLString
|
| 7 |
+
|
| 8 |
+
|
| 9 |
+
class DirectiveLocation(object):
|
| 10 |
+
# Operations
|
| 11 |
+
QUERY = 'QUERY'
|
| 12 |
+
MUTATION = 'MUTATION'
|
| 13 |
+
SUBSCRIPTION = 'SUBSCRIPTION'
|
| 14 |
+
FIELD = 'FIELD'
|
| 15 |
+
FRAGMENT_DEFINITION = 'FRAGMENT_DEFINITION'
|
| 16 |
+
FRAGMENT_SPREAD = 'FRAGMENT_SPREAD'
|
| 17 |
+
INLINE_FRAGMENT = 'INLINE_FRAGMENT'
|
| 18 |
+
|
| 19 |
+
# Schema Definitions
|
| 20 |
+
SCHEMA = 'SCHEMA'
|
| 21 |
+
SCALAR = 'SCALAR'
|
| 22 |
+
OBJECT = 'OBJECT'
|
| 23 |
+
FIELD_DEFINITION = 'FIELD_DEFINITION'
|
| 24 |
+
ARGUMENT_DEFINITION = 'ARGUMENT_DEFINITION'
|
| 25 |
+
INTERFACE = 'INTERFACE'
|
| 26 |
+
UNION = 'UNION'
|
| 27 |
+
ENUM = 'ENUM'
|
| 28 |
+
ENUM_VALUE = 'ENUM_VALUE'
|
| 29 |
+
INPUT_OBJECT = 'INPUT_OBJECT'
|
| 30 |
+
INPUT_FIELD_DEFINITION = 'INPUT_FIELD_DEFINITION'
|
| 31 |
+
|
| 32 |
+
OPERATION_LOCATIONS = [
|
| 33 |
+
QUERY,
|
| 34 |
+
MUTATION,
|
| 35 |
+
SUBSCRIPTION
|
| 36 |
+
]
|
| 37 |
+
|
| 38 |
+
FRAGMENT_LOCATIONS = [
|
| 39 |
+
FRAGMENT_DEFINITION,
|
| 40 |
+
FRAGMENT_SPREAD,
|
| 41 |
+
INLINE_FRAGMENT
|
| 42 |
+
]
|
| 43 |
+
|
| 44 |
+
FIELD_LOCATIONS = [
|
| 45 |
+
FIELD
|
| 46 |
+
]
|
| 47 |
+
|
| 48 |
+
|
| 49 |
+
class GraphQLDirective(object):
|
| 50 |
+
__slots__ = 'name', 'args', 'description', 'locations'
|
| 51 |
+
|
| 52 |
+
def __init__(self, name, description=None, args=None, locations=None):
|
| 53 |
+
assert name, 'Directive must be named.'
|
| 54 |
+
assert_valid_name(name)
|
| 55 |
+
assert isinstance(locations, Iterable), 'Must provide locations for directive.'
|
| 56 |
+
|
| 57 |
+
self.name = name
|
| 58 |
+
self.description = description
|
| 59 |
+
self.locations = locations
|
| 60 |
+
|
| 61 |
+
if args:
|
| 62 |
+
assert isinstance(args, Mapping), '{} args must be a dict with argument names as keys.'.format(name)
|
| 63 |
+
for arg_name, _arg in args.items():
|
| 64 |
+
assert_valid_name(arg_name)
|
| 65 |
+
assert is_input_type(_arg.type), '{}({}) argument type must be Input Type but got {}.'.format(
|
| 66 |
+
name,
|
| 67 |
+
arg_name,
|
| 68 |
+
_arg.type)
|
| 69 |
+
self.args = args or OrderedDict()
|
| 70 |
+
|
| 71 |
+
|
| 72 |
+
"""Used to conditionally include fields or fragments."""
|
| 73 |
+
GraphQLIncludeDirective = GraphQLDirective(
|
| 74 |
+
name='include',
|
| 75 |
+
description='Directs the executor to include this field or fragment only when the `if` argument is true.',
|
| 76 |
+
args={
|
| 77 |
+
'if': GraphQLArgument(
|
| 78 |
+
type=GraphQLNonNull(GraphQLBoolean),
|
| 79 |
+
description='Included when true.',
|
| 80 |
+
),
|
| 81 |
+
},
|
| 82 |
+
locations=[
|
| 83 |
+
DirectiveLocation.FIELD,
|
| 84 |
+
DirectiveLocation.FRAGMENT_SPREAD,
|
| 85 |
+
DirectiveLocation.INLINE_FRAGMENT,
|
| 86 |
+
]
|
| 87 |
+
)
|
| 88 |
+
|
| 89 |
+
"""Used to conditionally skip (exclude) fields or fragments."""
|
| 90 |
+
GraphQLSkipDirective = GraphQLDirective(
|
| 91 |
+
name='skip',
|
| 92 |
+
description='Directs the executor to skip this field or fragment when the `if` argument is true.',
|
| 93 |
+
args={
|
| 94 |
+
'if': GraphQLArgument(
|
| 95 |
+
type=GraphQLNonNull(GraphQLBoolean),
|
| 96 |
+
description='Skipped when true.',
|
| 97 |
+
),
|
| 98 |
+
},
|
| 99 |
+
locations=[
|
| 100 |
+
DirectiveLocation.FIELD,
|
| 101 |
+
DirectiveLocation.FRAGMENT_SPREAD,
|
| 102 |
+
DirectiveLocation.INLINE_FRAGMENT,
|
| 103 |
+
]
|
| 104 |
+
)
|
| 105 |
+
|
| 106 |
+
"""Constant string used for default reason for a deprecation."""
|
| 107 |
+
DEFAULT_DEPRECATION_REASON = 'No longer supported'
|
| 108 |
+
|
| 109 |
+
"""Used to declare element of a GraphQL schema as deprecated."""
|
| 110 |
+
GraphQLDeprecatedDirective = GraphQLDirective(
|
| 111 |
+
name='deprecated',
|
| 112 |
+
description='Marks an element of a GraphQL schema as no longer supported.',
|
| 113 |
+
args={
|
| 114 |
+
'reason': GraphQLArgument(
|
| 115 |
+
type=GraphQLString,
|
| 116 |
+
description=('Explains why this element was deprecated, usually also including a suggestion for how to'
|
| 117 |
+
'access supported similar data. Formatted in [Markdown]'
|
| 118 |
+
'(https://daringfireball.net/projects/markdown/).'),
|
| 119 |
+
default_value=DEFAULT_DEPRECATION_REASON
|
| 120 |
+
),
|
| 121 |
+
},
|
| 122 |
+
locations=[
|
| 123 |
+
DirectiveLocation.FIELD_DEFINITION,
|
| 124 |
+
DirectiveLocation.ENUM_VALUE,
|
| 125 |
+
]
|
| 126 |
+
)
|
| 127 |
+
|
| 128 |
+
specified_directives = [
|
| 129 |
+
GraphQLIncludeDirective,
|
| 130 |
+
GraphQLSkipDirective,
|
| 131 |
+
GraphQLDeprecatedDirective
|
| 132 |
+
]
|
vllm/lib/python3.10/site-packages/wandb/vendor/graphql-core-1.1/wandb_graphql/type/introspection.py
ADDED
|
@@ -0,0 +1,440 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
from collections import OrderedDict, namedtuple
|
| 2 |
+
|
| 3 |
+
from ..language.printer import print_ast
|
| 4 |
+
from ..utils.ast_from_value import ast_from_value
|
| 5 |
+
from .definition import (GraphQLArgument, GraphQLEnumType, GraphQLEnumValue,
|
| 6 |
+
GraphQLField, GraphQLInputObjectType,
|
| 7 |
+
GraphQLInterfaceType, GraphQLList, GraphQLNonNull,
|
| 8 |
+
GraphQLObjectType, GraphQLScalarType,
|
| 9 |
+
GraphQLUnionType)
|
| 10 |
+
from .directives import DirectiveLocation
|
| 11 |
+
from .scalars import GraphQLBoolean, GraphQLString
|
| 12 |
+
|
| 13 |
+
InputField = namedtuple('InputField', ['name', 'description', 'type', 'default_value'])
|
| 14 |
+
Field = namedtuple('Field', ['name', 'type', 'description', 'args', 'deprecation_reason'])
|
| 15 |
+
|
| 16 |
+
|
| 17 |
+
def input_fields_to_list(input_fields):
|
| 18 |
+
fields = []
|
| 19 |
+
for field_name, field in input_fields.items():
|
| 20 |
+
fields.append(InputField(
|
| 21 |
+
name=field_name,
|
| 22 |
+
description=field.description,
|
| 23 |
+
type=field.type,
|
| 24 |
+
default_value=field.default_value))
|
| 25 |
+
return fields
|
| 26 |
+
|
| 27 |
+
|
| 28 |
+
__Schema = GraphQLObjectType(
|
| 29 |
+
'__Schema',
|
| 30 |
+
description='A GraphQL Schema defines the capabilities of a GraphQL server. It '
|
| 31 |
+
'exposes all available types and directives on the server, as well as '
|
| 32 |
+
'the entry points for query, mutation and subscription operations.',
|
| 33 |
+
fields=lambda: OrderedDict([
|
| 34 |
+
('types', GraphQLField(
|
| 35 |
+
description='A list of all types supported by this server.',
|
| 36 |
+
type=GraphQLNonNull(GraphQLList(GraphQLNonNull(__Type))),
|
| 37 |
+
resolver=lambda schema, *_: schema.get_type_map().values(),
|
| 38 |
+
)),
|
| 39 |
+
('queryType', GraphQLField(
|
| 40 |
+
description='The type that query operations will be rooted at.',
|
| 41 |
+
type=GraphQLNonNull(__Type),
|
| 42 |
+
resolver=lambda schema, *_: schema.get_query_type(),
|
| 43 |
+
)),
|
| 44 |
+
('mutationType', GraphQLField(
|
| 45 |
+
description='If this server supports mutation, the type that '
|
| 46 |
+
'mutation operations will be rooted at.',
|
| 47 |
+
type=__Type,
|
| 48 |
+
resolver=lambda schema, *_: schema.get_mutation_type(),
|
| 49 |
+
)),
|
| 50 |
+
('subscriptionType', GraphQLField(
|
| 51 |
+
description='If this server support subscription, the type '
|
| 52 |
+
'that subscription operations will be rooted at.',
|
| 53 |
+
type=__Type,
|
| 54 |
+
resolver=lambda schema, *_: schema.get_subscription_type(),
|
| 55 |
+
)),
|
| 56 |
+
('directives', GraphQLField(
|
| 57 |
+
description='A list of all directives supported by this server.',
|
| 58 |
+
type=GraphQLNonNull(GraphQLList(GraphQLNonNull(__Directive))),
|
| 59 |
+
resolver=lambda schema, *_: schema.get_directives(),
|
| 60 |
+
)),
|
| 61 |
+
]))
|
| 62 |
+
|
| 63 |
+
_on_operation_locations = set(DirectiveLocation.OPERATION_LOCATIONS)
|
| 64 |
+
_on_fragment_locations = set(DirectiveLocation.FRAGMENT_LOCATIONS)
|
| 65 |
+
_on_field_locations = set(DirectiveLocation.FIELD_LOCATIONS)
|
| 66 |
+
|
| 67 |
+
__Directive = GraphQLObjectType(
|
| 68 |
+
'__Directive',
|
| 69 |
+
description='A Directive provides a way to describe alternate runtime execution and '
|
| 70 |
+
'type validation behavior in a GraphQL document.'
|
| 71 |
+
'\n\nIn some cases, you need to provide options to alter GraphQL\'s '
|
| 72 |
+
'execution behavior in ways field arguments will not suffice, such as '
|
| 73 |
+
'conditionally including or skipping a field. Directives provide this by '
|
| 74 |
+
'describing additional information to the executor.',
|
| 75 |
+
fields=lambda: OrderedDict([
|
| 76 |
+
('name', GraphQLField(GraphQLNonNull(GraphQLString))),
|
| 77 |
+
('description', GraphQLField(GraphQLString)),
|
| 78 |
+
('locations', GraphQLField(
|
| 79 |
+
type=GraphQLNonNull(GraphQLList(GraphQLNonNull(__DirectiveLocation))),
|
| 80 |
+
)),
|
| 81 |
+
('args', GraphQLField(
|
| 82 |
+
type=GraphQLNonNull(GraphQLList(GraphQLNonNull(__InputValue))),
|
| 83 |
+
resolver=lambda directive, *args: input_fields_to_list(directive.args),
|
| 84 |
+
)),
|
| 85 |
+
('onOperation', GraphQLField(
|
| 86 |
+
type=GraphQLNonNull(GraphQLBoolean),
|
| 87 |
+
deprecation_reason='Use `locations`.',
|
| 88 |
+
resolver=lambda directive, *args: set(directive.locations) & _on_operation_locations,
|
| 89 |
+
)),
|
| 90 |
+
('onFragment', GraphQLField(
|
| 91 |
+
type=GraphQLNonNull(GraphQLBoolean),
|
| 92 |
+
deprecation_reason='Use `locations`.',
|
| 93 |
+
resolver=lambda directive, *args: set(directive.locations) & _on_fragment_locations,
|
| 94 |
+
)),
|
| 95 |
+
('onField', GraphQLField(
|
| 96 |
+
type=GraphQLNonNull(GraphQLBoolean),
|
| 97 |
+
deprecation_reason='Use `locations`.',
|
| 98 |
+
resolver=lambda directive, *args: set(directive.locations) & _on_field_locations,
|
| 99 |
+
))
|
| 100 |
+
]))
|
| 101 |
+
|
| 102 |
+
__DirectiveLocation = GraphQLEnumType(
|
| 103 |
+
'__DirectiveLocation',
|
| 104 |
+
description=(
|
| 105 |
+
'A Directive can be adjacent to many parts of the GraphQL language, a ' +
|
| 106 |
+
'__DirectiveLocation describes one such possible adjacencies.'
|
| 107 |
+
),
|
| 108 |
+
values=OrderedDict([
|
| 109 |
+
('QUERY', GraphQLEnumValue(
|
| 110 |
+
DirectiveLocation.QUERY,
|
| 111 |
+
description='Location adjacent to a query operation.'
|
| 112 |
+
)),
|
| 113 |
+
('MUTATION', GraphQLEnumValue(
|
| 114 |
+
DirectiveLocation.MUTATION,
|
| 115 |
+
description='Location adjacent to a mutation operation.'
|
| 116 |
+
)),
|
| 117 |
+
('SUBSCRIPTION', GraphQLEnumValue(
|
| 118 |
+
DirectiveLocation.SUBSCRIPTION,
|
| 119 |
+
description='Location adjacent to a subscription operation.'
|
| 120 |
+
)),
|
| 121 |
+
('FIELD', GraphQLEnumValue(
|
| 122 |
+
DirectiveLocation.FIELD,
|
| 123 |
+
description='Location adjacent to a field.'
|
| 124 |
+
)),
|
| 125 |
+
('FRAGMENT_DEFINITION', GraphQLEnumValue(
|
| 126 |
+
DirectiveLocation.FRAGMENT_DEFINITION,
|
| 127 |
+
description='Location adjacent to a fragment definition.'
|
| 128 |
+
)),
|
| 129 |
+
('FRAGMENT_SPREAD', GraphQLEnumValue(
|
| 130 |
+
DirectiveLocation.FRAGMENT_SPREAD,
|
| 131 |
+
description='Location adjacent to a fragment spread.'
|
| 132 |
+
)),
|
| 133 |
+
('INLINE_FRAGMENT', GraphQLEnumValue(
|
| 134 |
+
DirectiveLocation.INLINE_FRAGMENT,
|
| 135 |
+
description='Location adjacent to an inline fragment.'
|
| 136 |
+
)),
|
| 137 |
+
('SCHEMA', GraphQLEnumValue(
|
| 138 |
+
DirectiveLocation.SCHEMA,
|
| 139 |
+
description='Location adjacent to a schema definition.'
|
| 140 |
+
)),
|
| 141 |
+
('SCALAR', GraphQLEnumValue(
|
| 142 |
+
DirectiveLocation.SCALAR,
|
| 143 |
+
description='Location adjacent to a scalar definition.'
|
| 144 |
+
)),
|
| 145 |
+
('OBJECT', GraphQLEnumValue(
|
| 146 |
+
DirectiveLocation.OBJECT,
|
| 147 |
+
description='Location adjacent to an object definition.'
|
| 148 |
+
)),
|
| 149 |
+
('FIELD_DEFINITION', GraphQLEnumValue(
|
| 150 |
+
DirectiveLocation.FIELD_DEFINITION,
|
| 151 |
+
description='Location adjacent to a field definition.'
|
| 152 |
+
)),
|
| 153 |
+
('ARGUMENT_DEFINITION', GraphQLEnumValue(
|
| 154 |
+
DirectiveLocation.ARGUMENT_DEFINITION,
|
| 155 |
+
description='Location adjacent to an argument definition.'
|
| 156 |
+
)),
|
| 157 |
+
('INTERFACE', GraphQLEnumValue(
|
| 158 |
+
DirectiveLocation.INTERFACE,
|
| 159 |
+
description='Location adjacent to an interface definition.'
|
| 160 |
+
)),
|
| 161 |
+
('UNION', GraphQLEnumValue(
|
| 162 |
+
DirectiveLocation.UNION,
|
| 163 |
+
description='Location adjacent to a union definition.'
|
| 164 |
+
)),
|
| 165 |
+
('ENUM', GraphQLEnumValue(
|
| 166 |
+
DirectiveLocation.ENUM,
|
| 167 |
+
description='Location adjacent to an enum definition.'
|
| 168 |
+
)),
|
| 169 |
+
('ENUM_VALUE', GraphQLEnumValue(
|
| 170 |
+
DirectiveLocation.ENUM_VALUE,
|
| 171 |
+
description='Location adjacent to an enum value definition.'
|
| 172 |
+
)),
|
| 173 |
+
('INPUT_OBJECT', GraphQLEnumValue(
|
| 174 |
+
DirectiveLocation.INPUT_OBJECT,
|
| 175 |
+
description='Location adjacent to an input object definition.'
|
| 176 |
+
)),
|
| 177 |
+
('INPUT_FIELD_DEFINITION', GraphQLEnumValue(
|
| 178 |
+
DirectiveLocation.INPUT_FIELD_DEFINITION,
|
| 179 |
+
description='Location adjacent to an input object field definition.'
|
| 180 |
+
)),
|
| 181 |
+
]))
|
| 182 |
+
|
| 183 |
+
|
| 184 |
+
class TypeKind(object):
|
| 185 |
+
SCALAR = 'SCALAR'
|
| 186 |
+
OBJECT = 'OBJECT'
|
| 187 |
+
INTERFACE = 'INTERFACE'
|
| 188 |
+
UNION = 'UNION'
|
| 189 |
+
ENUM = 'ENUM'
|
| 190 |
+
INPUT_OBJECT = 'INPUT_OBJECT'
|
| 191 |
+
LIST = 'LIST'
|
| 192 |
+
NON_NULL = 'NON_NULL'
|
| 193 |
+
|
| 194 |
+
|
| 195 |
+
class TypeFieldResolvers(object):
|
| 196 |
+
_kinds = (
|
| 197 |
+
(GraphQLScalarType, TypeKind.SCALAR),
|
| 198 |
+
(GraphQLObjectType, TypeKind.OBJECT),
|
| 199 |
+
(GraphQLInterfaceType, TypeKind.INTERFACE),
|
| 200 |
+
(GraphQLUnionType, TypeKind.UNION),
|
| 201 |
+
(GraphQLEnumType, TypeKind.ENUM),
|
| 202 |
+
(GraphQLInputObjectType, TypeKind.INPUT_OBJECT),
|
| 203 |
+
(GraphQLList, TypeKind.LIST),
|
| 204 |
+
(GraphQLNonNull, TypeKind.NON_NULL),
|
| 205 |
+
)
|
| 206 |
+
|
| 207 |
+
@classmethod
|
| 208 |
+
def kind(cls, type, *_):
|
| 209 |
+
for klass, kind in cls._kinds:
|
| 210 |
+
if isinstance(type, klass):
|
| 211 |
+
return kind
|
| 212 |
+
|
| 213 |
+
raise Exception('Unknown kind of type: {}'.format(type))
|
| 214 |
+
|
| 215 |
+
@staticmethod
|
| 216 |
+
def fields(type, args, *_):
|
| 217 |
+
if isinstance(type, (GraphQLObjectType, GraphQLInterfaceType)):
|
| 218 |
+
fields = []
|
| 219 |
+
include_deprecated = args.get('includeDeprecated')
|
| 220 |
+
for field_name, field in type.fields.items():
|
| 221 |
+
if field.deprecation_reason and not include_deprecated:
|
| 222 |
+
continue
|
| 223 |
+
fields.append(Field(
|
| 224 |
+
name=field_name,
|
| 225 |
+
description=field.description,
|
| 226 |
+
type=field.type,
|
| 227 |
+
args=field.args,
|
| 228 |
+
deprecation_reason=field.deprecation_reason
|
| 229 |
+
))
|
| 230 |
+
return fields
|
| 231 |
+
return None
|
| 232 |
+
|
| 233 |
+
@staticmethod
|
| 234 |
+
def interfaces(type, *_):
|
| 235 |
+
if isinstance(type, GraphQLObjectType):
|
| 236 |
+
return type.interfaces
|
| 237 |
+
|
| 238 |
+
@staticmethod
|
| 239 |
+
def possible_types(type, args, context, info):
|
| 240 |
+
if isinstance(type, (GraphQLInterfaceType, GraphQLUnionType)):
|
| 241 |
+
return info.schema.get_possible_types(type)
|
| 242 |
+
|
| 243 |
+
@staticmethod
|
| 244 |
+
def enum_values(type, args, *_):
|
| 245 |
+
if isinstance(type, GraphQLEnumType):
|
| 246 |
+
values = type.values
|
| 247 |
+
if not args.get('includeDeprecated'):
|
| 248 |
+
values = [v for v in values if not v.deprecation_reason]
|
| 249 |
+
|
| 250 |
+
return values
|
| 251 |
+
|
| 252 |
+
@staticmethod
|
| 253 |
+
def input_fields(type, *_):
|
| 254 |
+
if isinstance(type, GraphQLInputObjectType):
|
| 255 |
+
return input_fields_to_list(type.fields)
|
| 256 |
+
|
| 257 |
+
|
| 258 |
+
__Type = GraphQLObjectType(
|
| 259 |
+
'__Type',
|
| 260 |
+
description='The fundamental unit of any GraphQL Schema is the type. There are '
|
| 261 |
+
'many kinds of types in GraphQL as represented by the `__TypeKind` enum.'
|
| 262 |
+
'\n\nDepending on the kind of a type, certain fields describe '
|
| 263 |
+
'information about that type. Scalar types provide no information '
|
| 264 |
+
'beyond a name and description, while Enum types provide their values. '
|
| 265 |
+
'Object and Interface types provide the fields they describe. Abstract '
|
| 266 |
+
'types, Union and Interface, provide the Object types possible '
|
| 267 |
+
'at runtime. List and NonNull types compose other types.',
|
| 268 |
+
fields=lambda: OrderedDict([
|
| 269 |
+
('kind', GraphQLField(
|
| 270 |
+
type=GraphQLNonNull(__TypeKind),
|
| 271 |
+
resolver=TypeFieldResolvers.kind
|
| 272 |
+
)),
|
| 273 |
+
('name', GraphQLField(GraphQLString)),
|
| 274 |
+
('description', GraphQLField(GraphQLString)),
|
| 275 |
+
('fields', GraphQLField(
|
| 276 |
+
type=GraphQLList(GraphQLNonNull(__Field)),
|
| 277 |
+
args={
|
| 278 |
+
'includeDeprecated': GraphQLArgument(
|
| 279 |
+
GraphQLBoolean,
|
| 280 |
+
default_value=False
|
| 281 |
+
)
|
| 282 |
+
},
|
| 283 |
+
resolver=TypeFieldResolvers.fields
|
| 284 |
+
)),
|
| 285 |
+
('interfaces', GraphQLField(
|
| 286 |
+
type=GraphQLList(GraphQLNonNull(__Type)),
|
| 287 |
+
resolver=TypeFieldResolvers.interfaces
|
| 288 |
+
)),
|
| 289 |
+
('possibleTypes', GraphQLField(
|
| 290 |
+
type=GraphQLList(GraphQLNonNull(__Type)),
|
| 291 |
+
resolver=TypeFieldResolvers.possible_types
|
| 292 |
+
)),
|
| 293 |
+
('enumValues', GraphQLField(
|
| 294 |
+
type=GraphQLList(GraphQLNonNull(__EnumValue)),
|
| 295 |
+
args={
|
| 296 |
+
'includeDeprecated': GraphQLArgument(
|
| 297 |
+
GraphQLBoolean,
|
| 298 |
+
default_value=False
|
| 299 |
+
)
|
| 300 |
+
},
|
| 301 |
+
resolver=TypeFieldResolvers.enum_values
|
| 302 |
+
)),
|
| 303 |
+
('inputFields', GraphQLField(
|
| 304 |
+
type=GraphQLList(GraphQLNonNull(__InputValue)),
|
| 305 |
+
resolver=TypeFieldResolvers.input_fields
|
| 306 |
+
)),
|
| 307 |
+
('ofType', GraphQLField(
|
| 308 |
+
type=__Type,
|
| 309 |
+
resolver=lambda type, *_: getattr(type, 'of_type', None)
|
| 310 |
+
)),
|
| 311 |
+
]))
|
| 312 |
+
|
| 313 |
+
__Field = GraphQLObjectType(
|
| 314 |
+
'__Field',
|
| 315 |
+
description='Object and Interface types are described by a list of Fields, each of '
|
| 316 |
+
'which has a name, potentially a list of arguments, and a return type.',
|
| 317 |
+
fields=lambda: OrderedDict([
|
| 318 |
+
('name', GraphQLField(GraphQLNonNull(GraphQLString))),
|
| 319 |
+
('description', GraphQLField(GraphQLString)),
|
| 320 |
+
('args', GraphQLField(
|
| 321 |
+
type=GraphQLNonNull(GraphQLList(GraphQLNonNull(__InputValue))),
|
| 322 |
+
resolver=lambda field, *_: input_fields_to_list(field.args)
|
| 323 |
+
)),
|
| 324 |
+
('type', GraphQLField(GraphQLNonNull(__Type))),
|
| 325 |
+
('isDeprecated', GraphQLField(
|
| 326 |
+
type=GraphQLNonNull(GraphQLBoolean),
|
| 327 |
+
resolver=lambda field, *_: bool(field.deprecation_reason)
|
| 328 |
+
)),
|
| 329 |
+
('deprecationReason', GraphQLField(
|
| 330 |
+
type=GraphQLString,
|
| 331 |
+
resolver=lambda field, *_: field.deprecation_reason
|
| 332 |
+
))
|
| 333 |
+
])
|
| 334 |
+
)
|
| 335 |
+
|
| 336 |
+
__InputValue = GraphQLObjectType(
|
| 337 |
+
'__InputValue',
|
| 338 |
+
description='Arguments provided to Fields or Directives and the input fields of an '
|
| 339 |
+
'InputObject are represented as Input Values which describe their type '
|
| 340 |
+
'and optionally a default value.',
|
| 341 |
+
fields=lambda: OrderedDict([
|
| 342 |
+
('name', GraphQLField(GraphQLNonNull(GraphQLString))),
|
| 343 |
+
('description', GraphQLField(GraphQLString)),
|
| 344 |
+
('type', GraphQLField(GraphQLNonNull(__Type))),
|
| 345 |
+
('defaultValue', GraphQLField(
|
| 346 |
+
type=GraphQLString,
|
| 347 |
+
resolver=lambda input_val, *_:
|
| 348 |
+
None if input_val.default_value is None
|
| 349 |
+
else print_ast(ast_from_value(input_val.default_value, input_val))
|
| 350 |
+
))
|
| 351 |
+
]))
|
| 352 |
+
|
| 353 |
+
__EnumValue = GraphQLObjectType(
|
| 354 |
+
'__EnumValue',
|
| 355 |
+
description='One possible value for a given Enum. Enum values are unique values, not '
|
| 356 |
+
'a placeholder for a string or numeric value. However an Enum value is '
|
| 357 |
+
'returned in a JSON response as a string.',
|
| 358 |
+
fields=lambda: OrderedDict([
|
| 359 |
+
('name', GraphQLField(GraphQLNonNull(GraphQLString))),
|
| 360 |
+
('description', GraphQLField(GraphQLString)),
|
| 361 |
+
('isDeprecated', GraphQLField(
|
| 362 |
+
type=GraphQLNonNull(GraphQLBoolean),
|
| 363 |
+
resolver=lambda field, *_: bool(field.deprecation_reason)
|
| 364 |
+
)),
|
| 365 |
+
('deprecationReason', GraphQLField(
|
| 366 |
+
type=GraphQLString,
|
| 367 |
+
resolver=lambda enum_value, *_: enum_value.deprecation_reason,
|
| 368 |
+
))
|
| 369 |
+
]))
|
| 370 |
+
|
| 371 |
+
__TypeKind = GraphQLEnumType(
|
| 372 |
+
'__TypeKind',
|
| 373 |
+
description='An enum describing what kind of type a given `__Type` is',
|
| 374 |
+
values=OrderedDict([
|
| 375 |
+
('SCALAR', GraphQLEnumValue(
|
| 376 |
+
TypeKind.SCALAR,
|
| 377 |
+
description='Indicates this type is a scalar.'
|
| 378 |
+
)),
|
| 379 |
+
('OBJECT', GraphQLEnumValue(
|
| 380 |
+
TypeKind.OBJECT,
|
| 381 |
+
description='Indicates this type is an object. '
|
| 382 |
+
'`fields` and `interfaces` are valid fields.'
|
| 383 |
+
)),
|
| 384 |
+
('INTERFACE', GraphQLEnumValue(
|
| 385 |
+
TypeKind.INTERFACE,
|
| 386 |
+
description='Indicates this type is an interface. '
|
| 387 |
+
'`fields` and `possibleTypes` are valid fields.'
|
| 388 |
+
)),
|
| 389 |
+
('UNION', GraphQLEnumValue(
|
| 390 |
+
TypeKind.UNION,
|
| 391 |
+
description='Indicates this type is a union. '
|
| 392 |
+
'`possibleTypes` is a valid field.'
|
| 393 |
+
)),
|
| 394 |
+
('ENUM', GraphQLEnumValue(
|
| 395 |
+
TypeKind.ENUM,
|
| 396 |
+
description='Indicates this type is an enum. '
|
| 397 |
+
'`enumValues` is a valid field.'
|
| 398 |
+
)),
|
| 399 |
+
('INPUT_OBJECT', GraphQLEnumValue(
|
| 400 |
+
TypeKind.INPUT_OBJECT,
|
| 401 |
+
description='Indicates this type is an input object. '
|
| 402 |
+
'`inputFields` is a valid field.'
|
| 403 |
+
)),
|
| 404 |
+
('LIST', GraphQLEnumValue(
|
| 405 |
+
TypeKind.LIST,
|
| 406 |
+
description='Indicates this type is a list. '
|
| 407 |
+
'`ofType` is a valid field.'
|
| 408 |
+
)),
|
| 409 |
+
('NON_NULL', GraphQLEnumValue(
|
| 410 |
+
TypeKind.NON_NULL,
|
| 411 |
+
description='Indicates this type is a non-null. '
|
| 412 |
+
'`ofType` is a valid field.'
|
| 413 |
+
)),
|
| 414 |
+
]))
|
| 415 |
+
|
| 416 |
+
IntrospectionSchema = __Schema
|
| 417 |
+
|
| 418 |
+
SchemaMetaFieldDef = GraphQLField(
|
| 419 |
+
# name='__schema',
|
| 420 |
+
type=GraphQLNonNull(__Schema),
|
| 421 |
+
description='Access the current type schema of this server.',
|
| 422 |
+
resolver=lambda source, args, context, info: info.schema,
|
| 423 |
+
args={}
|
| 424 |
+
)
|
| 425 |
+
|
| 426 |
+
TypeMetaFieldDef = GraphQLField(
|
| 427 |
+
type=__Type,
|
| 428 |
+
# name='__type',
|
| 429 |
+
description='Request the type information of a single type.',
|
| 430 |
+
args={'name': GraphQLArgument(GraphQLNonNull(GraphQLString))},
|
| 431 |
+
resolver=lambda source, args, context, info: info.schema.get_type(args['name'])
|
| 432 |
+
)
|
| 433 |
+
|
| 434 |
+
TypeNameMetaFieldDef = GraphQLField(
|
| 435 |
+
type=GraphQLNonNull(GraphQLString),
|
| 436 |
+
# name='__typename',
|
| 437 |
+
description='The name of the current Object type at runtime.',
|
| 438 |
+
resolver=lambda source, args, context, info: info.parent_type.name,
|
| 439 |
+
args={}
|
| 440 |
+
)
|
vllm/lib/python3.10/site-packages/wandb/vendor/graphql-core-1.1/wandb_graphql/type/scalars.py
ADDED
|
@@ -0,0 +1,131 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
from ..language.ast import BooleanValue, FloatValue, IntValue, StringValue
|
| 2 |
+
from .definition import GraphQLScalarType
|
| 3 |
+
|
| 4 |
+
# As per the GraphQL Spec, Integers are only treated as valid when a valid
|
| 5 |
+
# 32-bit signed integer, providing the broadest support across platforms.
|
| 6 |
+
#
|
| 7 |
+
# n.b. JavaScript's integers are safe between -(2^53 - 1) and 2^53 - 1 because
|
| 8 |
+
# they are internally represented as IEEE 754 doubles.
|
| 9 |
+
MAX_INT = 2147483647
|
| 10 |
+
MIN_INT = -2147483648
|
| 11 |
+
|
| 12 |
+
|
| 13 |
+
def coerce_int(value):
|
| 14 |
+
if isinstance(value, int):
|
| 15 |
+
num = value
|
| 16 |
+
else:
|
| 17 |
+
try:
|
| 18 |
+
num = int(value)
|
| 19 |
+
except ValueError:
|
| 20 |
+
num = int(float(value))
|
| 21 |
+
if MIN_INT <= num <= MAX_INT:
|
| 22 |
+
return num
|
| 23 |
+
raise Exception((
|
| 24 |
+
"Int cannot represent non 32-bit signed integer value: {}"
|
| 25 |
+
).format(value))
|
| 26 |
+
|
| 27 |
+
|
| 28 |
+
def parse_int_literal(ast):
|
| 29 |
+
if isinstance(ast, IntValue):
|
| 30 |
+
num = int(ast.value)
|
| 31 |
+
if MIN_INT <= num <= MAX_INT:
|
| 32 |
+
return num
|
| 33 |
+
|
| 34 |
+
|
| 35 |
+
GraphQLInt = GraphQLScalarType(
|
| 36 |
+
name='Int',
|
| 37 |
+
description='The `Int` scalar type represents non-fractional signed whole numeric '
|
| 38 |
+
'values. Int can represent values between -(2^53 - 1) and 2^53 - 1 since '
|
| 39 |
+
'represented in JSON as double-precision floating point numbers specified'
|
| 40 |
+
'by [IEEE 754](http://en.wikipedia.org/wiki/IEEE_floating_point).',
|
| 41 |
+
serialize=coerce_int,
|
| 42 |
+
parse_value=coerce_int,
|
| 43 |
+
parse_literal=parse_int_literal)
|
| 44 |
+
|
| 45 |
+
|
| 46 |
+
def coerce_float(value):
|
| 47 |
+
if isinstance(value, float):
|
| 48 |
+
return value
|
| 49 |
+
return float(value)
|
| 50 |
+
|
| 51 |
+
|
| 52 |
+
def parse_float_literal(ast):
|
| 53 |
+
if isinstance(ast, (FloatValue, IntValue)):
|
| 54 |
+
return float(ast.value)
|
| 55 |
+
return None
|
| 56 |
+
|
| 57 |
+
|
| 58 |
+
GraphQLFloat = GraphQLScalarType(
|
| 59 |
+
name='Float',
|
| 60 |
+
description='The `Float` scalar type represents signed double-precision fractional '
|
| 61 |
+
'values as specified by '
|
| 62 |
+
'[IEEE 754](http://en.wikipedia.org/wiki/IEEE_floating_point). ',
|
| 63 |
+
serialize=coerce_float,
|
| 64 |
+
parse_value=coerce_float,
|
| 65 |
+
parse_literal=parse_float_literal)
|
| 66 |
+
|
| 67 |
+
|
| 68 |
+
def coerce_string(value):
|
| 69 |
+
if isinstance(value, str):
|
| 70 |
+
return value
|
| 71 |
+
|
| 72 |
+
if isinstance(value, bool):
|
| 73 |
+
return u'true' if value else u'false'
|
| 74 |
+
|
| 75 |
+
return str(value)
|
| 76 |
+
|
| 77 |
+
|
| 78 |
+
def coerce_str(value):
|
| 79 |
+
if isinstance(value, str):
|
| 80 |
+
return value
|
| 81 |
+
|
| 82 |
+
return str(value)
|
| 83 |
+
|
| 84 |
+
|
| 85 |
+
def parse_string_literal(ast):
|
| 86 |
+
if isinstance(ast, StringValue):
|
| 87 |
+
return ast.value
|
| 88 |
+
|
| 89 |
+
return None
|
| 90 |
+
|
| 91 |
+
|
| 92 |
+
GraphQLString = GraphQLScalarType(
|
| 93 |
+
name='String',
|
| 94 |
+
description='The `String` scalar type represents textual data, represented as UTF-8 '
|
| 95 |
+
'character sequences. The String type is most often used by GraphQL to '
|
| 96 |
+
'represent free-form human-readable text.',
|
| 97 |
+
serialize=coerce_string,
|
| 98 |
+
parse_value=coerce_string,
|
| 99 |
+
parse_literal=parse_string_literal)
|
| 100 |
+
|
| 101 |
+
|
| 102 |
+
def parse_boolean_literal(ast):
|
| 103 |
+
if isinstance(ast, BooleanValue):
|
| 104 |
+
return ast.value
|
| 105 |
+
return None
|
| 106 |
+
|
| 107 |
+
|
| 108 |
+
GraphQLBoolean = GraphQLScalarType(
|
| 109 |
+
name='Boolean',
|
| 110 |
+
description='The `Boolean` scalar type represents `true` or `false`.',
|
| 111 |
+
serialize=bool,
|
| 112 |
+
parse_value=bool,
|
| 113 |
+
parse_literal=parse_boolean_literal)
|
| 114 |
+
|
| 115 |
+
|
| 116 |
+
def parse_id_literal(ast):
|
| 117 |
+
if isinstance(ast, (StringValue, IntValue)):
|
| 118 |
+
return ast.value
|
| 119 |
+
return None
|
| 120 |
+
|
| 121 |
+
|
| 122 |
+
GraphQLID = GraphQLScalarType(
|
| 123 |
+
name='ID',
|
| 124 |
+
description='The `ID` scalar type represents a unique identifier, often used to '
|
| 125 |
+
'refetch an object or as key for a cache. The ID type appears in a JSON '
|
| 126 |
+
'response as a String; however, it is not intended to be human-readable. '
|
| 127 |
+
'When expected as an input type, any string (such as `"4"`) or integer '
|
| 128 |
+
'(such as `4`) input value will be accepted as an ID.',
|
| 129 |
+
serialize=coerce_str,
|
| 130 |
+
parse_value=coerce_str,
|
| 131 |
+
parse_literal=parse_id_literal)
|
vllm/lib/python3.10/site-packages/wandb/vendor/graphql-core-1.1/wandb_graphql/type/schema.py
ADDED
|
@@ -0,0 +1,100 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
from collections.abc import Iterable
|
| 2 |
+
|
| 3 |
+
from .definition import GraphQLObjectType
|
| 4 |
+
from .directives import GraphQLDirective, specified_directives
|
| 5 |
+
from .introspection import IntrospectionSchema
|
| 6 |
+
from .typemap import GraphQLTypeMap
|
| 7 |
+
|
| 8 |
+
|
| 9 |
+
class GraphQLSchema(object):
|
| 10 |
+
"""Schema Definition
|
| 11 |
+
|
| 12 |
+
A Schema is created by supplying the root types of each type of operation, query and mutation (optional).
|
| 13 |
+
A schema definition is then supplied to the validator and executor.
|
| 14 |
+
|
| 15 |
+
Example:
|
| 16 |
+
|
| 17 |
+
MyAppSchema = GraphQLSchema(
|
| 18 |
+
query=MyAppQueryRootType,
|
| 19 |
+
mutation=MyAppMutationRootType,
|
| 20 |
+
)
|
| 21 |
+
|
| 22 |
+
Note: If an array of `directives` are provided to GraphQLSchema, that will be
|
| 23 |
+
the exact list of directives represented and allowed. If `directives` is not
|
| 24 |
+
provided then a default set of the specified directives (e.g. @include and
|
| 25 |
+
@skip) will be used. If you wish to provide *additional* directives to these
|
| 26 |
+
specified directives, you must explicitly declare them. Example:
|
| 27 |
+
|
| 28 |
+
MyAppSchema = GraphQLSchema(
|
| 29 |
+
...
|
| 30 |
+
directives=specified_directives.extend([MyCustomerDirective]),
|
| 31 |
+
)
|
| 32 |
+
"""
|
| 33 |
+
__slots__ = '_query', '_mutation', '_subscription', '_type_map', '_directives', '_implementations', '_possible_type_map'
|
| 34 |
+
|
| 35 |
+
def __init__(self, query, mutation=None, subscription=None, directives=None, types=None):
|
| 36 |
+
assert isinstance(query, GraphQLObjectType), 'Schema query must be Object Type but got: {}.'.format(query)
|
| 37 |
+
if mutation:
|
| 38 |
+
assert isinstance(mutation, GraphQLObjectType), \
|
| 39 |
+
'Schema mutation must be Object Type but got: {}.'.format(mutation)
|
| 40 |
+
|
| 41 |
+
if subscription:
|
| 42 |
+
assert isinstance(subscription, GraphQLObjectType), \
|
| 43 |
+
'Schema subscription must be Object Type but got: {}.'.format(subscription)
|
| 44 |
+
|
| 45 |
+
if types:
|
| 46 |
+
assert isinstance(types, Iterable), \
|
| 47 |
+
'Schema types must be iterable if provided but got: {}.'.format(types)
|
| 48 |
+
|
| 49 |
+
self._query = query
|
| 50 |
+
self._mutation = mutation
|
| 51 |
+
self._subscription = subscription
|
| 52 |
+
if directives is None:
|
| 53 |
+
directives = specified_directives
|
| 54 |
+
|
| 55 |
+
assert all(isinstance(d, GraphQLDirective) for d in directives), \
|
| 56 |
+
'Schema directives must be List[GraphQLDirective] if provided but got: {}.'.format(
|
| 57 |
+
directives
|
| 58 |
+
)
|
| 59 |
+
self._directives = directives
|
| 60 |
+
|
| 61 |
+
initial_types = [
|
| 62 |
+
query,
|
| 63 |
+
mutation,
|
| 64 |
+
subscription,
|
| 65 |
+
IntrospectionSchema
|
| 66 |
+
]
|
| 67 |
+
if types:
|
| 68 |
+
initial_types += types
|
| 69 |
+
self._type_map = GraphQLTypeMap(initial_types)
|
| 70 |
+
|
| 71 |
+
def get_query_type(self):
|
| 72 |
+
return self._query
|
| 73 |
+
|
| 74 |
+
def get_mutation_type(self):
|
| 75 |
+
return self._mutation
|
| 76 |
+
|
| 77 |
+
def get_subscription_type(self):
|
| 78 |
+
return self._subscription
|
| 79 |
+
|
| 80 |
+
def get_type_map(self):
|
| 81 |
+
return self._type_map
|
| 82 |
+
|
| 83 |
+
def get_type(self, name):
|
| 84 |
+
return self._type_map.get(name)
|
| 85 |
+
|
| 86 |
+
def get_directives(self):
|
| 87 |
+
return self._directives
|
| 88 |
+
|
| 89 |
+
def get_directive(self, name):
|
| 90 |
+
for directive in self.get_directives():
|
| 91 |
+
if directive.name == name:
|
| 92 |
+
return directive
|
| 93 |
+
|
| 94 |
+
return None
|
| 95 |
+
|
| 96 |
+
def get_possible_types(self, abstract_type):
|
| 97 |
+
return self._type_map.get_possible_types(abstract_type)
|
| 98 |
+
|
| 99 |
+
def is_possible_type(self, abstract_type, possible_type):
|
| 100 |
+
return self._type_map.is_possible_type(abstract_type, possible_type)
|
vllm/lib/python3.10/site-packages/wandb/vendor/graphql-core-1.1/wandb_graphql/type/typemap.py
ADDED
|
@@ -0,0 +1,145 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
from collections import OrderedDict, defaultdict
|
| 2 |
+
from collections.abc import Sequence
|
| 3 |
+
from functools import reduce
|
| 4 |
+
|
| 5 |
+
from ..utils.type_comparators import is_equal_type, is_type_sub_type_of
|
| 6 |
+
from .definition import (GraphQLArgument, GraphQLField,
|
| 7 |
+
GraphQLInputObjectField, GraphQLInputObjectType,
|
| 8 |
+
GraphQLInterfaceType, GraphQLList, GraphQLNonNull,
|
| 9 |
+
GraphQLObjectType, GraphQLUnionType, is_input_type,
|
| 10 |
+
is_output_type)
|
| 11 |
+
|
| 12 |
+
|
| 13 |
+
class GraphQLTypeMap(OrderedDict):
|
| 14 |
+
|
| 15 |
+
def __init__(self, types):
|
| 16 |
+
super(GraphQLTypeMap, self).__init__()
|
| 17 |
+
self.update(reduce(self.reducer, types, OrderedDict()))
|
| 18 |
+
self._possible_type_map = defaultdict(set)
|
| 19 |
+
|
| 20 |
+
# Keep track of all implementations by interface name.
|
| 21 |
+
self._implementations = {}
|
| 22 |
+
for gql_type in self.values():
|
| 23 |
+
if isinstance(gql_type, GraphQLObjectType):
|
| 24 |
+
for interface in gql_type.interfaces:
|
| 25 |
+
self._implementations.setdefault(interface.name, []).append(gql_type)
|
| 26 |
+
|
| 27 |
+
# Enforce correct interface implementations.
|
| 28 |
+
for type in self.values():
|
| 29 |
+
if isinstance(type, GraphQLObjectType):
|
| 30 |
+
for interface in type.interfaces:
|
| 31 |
+
self.assert_object_implements_interface(self, type, interface)
|
| 32 |
+
|
| 33 |
+
def get_possible_types(self, abstract_type):
|
| 34 |
+
if isinstance(abstract_type, GraphQLUnionType):
|
| 35 |
+
return abstract_type.types
|
| 36 |
+
assert isinstance(abstract_type, GraphQLInterfaceType)
|
| 37 |
+
return self._implementations.get(abstract_type.name, None)
|
| 38 |
+
|
| 39 |
+
def is_possible_type(self, abstract_type, possible_type):
|
| 40 |
+
possible_types = self.get_possible_types(abstract_type)
|
| 41 |
+
assert isinstance(possible_types, Sequence), (
|
| 42 |
+
'Could not find possible implementing types for ${} in ' +
|
| 43 |
+
'schema. Check that schema.types is defined and is an array of' +
|
| 44 |
+
'all possible types in the schema.'
|
| 45 |
+
).format(abstract_type)
|
| 46 |
+
|
| 47 |
+
if not self._possible_type_map[abstract_type.name]:
|
| 48 |
+
self._possible_type_map[abstract_type.name].update([p.name for p in possible_types])
|
| 49 |
+
|
| 50 |
+
return possible_type.name in self._possible_type_map[abstract_type.name]
|
| 51 |
+
|
| 52 |
+
@classmethod
|
| 53 |
+
def reducer(cls, map, type):
|
| 54 |
+
if not type:
|
| 55 |
+
return map
|
| 56 |
+
|
| 57 |
+
if isinstance(type, GraphQLList) or isinstance(type, GraphQLNonNull):
|
| 58 |
+
return cls.reducer(map, type.of_type)
|
| 59 |
+
|
| 60 |
+
if type.name in map:
|
| 61 |
+
assert map[type.name] == type, (
|
| 62 |
+
'Schema must contain unique named types but contains multiple types named "{}".'
|
| 63 |
+
).format(type.name)
|
| 64 |
+
|
| 65 |
+
return map
|
| 66 |
+
|
| 67 |
+
map[type.name] = type
|
| 68 |
+
|
| 69 |
+
reduced_map = map
|
| 70 |
+
|
| 71 |
+
if isinstance(type, (GraphQLUnionType)):
|
| 72 |
+
for t in type.types:
|
| 73 |
+
reduced_map = cls.reducer(reduced_map, t)
|
| 74 |
+
|
| 75 |
+
if isinstance(type, GraphQLObjectType):
|
| 76 |
+
for t in type.interfaces:
|
| 77 |
+
reduced_map = cls.reducer(reduced_map, t)
|
| 78 |
+
|
| 79 |
+
if isinstance(type, (GraphQLObjectType, GraphQLInterfaceType, GraphQLInputObjectType)):
|
| 80 |
+
field_map = type.fields
|
| 81 |
+
type_is_input = isinstance(type, GraphQLInputObjectType)
|
| 82 |
+
for field_name, field in field_map.items():
|
| 83 |
+
if type_is_input:
|
| 84 |
+
assert isinstance(field, GraphQLInputObjectField), (
|
| 85 |
+
'{}.{} must be an instance of GraphQLInputObjectField.'.format(type, field_name)
|
| 86 |
+
)
|
| 87 |
+
assert is_input_type(field.type), (
|
| 88 |
+
'{}.{} field type must be Input Type but got: {}.'.format(type, field_name, field.type)
|
| 89 |
+
)
|
| 90 |
+
else:
|
| 91 |
+
assert isinstance(field, (GraphQLField, GraphQLField)), (
|
| 92 |
+
'{}.{} must be an instance of GraphQLField.'.format(type, field_name)
|
| 93 |
+
)
|
| 94 |
+
assert is_output_type(field.type), (
|
| 95 |
+
'{}.{} field type must be Output Type but got: {}.'.format(type, field_name, field.type)
|
| 96 |
+
)
|
| 97 |
+
for arg_name, arg in field.args.items():
|
| 98 |
+
assert isinstance(arg, (GraphQLArgument, GraphQLArgument)), (
|
| 99 |
+
'{}.{}({}:) argument must be an instance of GraphQLArgument.'.format(type, field_name, arg_name)
|
| 100 |
+
)
|
| 101 |
+
assert is_input_type(arg.type), (
|
| 102 |
+
'{}.{}({}:) argument type must be Input Type but got: {}.'.format(type, field_name, arg_name,
|
| 103 |
+
arg.type)
|
| 104 |
+
)
|
| 105 |
+
reduced_map = cls.reducer(reduced_map, arg.type)
|
| 106 |
+
|
| 107 |
+
reduced_map = cls.reducer(reduced_map, getattr(field, 'type', None))
|
| 108 |
+
|
| 109 |
+
return reduced_map
|
| 110 |
+
|
| 111 |
+
@classmethod
|
| 112 |
+
def assert_object_implements_interface(cls, schema, object, interface):
|
| 113 |
+
object_field_map = object.fields
|
| 114 |
+
interface_field_map = interface.fields
|
| 115 |
+
|
| 116 |
+
for field_name, interface_field in interface_field_map.items():
|
| 117 |
+
object_field = object_field_map.get(field_name)
|
| 118 |
+
|
| 119 |
+
assert object_field, '"{}" expects field "{}" but "{}" does not provide it.'.format(
|
| 120 |
+
interface, field_name, object
|
| 121 |
+
)
|
| 122 |
+
|
| 123 |
+
assert is_type_sub_type_of(schema, object_field.type, interface_field.type), (
|
| 124 |
+
'{}.{} expects type "{}" but {}.{} provides type "{}".'
|
| 125 |
+
).format(interface, field_name, interface_field.type, object, field_name, object_field.type)
|
| 126 |
+
|
| 127 |
+
for arg_name, interface_arg in interface_field.args.items():
|
| 128 |
+
object_arg = object_field.args.get(arg_name)
|
| 129 |
+
|
| 130 |
+
assert object_arg, (
|
| 131 |
+
'{}.{} expects argument "{}" but {}.{} does not provide it.'
|
| 132 |
+
).format(interface, field_name, arg_name, object, field_name)
|
| 133 |
+
|
| 134 |
+
assert is_equal_type(interface_arg.type, object_arg.type), (
|
| 135 |
+
'{}.{}({}:) expects type "{}" but {}.{}({}:) provides type "{}".'
|
| 136 |
+
).format(interface, field_name, arg_name, interface_arg.type, object, field_name, arg_name, object_arg.type)
|
| 137 |
+
|
| 138 |
+
for arg_name, object_arg in object_field.args.items():
|
| 139 |
+
interface_arg = interface_field.args.get(arg_name)
|
| 140 |
+
if not interface_arg:
|
| 141 |
+
assert not isinstance(object_arg.type, GraphQLNonNull), (
|
| 142 |
+
'{}.{}({}:) is of required type '
|
| 143 |
+
'"{}" but is not also provided by the '
|
| 144 |
+
'interface {}.{}.'
|
| 145 |
+
).format(object, field_name, arg_name, object_arg.type, interface, field_name)
|
vllm/lib/python3.10/site-packages/wandb/vendor/pynvml/__init__.py
ADDED
|
File without changes
|
vllm/lib/python3.10/site-packages/wandb/vendor/pynvml/__pycache__/__init__.cpython-310.pyc
ADDED
|
Binary file (169 Bytes). View file
|
|
|
vllm/lib/python3.10/site-packages/wandb/vendor/pynvml/pynvml.py
ADDED
|
The diff for this file is too large to render.
See raw diff
|
|
|
vllm/lib/python3.10/site-packages/wandb/vendor/watchdog_0_9_0/wandb_watchdog/__init__.py
ADDED
|
@@ -0,0 +1,17 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
#!/usr/bin/env python
|
| 2 |
+
# -*- coding: utf-8 -*-
|
| 3 |
+
#
|
| 4 |
+
# Copyright 2011 Yesudeep Mangalapilly <yesudeep@gmail.com>
|
| 5 |
+
# Copyright 2012 Google, Inc.
|
| 6 |
+
#
|
| 7 |
+
# Licensed under the Apache License, Version 2.0 (the "License");
|
| 8 |
+
# you may not use this file except in compliance with the License.
|
| 9 |
+
# You may obtain a copy of the License at
|
| 10 |
+
#
|
| 11 |
+
# http://www.apache.org/licenses/LICENSE-2.0
|
| 12 |
+
#
|
| 13 |
+
# Unless required by applicable law or agreed to in writing, software
|
| 14 |
+
# distributed under the License is distributed on an "AS IS" BASIS,
|
| 15 |
+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
| 16 |
+
# See the License for the specific language governing permissions and
|
| 17 |
+
# limitations under the License.
|
vllm/lib/python3.10/site-packages/wandb/vendor/watchdog_0_9_0/wandb_watchdog/events.py
ADDED
|
@@ -0,0 +1,615 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
#!/usr/bin/env python
|
| 2 |
+
# -*- coding: utf-8 -*-
|
| 3 |
+
#
|
| 4 |
+
# Copyright 2011 Yesudeep Mangalapilly <yesudeep@gmail.com>
|
| 5 |
+
# Copyright 2012 Google, Inc.
|
| 6 |
+
#
|
| 7 |
+
# Licensed under the Apache License, Version 2.0 (the "License");
|
| 8 |
+
# you may not use this file except in compliance with the License.
|
| 9 |
+
# You may obtain a copy of the License at
|
| 10 |
+
#
|
| 11 |
+
# http://www.apache.org/licenses/LICENSE-2.0
|
| 12 |
+
#
|
| 13 |
+
# Unless required by applicable law or agreed to in writing, software
|
| 14 |
+
# distributed under the License is distributed on an "AS IS" BASIS,
|
| 15 |
+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
| 16 |
+
# See the License for the specific language governing permissions and
|
| 17 |
+
# limitations under the License.
|
| 18 |
+
|
| 19 |
+
"""
|
| 20 |
+
:module: watchdog.events
|
| 21 |
+
:synopsis: File system events and event handlers.
|
| 22 |
+
:author: yesudeep@google.com (Yesudeep Mangalapilly)
|
| 23 |
+
|
| 24 |
+
Event Classes
|
| 25 |
+
-------------
|
| 26 |
+
.. autoclass:: FileSystemEvent
|
| 27 |
+
:members:
|
| 28 |
+
:show-inheritance:
|
| 29 |
+
:inherited-members:
|
| 30 |
+
|
| 31 |
+
.. autoclass:: FileSystemMovedEvent
|
| 32 |
+
:members:
|
| 33 |
+
:show-inheritance:
|
| 34 |
+
|
| 35 |
+
.. autoclass:: FileMovedEvent
|
| 36 |
+
:members:
|
| 37 |
+
:show-inheritance:
|
| 38 |
+
|
| 39 |
+
.. autoclass:: DirMovedEvent
|
| 40 |
+
:members:
|
| 41 |
+
:show-inheritance:
|
| 42 |
+
|
| 43 |
+
.. autoclass:: FileModifiedEvent
|
| 44 |
+
:members:
|
| 45 |
+
:show-inheritance:
|
| 46 |
+
|
| 47 |
+
.. autoclass:: DirModifiedEvent
|
| 48 |
+
:members:
|
| 49 |
+
:show-inheritance:
|
| 50 |
+
|
| 51 |
+
.. autoclass:: FileCreatedEvent
|
| 52 |
+
:members:
|
| 53 |
+
:show-inheritance:
|
| 54 |
+
|
| 55 |
+
.. autoclass:: DirCreatedEvent
|
| 56 |
+
:members:
|
| 57 |
+
:show-inheritance:
|
| 58 |
+
|
| 59 |
+
.. autoclass:: FileDeletedEvent
|
| 60 |
+
:members:
|
| 61 |
+
:show-inheritance:
|
| 62 |
+
|
| 63 |
+
.. autoclass:: DirDeletedEvent
|
| 64 |
+
:members:
|
| 65 |
+
:show-inheritance:
|
| 66 |
+
|
| 67 |
+
|
| 68 |
+
Event Handler Classes
|
| 69 |
+
---------------------
|
| 70 |
+
.. autoclass:: FileSystemEventHandler
|
| 71 |
+
:members:
|
| 72 |
+
:show-inheritance:
|
| 73 |
+
|
| 74 |
+
.. autoclass:: PatternMatchingEventHandler
|
| 75 |
+
:members:
|
| 76 |
+
:show-inheritance:
|
| 77 |
+
|
| 78 |
+
.. autoclass:: RegexMatchingEventHandler
|
| 79 |
+
:members:
|
| 80 |
+
:show-inheritance:
|
| 81 |
+
|
| 82 |
+
.. autoclass:: LoggingEventHandler
|
| 83 |
+
:members:
|
| 84 |
+
:show-inheritance:
|
| 85 |
+
|
| 86 |
+
"""
|
| 87 |
+
|
| 88 |
+
import os.path
|
| 89 |
+
import logging
|
| 90 |
+
import re
|
| 91 |
+
from .patterns import match_any_paths
|
| 92 |
+
from wandb_watchdog.utils import has_attribute
|
| 93 |
+
from wandb_watchdog.utils import unicode_paths
|
| 94 |
+
|
| 95 |
+
|
| 96 |
+
EVENT_TYPE_MOVED = 'moved'
|
| 97 |
+
EVENT_TYPE_DELETED = 'deleted'
|
| 98 |
+
EVENT_TYPE_CREATED = 'created'
|
| 99 |
+
EVENT_TYPE_MODIFIED = 'modified'
|
| 100 |
+
|
| 101 |
+
|
| 102 |
+
class FileSystemEvent(object):
|
| 103 |
+
"""
|
| 104 |
+
Immutable type that represents a file system event that is triggered
|
| 105 |
+
when a change occurs on the monitored file system.
|
| 106 |
+
|
| 107 |
+
All FileSystemEvent objects are required to be immutable and hence
|
| 108 |
+
can be used as keys in dictionaries or be added to sets.
|
| 109 |
+
"""
|
| 110 |
+
|
| 111 |
+
event_type = None
|
| 112 |
+
"""The type of the event as a string."""
|
| 113 |
+
|
| 114 |
+
is_directory = False
|
| 115 |
+
"""True if event was emitted for a directory; False otherwise."""
|
| 116 |
+
|
| 117 |
+
def __init__(self, src_path):
|
| 118 |
+
self._src_path = src_path
|
| 119 |
+
|
| 120 |
+
@property
|
| 121 |
+
def src_path(self):
|
| 122 |
+
"""Source path of the file system object that triggered this event."""
|
| 123 |
+
return self._src_path
|
| 124 |
+
|
| 125 |
+
def __str__(self):
|
| 126 |
+
return self.__repr__()
|
| 127 |
+
|
| 128 |
+
def __repr__(self):
|
| 129 |
+
return ("<%(class_name)s: event_type=%(event_type)s, "
|
| 130 |
+
"src_path=%(src_path)r, "
|
| 131 |
+
"is_directory=%(is_directory)s>"
|
| 132 |
+
) % (dict(
|
| 133 |
+
class_name=self.__class__.__name__,
|
| 134 |
+
event_type=self.event_type,
|
| 135 |
+
src_path=self.src_path,
|
| 136 |
+
is_directory=self.is_directory))
|
| 137 |
+
|
| 138 |
+
# Used for comparison of events.
|
| 139 |
+
@property
|
| 140 |
+
def key(self):
|
| 141 |
+
return (self.event_type, self.src_path, self.is_directory)
|
| 142 |
+
|
| 143 |
+
def __eq__(self, event):
|
| 144 |
+
return self.key == event.key
|
| 145 |
+
|
| 146 |
+
def __ne__(self, event):
|
| 147 |
+
return self.key != event.key
|
| 148 |
+
|
| 149 |
+
def __hash__(self):
|
| 150 |
+
return hash(self.key)
|
| 151 |
+
|
| 152 |
+
|
| 153 |
+
class FileSystemMovedEvent(FileSystemEvent):
|
| 154 |
+
"""
|
| 155 |
+
File system event representing any kind of file system movement.
|
| 156 |
+
"""
|
| 157 |
+
|
| 158 |
+
event_type = EVENT_TYPE_MOVED
|
| 159 |
+
|
| 160 |
+
def __init__(self, src_path, dest_path):
|
| 161 |
+
super(FileSystemMovedEvent, self).__init__(src_path)
|
| 162 |
+
self._dest_path = dest_path
|
| 163 |
+
|
| 164 |
+
@property
|
| 165 |
+
def dest_path(self):
|
| 166 |
+
"""The destination path of the move event."""
|
| 167 |
+
return self._dest_path
|
| 168 |
+
|
| 169 |
+
# Used for hashing this as an immutable object.
|
| 170 |
+
@property
|
| 171 |
+
def key(self):
|
| 172 |
+
return (self.event_type, self.src_path, self.dest_path, self.is_directory)
|
| 173 |
+
|
| 174 |
+
def __repr__(self):
|
| 175 |
+
return ("<%(class_name)s: src_path=%(src_path)r, "
|
| 176 |
+
"dest_path=%(dest_path)r, "
|
| 177 |
+
"is_directory=%(is_directory)s>"
|
| 178 |
+
) % (dict(class_name=self.__class__.__name__,
|
| 179 |
+
src_path=self.src_path,
|
| 180 |
+
dest_path=self.dest_path,
|
| 181 |
+
is_directory=self.is_directory))
|
| 182 |
+
|
| 183 |
+
|
| 184 |
+
# File events.
|
| 185 |
+
|
| 186 |
+
|
| 187 |
+
class FileDeletedEvent(FileSystemEvent):
|
| 188 |
+
"""File system event representing file deletion on the file system."""
|
| 189 |
+
|
| 190 |
+
event_type = EVENT_TYPE_DELETED
|
| 191 |
+
|
| 192 |
+
def __init__(self, src_path):
|
| 193 |
+
super(FileDeletedEvent, self).__init__(src_path)
|
| 194 |
+
|
| 195 |
+
def __repr__(self):
|
| 196 |
+
return "<%(class_name)s: src_path=%(src_path)r>" %\
|
| 197 |
+
dict(class_name=self.__class__.__name__,
|
| 198 |
+
src_path=self.src_path)
|
| 199 |
+
|
| 200 |
+
|
| 201 |
+
class FileModifiedEvent(FileSystemEvent):
|
| 202 |
+
"""File system event representing file modification on the file system."""
|
| 203 |
+
|
| 204 |
+
event_type = EVENT_TYPE_MODIFIED
|
| 205 |
+
|
| 206 |
+
def __init__(self, src_path):
|
| 207 |
+
super(FileModifiedEvent, self).__init__(src_path)
|
| 208 |
+
|
| 209 |
+
def __repr__(self):
|
| 210 |
+
return ("<%(class_name)s: src_path=%(src_path)r>"
|
| 211 |
+
) % (dict(class_name=self.__class__.__name__,
|
| 212 |
+
src_path=self.src_path))
|
| 213 |
+
|
| 214 |
+
|
| 215 |
+
class FileCreatedEvent(FileSystemEvent):
|
| 216 |
+
"""File system event representing file creation on the file system."""
|
| 217 |
+
|
| 218 |
+
event_type = EVENT_TYPE_CREATED
|
| 219 |
+
|
| 220 |
+
def __init__(self, src_path):
|
| 221 |
+
super(FileCreatedEvent, self).__init__(src_path)
|
| 222 |
+
|
| 223 |
+
def __repr__(self):
|
| 224 |
+
return ("<%(class_name)s: src_path=%(src_path)r>"
|
| 225 |
+
) % (dict(class_name=self.__class__.__name__,
|
| 226 |
+
src_path=self.src_path))
|
| 227 |
+
|
| 228 |
+
|
| 229 |
+
class FileMovedEvent(FileSystemMovedEvent):
|
| 230 |
+
"""File system event representing file movement on the file system."""
|
| 231 |
+
|
| 232 |
+
def __init__(self, src_path, dest_path):
|
| 233 |
+
super(FileMovedEvent, self).__init__(src_path, dest_path)
|
| 234 |
+
|
| 235 |
+
def __repr__(self):
|
| 236 |
+
return ("<%(class_name)s: src_path=%(src_path)r, "
|
| 237 |
+
"dest_path=%(dest_path)r>"
|
| 238 |
+
) % (dict(class_name=self.__class__.__name__,
|
| 239 |
+
src_path=self.src_path,
|
| 240 |
+
dest_path=self.dest_path))
|
| 241 |
+
|
| 242 |
+
|
| 243 |
+
# Directory events.
|
| 244 |
+
|
| 245 |
+
|
| 246 |
+
class DirDeletedEvent(FileSystemEvent):
|
| 247 |
+
"""File system event representing directory deletion on the file system."""
|
| 248 |
+
|
| 249 |
+
event_type = EVENT_TYPE_DELETED
|
| 250 |
+
is_directory = True
|
| 251 |
+
|
| 252 |
+
def __init__(self, src_path):
|
| 253 |
+
super(DirDeletedEvent, self).__init__(src_path)
|
| 254 |
+
|
| 255 |
+
def __repr__(self):
|
| 256 |
+
return ("<%(class_name)s: src_path=%(src_path)r>"
|
| 257 |
+
) % (dict(class_name=self.__class__.__name__,
|
| 258 |
+
src_path=self.src_path))
|
| 259 |
+
|
| 260 |
+
|
| 261 |
+
class DirModifiedEvent(FileSystemEvent):
|
| 262 |
+
"""
|
| 263 |
+
File system event representing directory modification on the file system.
|
| 264 |
+
"""
|
| 265 |
+
|
| 266 |
+
event_type = EVENT_TYPE_MODIFIED
|
| 267 |
+
is_directory = True
|
| 268 |
+
|
| 269 |
+
def __init__(self, src_path):
|
| 270 |
+
super(DirModifiedEvent, self).__init__(src_path)
|
| 271 |
+
|
| 272 |
+
def __repr__(self):
|
| 273 |
+
return ("<%(class_name)s: src_path=%(src_path)r>"
|
| 274 |
+
) % (dict(class_name=self.__class__.__name__,
|
| 275 |
+
src_path=self.src_path))
|
| 276 |
+
|
| 277 |
+
|
| 278 |
+
class DirCreatedEvent(FileSystemEvent):
|
| 279 |
+
"""File system event representing directory creation on the file system."""
|
| 280 |
+
|
| 281 |
+
event_type = EVENT_TYPE_CREATED
|
| 282 |
+
is_directory = True
|
| 283 |
+
|
| 284 |
+
def __init__(self, src_path):
|
| 285 |
+
super(DirCreatedEvent, self).__init__(src_path)
|
| 286 |
+
|
| 287 |
+
def __repr__(self):
|
| 288 |
+
return ("<%(class_name)s: src_path=%(src_path)r>"
|
| 289 |
+
) % (dict(class_name=self.__class__.__name__,
|
| 290 |
+
src_path=self.src_path))
|
| 291 |
+
|
| 292 |
+
|
| 293 |
+
class DirMovedEvent(FileSystemMovedEvent):
|
| 294 |
+
"""File system event representing directory movement on the file system."""
|
| 295 |
+
|
| 296 |
+
is_directory = True
|
| 297 |
+
|
| 298 |
+
def __init__(self, src_path, dest_path):
|
| 299 |
+
super(DirMovedEvent, self).__init__(src_path, dest_path)
|
| 300 |
+
|
| 301 |
+
def __repr__(self):
|
| 302 |
+
return ("<%(class_name)s: src_path=%(src_path)r, "
|
| 303 |
+
"dest_path=%(dest_path)r>"
|
| 304 |
+
) % (dict(class_name=self.__class__.__name__,
|
| 305 |
+
src_path=self.src_path,
|
| 306 |
+
dest_path=self.dest_path))
|
| 307 |
+
|
| 308 |
+
|
| 309 |
+
class FileSystemEventHandler(object):
|
| 310 |
+
"""
|
| 311 |
+
Base file system event handler that you can override methods from.
|
| 312 |
+
"""
|
| 313 |
+
|
| 314 |
+
def dispatch(self, event):
|
| 315 |
+
"""Dispatches events to the appropriate methods.
|
| 316 |
+
|
| 317 |
+
:param event:
|
| 318 |
+
The event object representing the file system event.
|
| 319 |
+
:type event:
|
| 320 |
+
:class:`FileSystemEvent`
|
| 321 |
+
"""
|
| 322 |
+
self.on_any_event(event)
|
| 323 |
+
_method_map = {
|
| 324 |
+
EVENT_TYPE_MODIFIED: self.on_modified,
|
| 325 |
+
EVENT_TYPE_MOVED: self.on_moved,
|
| 326 |
+
EVENT_TYPE_CREATED: self.on_created,
|
| 327 |
+
EVENT_TYPE_DELETED: self.on_deleted,
|
| 328 |
+
}
|
| 329 |
+
event_type = event.event_type
|
| 330 |
+
_method_map[event_type](event)
|
| 331 |
+
|
| 332 |
+
def on_any_event(self, event):
|
| 333 |
+
"""Catch-all event handler.
|
| 334 |
+
|
| 335 |
+
:param event:
|
| 336 |
+
The event object representing the file system event.
|
| 337 |
+
:type event:
|
| 338 |
+
:class:`FileSystemEvent`
|
| 339 |
+
"""
|
| 340 |
+
|
| 341 |
+
def on_moved(self, event):
|
| 342 |
+
"""Called when a file or a directory is moved or renamed.
|
| 343 |
+
|
| 344 |
+
:param event:
|
| 345 |
+
Event representing file/directory movement.
|
| 346 |
+
:type event:
|
| 347 |
+
:class:`DirMovedEvent` or :class:`FileMovedEvent`
|
| 348 |
+
"""
|
| 349 |
+
|
| 350 |
+
def on_created(self, event):
|
| 351 |
+
"""Called when a file or directory is created.
|
| 352 |
+
|
| 353 |
+
:param event:
|
| 354 |
+
Event representing file/directory creation.
|
| 355 |
+
:type event:
|
| 356 |
+
:class:`DirCreatedEvent` or :class:`FileCreatedEvent`
|
| 357 |
+
"""
|
| 358 |
+
|
| 359 |
+
def on_deleted(self, event):
|
| 360 |
+
"""Called when a file or directory is deleted.
|
| 361 |
+
|
| 362 |
+
:param event:
|
| 363 |
+
Event representing file/directory deletion.
|
| 364 |
+
:type event:
|
| 365 |
+
:class:`DirDeletedEvent` or :class:`FileDeletedEvent`
|
| 366 |
+
"""
|
| 367 |
+
|
| 368 |
+
def on_modified(self, event):
|
| 369 |
+
"""Called when a file or directory is modified.
|
| 370 |
+
|
| 371 |
+
:param event:
|
| 372 |
+
Event representing file/directory modification.
|
| 373 |
+
:type event:
|
| 374 |
+
:class:`DirModifiedEvent` or :class:`FileModifiedEvent`
|
| 375 |
+
"""
|
| 376 |
+
|
| 377 |
+
|
| 378 |
+
class PatternMatchingEventHandler(FileSystemEventHandler):
|
| 379 |
+
"""
|
| 380 |
+
Matches given patterns with file paths associated with occurring events.
|
| 381 |
+
"""
|
| 382 |
+
|
| 383 |
+
def __init__(self, patterns=None, ignore_patterns=None,
|
| 384 |
+
ignore_directories=False, case_sensitive=False):
|
| 385 |
+
super(PatternMatchingEventHandler, self).__init__()
|
| 386 |
+
|
| 387 |
+
self._patterns = patterns
|
| 388 |
+
self._ignore_patterns = ignore_patterns
|
| 389 |
+
self._ignore_directories = ignore_directories
|
| 390 |
+
self._case_sensitive = case_sensitive
|
| 391 |
+
|
| 392 |
+
@property
|
| 393 |
+
def patterns(self):
|
| 394 |
+
"""
|
| 395 |
+
(Read-only)
|
| 396 |
+
Patterns to allow matching event paths.
|
| 397 |
+
"""
|
| 398 |
+
return self._patterns
|
| 399 |
+
|
| 400 |
+
@property
|
| 401 |
+
def ignore_patterns(self):
|
| 402 |
+
"""
|
| 403 |
+
(Read-only)
|
| 404 |
+
Patterns to ignore matching event paths.
|
| 405 |
+
"""
|
| 406 |
+
return self._ignore_patterns
|
| 407 |
+
|
| 408 |
+
@property
|
| 409 |
+
def ignore_directories(self):
|
| 410 |
+
"""
|
| 411 |
+
(Read-only)
|
| 412 |
+
``True`` if directories should be ignored; ``False`` otherwise.
|
| 413 |
+
"""
|
| 414 |
+
return self._ignore_directories
|
| 415 |
+
|
| 416 |
+
@property
|
| 417 |
+
def case_sensitive(self):
|
| 418 |
+
"""
|
| 419 |
+
(Read-only)
|
| 420 |
+
``True`` if path names should be matched sensitive to case; ``False``
|
| 421 |
+
otherwise.
|
| 422 |
+
"""
|
| 423 |
+
return self._case_sensitive
|
| 424 |
+
|
| 425 |
+
def dispatch(self, event):
|
| 426 |
+
"""Dispatches events to the appropriate methods.
|
| 427 |
+
|
| 428 |
+
:param event:
|
| 429 |
+
The event object representing the file system event.
|
| 430 |
+
:type event:
|
| 431 |
+
:class:`FileSystemEvent`
|
| 432 |
+
"""
|
| 433 |
+
if self.ignore_directories and event.is_directory:
|
| 434 |
+
return
|
| 435 |
+
|
| 436 |
+
paths = []
|
| 437 |
+
if has_attribute(event, 'dest_path'):
|
| 438 |
+
paths.append(unicode_paths.decode(event.dest_path))
|
| 439 |
+
if event.src_path:
|
| 440 |
+
paths.append(unicode_paths.decode(event.src_path))
|
| 441 |
+
|
| 442 |
+
if match_any_paths(paths,
|
| 443 |
+
included_patterns=self.patterns,
|
| 444 |
+
excluded_patterns=self.ignore_patterns,
|
| 445 |
+
case_sensitive=self.case_sensitive):
|
| 446 |
+
self.on_any_event(event)
|
| 447 |
+
_method_map = {
|
| 448 |
+
EVENT_TYPE_MODIFIED: self.on_modified,
|
| 449 |
+
EVENT_TYPE_MOVED: self.on_moved,
|
| 450 |
+
EVENT_TYPE_CREATED: self.on_created,
|
| 451 |
+
EVENT_TYPE_DELETED: self.on_deleted,
|
| 452 |
+
}
|
| 453 |
+
event_type = event.event_type
|
| 454 |
+
_method_map[event_type](event)
|
| 455 |
+
|
| 456 |
+
|
| 457 |
+
class RegexMatchingEventHandler(FileSystemEventHandler):
|
| 458 |
+
"""
|
| 459 |
+
Matches given regexes with file paths associated with occurring events.
|
| 460 |
+
"""
|
| 461 |
+
|
| 462 |
+
def __init__(self, regexes=[r".*"], ignore_regexes=[],
|
| 463 |
+
ignore_directories=False, case_sensitive=False):
|
| 464 |
+
super(RegexMatchingEventHandler, self).__init__()
|
| 465 |
+
|
| 466 |
+
if case_sensitive:
|
| 467 |
+
self._regexes = [re.compile(r) for r in regexes]
|
| 468 |
+
self._ignore_regexes = [re.compile(r) for r in ignore_regexes]
|
| 469 |
+
else:
|
| 470 |
+
self._regexes = [re.compile(r, re.I) for r in regexes]
|
| 471 |
+
self._ignore_regexes = [re.compile(r, re.I) for r in ignore_regexes]
|
| 472 |
+
self._ignore_directories = ignore_directories
|
| 473 |
+
self._case_sensitive = case_sensitive
|
| 474 |
+
|
| 475 |
+
@property
|
| 476 |
+
def regexes(self):
|
| 477 |
+
"""
|
| 478 |
+
(Read-only)
|
| 479 |
+
Regexes to allow matching event paths.
|
| 480 |
+
"""
|
| 481 |
+
return self._regexes
|
| 482 |
+
|
| 483 |
+
@property
|
| 484 |
+
def ignore_regexes(self):
|
| 485 |
+
"""
|
| 486 |
+
(Read-only)
|
| 487 |
+
Regexes to ignore matching event paths.
|
| 488 |
+
"""
|
| 489 |
+
return self._ignore_regexes
|
| 490 |
+
|
| 491 |
+
@property
|
| 492 |
+
def ignore_directories(self):
|
| 493 |
+
"""
|
| 494 |
+
(Read-only)
|
| 495 |
+
``True`` if directories should be ignored; ``False`` otherwise.
|
| 496 |
+
"""
|
| 497 |
+
return self._ignore_directories
|
| 498 |
+
|
| 499 |
+
@property
|
| 500 |
+
def case_sensitive(self):
|
| 501 |
+
"""
|
| 502 |
+
(Read-only)
|
| 503 |
+
``True`` if path names should be matched sensitive to case; ``False``
|
| 504 |
+
otherwise.
|
| 505 |
+
"""
|
| 506 |
+
return self._case_sensitive
|
| 507 |
+
|
| 508 |
+
def dispatch(self, event):
|
| 509 |
+
"""Dispatches events to the appropriate methods.
|
| 510 |
+
|
| 511 |
+
:param event:
|
| 512 |
+
The event object representing the file system event.
|
| 513 |
+
:type event:
|
| 514 |
+
:class:`FileSystemEvent`
|
| 515 |
+
"""
|
| 516 |
+
if self.ignore_directories and event.is_directory:
|
| 517 |
+
return
|
| 518 |
+
|
| 519 |
+
paths = []
|
| 520 |
+
if has_attribute(event, 'dest_path'):
|
| 521 |
+
paths.append(unicode_paths.decode(event.dest_path))
|
| 522 |
+
if event.src_path:
|
| 523 |
+
paths.append(unicode_paths.decode(event.src_path))
|
| 524 |
+
|
| 525 |
+
if any(r.match(p) for r in self.ignore_regexes for p in paths):
|
| 526 |
+
return
|
| 527 |
+
|
| 528 |
+
if any(r.match(p) for r in self.regexes for p in paths):
|
| 529 |
+
self.on_any_event(event)
|
| 530 |
+
_method_map = {
|
| 531 |
+
EVENT_TYPE_MODIFIED: self.on_modified,
|
| 532 |
+
EVENT_TYPE_MOVED: self.on_moved,
|
| 533 |
+
EVENT_TYPE_CREATED: self.on_created,
|
| 534 |
+
EVENT_TYPE_DELETED: self.on_deleted,
|
| 535 |
+
}
|
| 536 |
+
event_type = event.event_type
|
| 537 |
+
_method_map[event_type](event)
|
| 538 |
+
|
| 539 |
+
|
| 540 |
+
class LoggingEventHandler(FileSystemEventHandler):
|
| 541 |
+
"""Logs all the events captured."""
|
| 542 |
+
|
| 543 |
+
def on_moved(self, event):
|
| 544 |
+
super(LoggingEventHandler, self).on_moved(event)
|
| 545 |
+
|
| 546 |
+
what = 'directory' if event.is_directory else 'file'
|
| 547 |
+
logging.info("Moved %s: from %s to %s", what, event.src_path,
|
| 548 |
+
event.dest_path)
|
| 549 |
+
|
| 550 |
+
def on_created(self, event):
|
| 551 |
+
super(LoggingEventHandler, self).on_created(event)
|
| 552 |
+
|
| 553 |
+
what = 'directory' if event.is_directory else 'file'
|
| 554 |
+
logging.info("Created %s: %s", what, event.src_path)
|
| 555 |
+
|
| 556 |
+
def on_deleted(self, event):
|
| 557 |
+
super(LoggingEventHandler, self).on_deleted(event)
|
| 558 |
+
|
| 559 |
+
what = 'directory' if event.is_directory else 'file'
|
| 560 |
+
logging.info("Deleted %s: %s", what, event.src_path)
|
| 561 |
+
|
| 562 |
+
def on_modified(self, event):
|
| 563 |
+
super(LoggingEventHandler, self).on_modified(event)
|
| 564 |
+
|
| 565 |
+
what = 'directory' if event.is_directory else 'file'
|
| 566 |
+
logging.info("Modified %s: %s", what, event.src_path)
|
| 567 |
+
|
| 568 |
+
|
| 569 |
+
class LoggingFileSystemEventHandler(LoggingEventHandler):
|
| 570 |
+
"""
|
| 571 |
+
For backwards-compatibility. Please use :class:`LoggingEventHandler`
|
| 572 |
+
instead.
|
| 573 |
+
"""
|
| 574 |
+
|
| 575 |
+
|
| 576 |
+
def generate_sub_moved_events(src_dir_path, dest_dir_path):
|
| 577 |
+
"""Generates an event list of :class:`DirMovedEvent` and
|
| 578 |
+
:class:`FileMovedEvent` objects for all the files and directories within
|
| 579 |
+
the given moved directory that were moved along with the directory.
|
| 580 |
+
|
| 581 |
+
:param src_dir_path:
|
| 582 |
+
The source path of the moved directory.
|
| 583 |
+
:param dest_dir_path:
|
| 584 |
+
The destination path of the moved directory.
|
| 585 |
+
:returns:
|
| 586 |
+
An iterable of file system events of type :class:`DirMovedEvent` and
|
| 587 |
+
:class:`FileMovedEvent`.
|
| 588 |
+
"""
|
| 589 |
+
for root, directories, filenames in os.walk(dest_dir_path):
|
| 590 |
+
for directory in directories:
|
| 591 |
+
full_path = os.path.join(root, directory)
|
| 592 |
+
renamed_path = full_path.replace(dest_dir_path, src_dir_path) if src_dir_path else None
|
| 593 |
+
yield DirMovedEvent(renamed_path, full_path)
|
| 594 |
+
for filename in filenames:
|
| 595 |
+
full_path = os.path.join(root, filename)
|
| 596 |
+
renamed_path = full_path.replace(dest_dir_path, src_dir_path) if src_dir_path else None
|
| 597 |
+
yield FileMovedEvent(renamed_path, full_path)
|
| 598 |
+
|
| 599 |
+
|
| 600 |
+
def generate_sub_created_events(src_dir_path):
|
| 601 |
+
"""Generates an event list of :class:`DirCreatedEvent` and
|
| 602 |
+
:class:`FileCreatedEvent` objects for all the files and directories within
|
| 603 |
+
the given moved directory that were moved along with the directory.
|
| 604 |
+
|
| 605 |
+
:param src_dir_path:
|
| 606 |
+
The source path of the created directory.
|
| 607 |
+
:returns:
|
| 608 |
+
An iterable of file system events of type :class:`DirCreatedEvent` and
|
| 609 |
+
:class:`FileCreatedEvent`.
|
| 610 |
+
"""
|
| 611 |
+
for root, directories, filenames in os.walk(src_dir_path):
|
| 612 |
+
for directory in directories:
|
| 613 |
+
yield DirCreatedEvent(os.path.join(root, directory))
|
| 614 |
+
for filename in filenames:
|
| 615 |
+
yield FileCreatedEvent(os.path.join(root, filename))
|
vllm/lib/python3.10/site-packages/wandb/vendor/watchdog_0_9_0/wandb_watchdog/observers/__init__.py
ADDED
|
@@ -0,0 +1,98 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
#!/usr/bin/env python
|
| 2 |
+
# -*- coding: utf-8 -*-
|
| 3 |
+
#
|
| 4 |
+
# Copyright 2011 Yesudeep Mangalapilly <yesudeep@gmail.com>
|
| 5 |
+
# Copyright 2012 Google, Inc.
|
| 6 |
+
#
|
| 7 |
+
# Licensed under the Apache License, Version 2.0 (the "License");
|
| 8 |
+
# you may not use this file except in compliance with the License.
|
| 9 |
+
# You may obtain a copy of the License at
|
| 10 |
+
#
|
| 11 |
+
# http://www.apache.org/licenses/LICENSE-2.0
|
| 12 |
+
#
|
| 13 |
+
# Unless required by applicable law or agreed to in writing, software
|
| 14 |
+
# distributed under the License is distributed on an "AS IS" BASIS,
|
| 15 |
+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
| 16 |
+
# See the License for the specific language governing permissions and
|
| 17 |
+
# limitations under the License.
|
| 18 |
+
|
| 19 |
+
"""
|
| 20 |
+
:module: watchdog.observers
|
| 21 |
+
:synopsis: Observer that picks a native implementation if available.
|
| 22 |
+
:author: yesudeep@google.com (Yesudeep Mangalapilly)
|
| 23 |
+
|
| 24 |
+
|
| 25 |
+
Classes
|
| 26 |
+
=======
|
| 27 |
+
.. autoclass:: Observer
|
| 28 |
+
:members:
|
| 29 |
+
:show-inheritance:
|
| 30 |
+
:inherited-members:
|
| 31 |
+
|
| 32 |
+
Observer thread that schedules watching directories and dispatches
|
| 33 |
+
calls to event handlers.
|
| 34 |
+
|
| 35 |
+
You can also import platform specific classes directly and use it instead
|
| 36 |
+
of :class:`Observer`. Here is a list of implemented observer classes.:
|
| 37 |
+
|
| 38 |
+
============== ================================ ==============================
|
| 39 |
+
Class Platforms Note
|
| 40 |
+
============== ================================ ==============================
|
| 41 |
+
|Inotify| Linux 2.6.13+ ``inotify(7)`` based observer
|
| 42 |
+
|FSEvents| Mac OS X FSEvents based observer
|
| 43 |
+
|Kqueue| Mac OS X and BSD with kqueue(2) ``kqueue(2)`` based observer
|
| 44 |
+
|WinApi| MS Windows Windows API-based observer
|
| 45 |
+
|Polling| Any fallback implementation
|
| 46 |
+
============== ================================ ==============================
|
| 47 |
+
|
| 48 |
+
.. |Inotify| replace:: :class:`.inotify.InotifyObserver`
|
| 49 |
+
.. |FSEvents| replace:: :class:`.fsevents.FSEventsObserver`
|
| 50 |
+
.. |Kqueue| replace:: :class:`.kqueue.KqueueObserver`
|
| 51 |
+
.. |WinApi| replace:: :class:`.read_directory_changes.WindowsApiObserver`
|
| 52 |
+
.. |WinApiAsync| replace:: :class:`.read_directory_changes_async.WindowsApiAsyncObserver`
|
| 53 |
+
.. |Polling| replace:: :class:`.polling.PollingObserver`
|
| 54 |
+
|
| 55 |
+
"""
|
| 56 |
+
|
| 57 |
+
import warnings
|
| 58 |
+
from wandb_watchdog.utils import platform
|
| 59 |
+
from wandb_watchdog.utils import UnsupportedLibc
|
| 60 |
+
|
| 61 |
+
if platform.is_linux():
|
| 62 |
+
try:
|
| 63 |
+
from .inotify import InotifyObserver as Observer
|
| 64 |
+
except UnsupportedLibc:
|
| 65 |
+
from .polling import PollingObserver as Observer
|
| 66 |
+
|
| 67 |
+
elif platform.is_darwin():
|
| 68 |
+
# FIXME: catching too broad. Error prone
|
| 69 |
+
try:
|
| 70 |
+
from .fsevents import FSEventsObserver as Observer
|
| 71 |
+
except:
|
| 72 |
+
try:
|
| 73 |
+
from .kqueue import KqueueObserver as Observer
|
| 74 |
+
# Note: (tim): Commenting out these warnings since the _watchdog_fsevents
|
| 75 |
+
# module is not available unless installed directly.
|
| 76 |
+
# warnings.warn("Failed to import fsevents. Fall back to kqueue")
|
| 77 |
+
except:
|
| 78 |
+
from .polling import PollingObserver as Observer
|
| 79 |
+
# Note: (tim): Commenting out these warnings since the _watchdog_fsevents
|
| 80 |
+
# module is not available unless installed directly.
|
| 81 |
+
# warnings.warn("Failed to import fsevents and kqueue. Fall back to polling.")
|
| 82 |
+
|
| 83 |
+
elif platform.is_bsd():
|
| 84 |
+
from .kqueue import KqueueObserver as Observer
|
| 85 |
+
|
| 86 |
+
elif platform.is_windows():
|
| 87 |
+
# TODO: find a reliable way of checking Windows version and import
|
| 88 |
+
# polling explicitly for Windows XP
|
| 89 |
+
try:
|
| 90 |
+
from .read_directory_changes import WindowsApiObserver as Observer
|
| 91 |
+
except:
|
| 92 |
+
from .polling import PollingObserver as Observer
|
| 93 |
+
warnings.warn("Failed to import read_directory_changes. Fall back to polling.")
|
| 94 |
+
|
| 95 |
+
else:
|
| 96 |
+
from .polling import PollingObserver as Observer
|
| 97 |
+
|
| 98 |
+
__all__ = ["Observer"]
|
vllm/lib/python3.10/site-packages/wandb/vendor/watchdog_0_9_0/wandb_watchdog/observers/__pycache__/__init__.cpython-310.pyc
ADDED
|
Binary file (2.51 kB). View file
|
|
|
vllm/lib/python3.10/site-packages/wandb/vendor/watchdog_0_9_0/wandb_watchdog/observers/__pycache__/api.cpython-310.pyc
ADDED
|
Binary file (12.8 kB). View file
|
|
|
vllm/lib/python3.10/site-packages/wandb/vendor/watchdog_0_9_0/wandb_watchdog/observers/__pycache__/fsevents.cpython-310.pyc
ADDED
|
Binary file (3.93 kB). View file
|
|
|
vllm/lib/python3.10/site-packages/wandb/vendor/watchdog_0_9_0/wandb_watchdog/observers/__pycache__/fsevents2.cpython-310.pyc
ADDED
|
Binary file (7.08 kB). View file
|
|
|
vllm/lib/python3.10/site-packages/wandb/vendor/watchdog_0_9_0/wandb_watchdog/observers/__pycache__/inotify.cpython-310.pyc
ADDED
|
Binary file (7.1 kB). View file
|
|
|
vllm/lib/python3.10/site-packages/wandb/vendor/watchdog_0_9_0/wandb_watchdog/observers/__pycache__/inotify_buffer.cpython-310.pyc
ADDED
|
Binary file (2.64 kB). View file
|
|
|
vllm/lib/python3.10/site-packages/wandb/vendor/watchdog_0_9_0/wandb_watchdog/observers/__pycache__/inotify_c.cpython-310.pyc
ADDED
|
Binary file (15.2 kB). View file
|
|
|