diff --git a/videollama2/lib/python3.10/site-packages/torch/include/ATen/ops/_conj_copy_ops.h b/videollama2/lib/python3.10/site-packages/torch/include/ATen/ops/_conj_copy_ops.h new file mode 100644 index 0000000000000000000000000000000000000000..c3f118354be7db75a152bb43a7415c684baf024c --- /dev/null +++ b/videollama2/lib/python3.10/site-packages/torch/include/ATen/ops/_conj_copy_ops.h @@ -0,0 +1,39 @@ +#pragma once + +// @generated by torchgen/gen.py from Operator.h + +#include +#include + +// Forward declarations of any types needed in the operator signatures. +// We can't directly include these classes because it will cause circular include dependencies. +// This file is included by TensorBody.h, which defines the Tensor class. +#include + +namespace at { +namespace _ops { + + +struct TORCH_API _conj_copy { + using schema = at::Tensor (const at::Tensor &); + using ptr_schema = schema*; + // See Note [static constexpr char* members for windows NVCC] + STATIC_CONSTEXPR_STR_INL_EXCEPT_WIN_CUDA(name, "aten::_conj_copy") + STATIC_CONSTEXPR_STR_INL_EXCEPT_WIN_CUDA(overload_name, "") + STATIC_CONSTEXPR_STR_INL_EXCEPT_WIN_CUDA(schema_str, "_conj_copy(Tensor self) -> Tensor") + static at::Tensor call(const at::Tensor & self); + static at::Tensor redispatch(c10::DispatchKeySet dispatchKeySet, const at::Tensor & self); +}; + +struct TORCH_API _conj_copy_out { + using schema = at::Tensor & (const at::Tensor &, at::Tensor &); + using ptr_schema = schema*; + // See Note [static constexpr char* members for windows NVCC] + STATIC_CONSTEXPR_STR_INL_EXCEPT_WIN_CUDA(name, "aten::_conj_copy") + STATIC_CONSTEXPR_STR_INL_EXCEPT_WIN_CUDA(overload_name, "out") + STATIC_CONSTEXPR_STR_INL_EXCEPT_WIN_CUDA(schema_str, "_conj_copy.out(Tensor self, *, Tensor(a!) out) -> Tensor(a!)") + static at::Tensor & call(const at::Tensor & self, at::Tensor & out); + static at::Tensor & redispatch(c10::DispatchKeySet dispatchKeySet, const at::Tensor & self, at::Tensor & out); +}; + +}} // namespace at::_ops diff --git a/videollama2/lib/python3.10/site-packages/torch/include/ATen/ops/_foreach_erfc_compositeexplicitautograd_dispatch.h b/videollama2/lib/python3.10/site-packages/torch/include/ATen/ops/_foreach_erfc_compositeexplicitautograd_dispatch.h new file mode 100644 index 0000000000000000000000000000000000000000..70bcb292107bae3ac1ce1e1ff4f9e381a28e44db --- /dev/null +++ b/videollama2/lib/python3.10/site-packages/torch/include/ATen/ops/_foreach_erfc_compositeexplicitautograd_dispatch.h @@ -0,0 +1,24 @@ +#pragma once +// @generated by torchgen/gen.py from DispatchKeyFunction.h + +// NB: The implementing C++ file is RegisterDispatchKey.cpp + +// The only #includes we need are for custom classes that have defaults in the C++ API +#include +#include +#include + +// Forward declarations of any types needed in the operator signatures. +// We can't directly include these classes because it will cause circular include dependencies. +// This file is included by TensorBody.h, which defines the Tensor class. +#include + +namespace at { + +namespace compositeexplicitautograd { + +TORCH_API void _foreach_erfc_out(at::TensorList out, at::TensorList self); +TORCH_API void _foreach_erfc_outf(at::TensorList self, at::TensorList out); + +} // namespace compositeexplicitautograd +} // namespace at diff --git a/videollama2/lib/python3.10/site-packages/torch/include/ATen/ops/_foreach_lerp.h b/videollama2/lib/python3.10/site-packages/torch/include/ATen/ops/_foreach_lerp.h new file mode 100644 index 0000000000000000000000000000000000000000..fbf89b778ae5e303d04a59112e7790a63e9d8c99 --- /dev/null +++ b/videollama2/lib/python3.10/site-packages/torch/include/ATen/ops/_foreach_lerp.h @@ -0,0 +1,63 @@ +#pragma once + +// @generated by torchgen/gen.py from Function.h + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + + + +#include + +namespace at { + + +// aten::_foreach_lerp.List(Tensor[] self, Tensor[] tensors1, Tensor[] weights) -> Tensor[] +inline ::std::vector _foreach_lerp(at::TensorList self, at::TensorList tensors1, at::TensorList weights) { + return at::_ops::_foreach_lerp_List::call(self, tensors1, weights); +} + +// aten::_foreach_lerp_.List(Tensor(a!)[] self, Tensor[] tensors1, Tensor[] weights) -> () +inline void _foreach_lerp_(at::TensorList self, at::TensorList tensors1, at::TensorList weights) { + return at::_ops::_foreach_lerp__List::call(self, tensors1, weights); +} + +// aten::_foreach_lerp.Scalar(Tensor[] self, Tensor[] tensors1, Scalar weight) -> Tensor[] +inline ::std::vector _foreach_lerp(at::TensorList self, at::TensorList tensors1, const at::Scalar & weight) { + return at::_ops::_foreach_lerp_Scalar::call(self, tensors1, weight); +} + +// aten::_foreach_lerp_.Scalar(Tensor(a!)[] self, Tensor[] tensors1, Scalar weight) -> () +inline void _foreach_lerp_(at::TensorList self, at::TensorList tensors1, const at::Scalar & weight) { + return at::_ops::_foreach_lerp__Scalar::call(self, tensors1, weight); +} + +// aten::_foreach_lerp.List_out(Tensor[] self, Tensor[] tensors1, Tensor[] weights, *, Tensor(a!)[] out) -> () +inline void _foreach_lerp_out(at::TensorList out, at::TensorList self, at::TensorList tensors1, at::TensorList weights) { + return at::_ops::_foreach_lerp_List_out::call(self, tensors1, weights, out); +} +// aten::_foreach_lerp.List_out(Tensor[] self, Tensor[] tensors1, Tensor[] weights, *, Tensor(a!)[] out) -> () +inline void _foreach_lerp_outf(at::TensorList self, at::TensorList tensors1, at::TensorList weights, at::TensorList out) { + return at::_ops::_foreach_lerp_List_out::call(self, tensors1, weights, out); +} + +// aten::_foreach_lerp.Scalar_out(Tensor[] self, Tensor[] tensors1, Scalar weight, *, Tensor(a!)[] out) -> () +inline void _foreach_lerp_out(at::TensorList out, at::TensorList self, at::TensorList tensors1, const at::Scalar & weight) { + return at::_ops::_foreach_lerp_Scalar_out::call(self, tensors1, weight, out); +} +// aten::_foreach_lerp.Scalar_out(Tensor[] self, Tensor[] tensors1, Scalar weight, *, Tensor(a!)[] out) -> () +inline void _foreach_lerp_outf(at::TensorList self, at::TensorList tensors1, const at::Scalar & weight, at::TensorList out) { + return at::_ops::_foreach_lerp_Scalar_out::call(self, tensors1, weight, out); +} + +} diff --git a/videollama2/lib/python3.10/site-packages/torch/include/ATen/ops/_foreach_pow_cuda_dispatch.h b/videollama2/lib/python3.10/site-packages/torch/include/ATen/ops/_foreach_pow_cuda_dispatch.h new file mode 100644 index 0000000000000000000000000000000000000000..2d2b73f82dc7a1ac13c58e9ed6a617810fd0ed1f --- /dev/null +++ b/videollama2/lib/python3.10/site-packages/torch/include/ATen/ops/_foreach_pow_cuda_dispatch.h @@ -0,0 +1,29 @@ +#pragma once +// @generated by torchgen/gen.py from DispatchKeyFunction.h + +// NB: The implementing C++ file is RegisterDispatchKey.cpp + +// The only #includes we need are for custom classes that have defaults in the C++ API +#include +#include +#include + +// Forward declarations of any types needed in the operator signatures. +// We can't directly include these classes because it will cause circular include dependencies. +// This file is included by TensorBody.h, which defines the Tensor class. +#include + +namespace at { + +namespace cuda { + +TORCH_API ::std::vector _foreach_pow(at::TensorList self, at::TensorList exponent); +TORCH_API void _foreach_pow_(at::TensorList self, at::TensorList exponent); +TORCH_API ::std::vector _foreach_pow(at::TensorList self, const at::Scalar & exponent); +TORCH_API void _foreach_pow_(at::TensorList self, const at::Scalar & exponent); +TORCH_API ::std::vector _foreach_pow(at::TensorList self, at::ArrayRef exponent); +TORCH_API void _foreach_pow_(at::TensorList self, at::ArrayRef exponent); +TORCH_API ::std::vector _foreach_pow(const at::Scalar & self, at::TensorList exponent); + +} // namespace cuda +} // namespace at diff --git a/videollama2/lib/python3.10/site-packages/torch/include/ATen/ops/_functional_sym_constrain_range_for_size.h b/videollama2/lib/python3.10/site-packages/torch/include/ATen/ops/_functional_sym_constrain_range_for_size.h new file mode 100644 index 0000000000000000000000000000000000000000..3baf9b39b8dfcd040684f7e6415528ef4b286a16 --- /dev/null +++ b/videollama2/lib/python3.10/site-packages/torch/include/ATen/ops/_functional_sym_constrain_range_for_size.h @@ -0,0 +1,30 @@ +#pragma once + +// @generated by torchgen/gen.py from Function.h + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + + + +#include + +namespace at { + + +// aten::_functional_sym_constrain_range_for_size(Scalar size, int? min, int? max, Tensor dep_token) -> Tensor +inline at::Tensor _functional_sym_constrain_range_for_size(const at::Scalar & size, c10::optional min, c10::optional max, const at::Tensor & dep_token) { + return at::_ops::_functional_sym_constrain_range_for_size::call(size, min, max, dep_token); +} + +} diff --git a/videollama2/lib/python3.10/site-packages/torch/include/ATen/ops/_nested_from_padded_and_nested_example_ops.h b/videollama2/lib/python3.10/site-packages/torch/include/ATen/ops/_nested_from_padded_and_nested_example_ops.h new file mode 100644 index 0000000000000000000000000000000000000000..9d0a93dac292b7d0121a96f041a8c7cbd0777a13 --- /dev/null +++ b/videollama2/lib/python3.10/site-packages/torch/include/ATen/ops/_nested_from_padded_and_nested_example_ops.h @@ -0,0 +1,39 @@ +#pragma once + +// @generated by torchgen/gen.py from Operator.h + +#include +#include + +// Forward declarations of any types needed in the operator signatures. +// We can't directly include these classes because it will cause circular include dependencies. +// This file is included by TensorBody.h, which defines the Tensor class. +#include + +namespace at { +namespace _ops { + + +struct TORCH_API _nested_from_padded_and_nested_example { + using schema = at::Tensor (const at::Tensor &, const at::Tensor &); + using ptr_schema = schema*; + // See Note [static constexpr char* members for windows NVCC] + STATIC_CONSTEXPR_STR_INL_EXCEPT_WIN_CUDA(name, "aten::_nested_from_padded_and_nested_example") + STATIC_CONSTEXPR_STR_INL_EXCEPT_WIN_CUDA(overload_name, "") + STATIC_CONSTEXPR_STR_INL_EXCEPT_WIN_CUDA(schema_str, "_nested_from_padded_and_nested_example(Tensor padded, Tensor nt_example) -> Tensor") + static at::Tensor call(const at::Tensor & padded, const at::Tensor & nt_example); + static at::Tensor redispatch(c10::DispatchKeySet dispatchKeySet, const at::Tensor & padded, const at::Tensor & nt_example); +}; + +struct TORCH_API _nested_from_padded_and_nested_example_out { + using schema = at::Tensor & (const at::Tensor &, const at::Tensor &, at::Tensor &); + using ptr_schema = schema*; + // See Note [static constexpr char* members for windows NVCC] + STATIC_CONSTEXPR_STR_INL_EXCEPT_WIN_CUDA(name, "aten::_nested_from_padded_and_nested_example") + STATIC_CONSTEXPR_STR_INL_EXCEPT_WIN_CUDA(overload_name, "out") + STATIC_CONSTEXPR_STR_INL_EXCEPT_WIN_CUDA(schema_str, "_nested_from_padded_and_nested_example.out(Tensor padded, Tensor nt_example, *, Tensor(a!) out) -> Tensor(a!)") + static at::Tensor & call(const at::Tensor & padded, const at::Tensor & nt_example, at::Tensor & out); + static at::Tensor & redispatch(c10::DispatchKeySet dispatchKeySet, const at::Tensor & padded, const at::Tensor & nt_example, at::Tensor & out); +}; + +}} // namespace at::_ops diff --git a/videollama2/lib/python3.10/site-packages/torch/include/ATen/ops/_sparse_csr_tensor_unsafe_compositeimplicitautograd_dispatch.h b/videollama2/lib/python3.10/site-packages/torch/include/ATen/ops/_sparse_csr_tensor_unsafe_compositeimplicitautograd_dispatch.h new file mode 100644 index 0000000000000000000000000000000000000000..83a8470b396b72d6cc7e7fba8a409ceb012f1602 --- /dev/null +++ b/videollama2/lib/python3.10/site-packages/torch/include/ATen/ops/_sparse_csr_tensor_unsafe_compositeimplicitautograd_dispatch.h @@ -0,0 +1,24 @@ +#pragma once +// @generated by torchgen/gen.py from DispatchKeyFunction.h + +// NB: The implementing C++ file is RegisterDispatchKey.cpp + +// The only #includes we need are for custom classes that have defaults in the C++ API +#include +#include +#include + +// Forward declarations of any types needed in the operator signatures. +// We can't directly include these classes because it will cause circular include dependencies. +// This file is included by TensorBody.h, which defines the Tensor class. +#include + +namespace at { + +namespace compositeimplicitautograd { + +TORCH_API at::Tensor _sparse_csr_tensor_unsafe(const at::Tensor & crow_indices, const at::Tensor & col_indices, const at::Tensor & values, at::IntArrayRef size, at::TensorOptions options={}); +TORCH_API at::Tensor _sparse_csr_tensor_unsafe(const at::Tensor & crow_indices, const at::Tensor & col_indices, const at::Tensor & values, at::IntArrayRef size, c10::optional dtype, c10::optional layout, c10::optional device, c10::optional pin_memory); + +} // namespace compositeimplicitautograd +} // namespace at diff --git a/videollama2/lib/python3.10/site-packages/torch/include/ATen/ops/_test_ambiguous_defaults_compositeimplicitautograd_dispatch.h b/videollama2/lib/python3.10/site-packages/torch/include/ATen/ops/_test_ambiguous_defaults_compositeimplicitautograd_dispatch.h new file mode 100644 index 0000000000000000000000000000000000000000..ecfd7f8a95d74a27ebb53e1a9e66f5e1bba64e8d --- /dev/null +++ b/videollama2/lib/python3.10/site-packages/torch/include/ATen/ops/_test_ambiguous_defaults_compositeimplicitautograd_dispatch.h @@ -0,0 +1,24 @@ +#pragma once +// @generated by torchgen/gen.py from DispatchKeyFunction.h + +// NB: The implementing C++ file is RegisterDispatchKey.cpp + +// The only #includes we need are for custom classes that have defaults in the C++ API +#include +#include +#include + +// Forward declarations of any types needed in the operator signatures. +// We can't directly include these classes because it will cause circular include dependencies. +// This file is included by TensorBody.h, which defines the Tensor class. +#include + +namespace at { + +namespace compositeimplicitautograd { + +TORCH_API at::Tensor _test_ambiguous_defaults(const at::Tensor & dummy, int64_t a=1, int64_t b=1); +TORCH_API at::Tensor _test_ambiguous_defaults(const at::Tensor & dummy, int64_t a, c10::string_view b); + +} // namespace compositeimplicitautograd +} // namespace at diff --git a/videollama2/lib/python3.10/site-packages/torch/include/ATen/ops/_test_ambiguous_defaults_native.h b/videollama2/lib/python3.10/site-packages/torch/include/ATen/ops/_test_ambiguous_defaults_native.h new file mode 100644 index 0000000000000000000000000000000000000000..474476e19d0d3ac66320be6cef16b35840e29355 --- /dev/null +++ b/videollama2/lib/python3.10/site-packages/torch/include/ATen/ops/_test_ambiguous_defaults_native.h @@ -0,0 +1,22 @@ +#pragma once + +// @generated by torchgen/gen.py from NativeFunction.h + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + + +namespace at { +namespace native { +TORCH_API at::Tensor _test_ambiguous_defaults(const at::Tensor & dummy, int64_t a=1, int64_t b=1); +TORCH_API at::Tensor _test_ambiguous_defaults(const at::Tensor & dummy, int64_t a=2, c10::string_view b="2"); +} // namespace native +} // namespace at diff --git a/videollama2/lib/python3.10/site-packages/torch/include/ATen/ops/_test_serialization_subcmul_ops.h b/videollama2/lib/python3.10/site-packages/torch/include/ATen/ops/_test_serialization_subcmul_ops.h new file mode 100644 index 0000000000000000000000000000000000000000..eb6dc75b3cb97cf591f4cc7672de6cb56eb8a14f --- /dev/null +++ b/videollama2/lib/python3.10/site-packages/torch/include/ATen/ops/_test_serialization_subcmul_ops.h @@ -0,0 +1,28 @@ +#pragma once + +// @generated by torchgen/gen.py from Operator.h + +#include +#include + +// Forward declarations of any types needed in the operator signatures. +// We can't directly include these classes because it will cause circular include dependencies. +// This file is included by TensorBody.h, which defines the Tensor class. +#include + +namespace at { +namespace _ops { + + +struct TORCH_API _test_serialization_subcmul { + using schema = at::Tensor (const at::Tensor &, const at::Tensor &, const at::Scalar &); + using ptr_schema = schema*; + // See Note [static constexpr char* members for windows NVCC] + STATIC_CONSTEXPR_STR_INL_EXCEPT_WIN_CUDA(name, "aten::_test_serialization_subcmul") + STATIC_CONSTEXPR_STR_INL_EXCEPT_WIN_CUDA(overload_name, "") + STATIC_CONSTEXPR_STR_INL_EXCEPT_WIN_CUDA(schema_str, "_test_serialization_subcmul(Tensor self, Tensor other, Scalar alpha=1) -> Tensor") + static at::Tensor call(const at::Tensor & self, const at::Tensor & other, const at::Scalar & alpha); + static at::Tensor redispatch(c10::DispatchKeySet dispatchKeySet, const at::Tensor & self, const at::Tensor & other, const at::Scalar & alpha); +}; + +}} // namespace at::_ops diff --git a/videollama2/lib/python3.10/site-packages/torch/include/ATen/ops/_to_cpu_native.h b/videollama2/lib/python3.10/site-packages/torch/include/ATen/ops/_to_cpu_native.h new file mode 100644 index 0000000000000000000000000000000000000000..0fd45066568f36e509264bf97d634678d769bb36 --- /dev/null +++ b/videollama2/lib/python3.10/site-packages/torch/include/ATen/ops/_to_cpu_native.h @@ -0,0 +1,21 @@ +#pragma once + +// @generated by torchgen/gen.py from NativeFunction.h + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + + +namespace at { +namespace native { +TORCH_API ::std::vector _to_cpu(at::TensorList tensors); +} // namespace native +} // namespace at diff --git a/videollama2/lib/python3.10/site-packages/torch/include/ATen/ops/_transformer_encoder_layer_fwd_compositeexplicitautograd_dispatch.h b/videollama2/lib/python3.10/site-packages/torch/include/ATen/ops/_transformer_encoder_layer_fwd_compositeexplicitautograd_dispatch.h new file mode 100644 index 0000000000000000000000000000000000000000..b50c4004cb24d0cc17e04e608bb1d6438441fab5 --- /dev/null +++ b/videollama2/lib/python3.10/site-packages/torch/include/ATen/ops/_transformer_encoder_layer_fwd_compositeexplicitautograd_dispatch.h @@ -0,0 +1,24 @@ +#pragma once +// @generated by torchgen/gen.py from DispatchKeyFunction.h + +// NB: The implementing C++ file is RegisterDispatchKey.cpp + +// The only #includes we need are for custom classes that have defaults in the C++ API +#include +#include +#include + +// Forward declarations of any types needed in the operator signatures. +// We can't directly include these classes because it will cause circular include dependencies. +// This file is included by TensorBody.h, which defines the Tensor class. +#include + +namespace at { + +namespace compositeexplicitautograd { + +TORCH_API at::Tensor & _transformer_encoder_layer_fwd_out(at::Tensor & out, const at::Tensor & src, int64_t embed_dim, int64_t num_heads, const at::Tensor & qkv_weight, const at::Tensor & qkv_bias, const at::Tensor & proj_weight, const at::Tensor & proj_bias, bool use_gelu, bool norm_first, double eps, const at::Tensor & norm_weight_1, const at::Tensor & norm_bias_1, const at::Tensor & norm_weight_2, const at::Tensor & norm_bias_2, const at::Tensor & ffn_weight_1, const at::Tensor & ffn_bias_1, const at::Tensor & ffn_weight_2, const at::Tensor & ffn_bias_2, const c10::optional & mask={}, c10::optional mask_type=c10::nullopt); +TORCH_API at::Tensor & _transformer_encoder_layer_fwd_outf(const at::Tensor & src, int64_t embed_dim, int64_t num_heads, const at::Tensor & qkv_weight, const at::Tensor & qkv_bias, const at::Tensor & proj_weight, const at::Tensor & proj_bias, bool use_gelu, bool norm_first, double eps, const at::Tensor & norm_weight_1, const at::Tensor & norm_bias_1, const at::Tensor & norm_weight_2, const at::Tensor & norm_bias_2, const at::Tensor & ffn_weight_1, const at::Tensor & ffn_bias_1, const at::Tensor & ffn_weight_2, const at::Tensor & ffn_bias_2, const c10::optional & mask, c10::optional mask_type, at::Tensor & out); + +} // namespace compositeexplicitautograd +} // namespace at diff --git a/videollama2/lib/python3.10/site-packages/torch/include/ATen/ops/_upsample_bilinear2d_aa_backward_ops.h b/videollama2/lib/python3.10/site-packages/torch/include/ATen/ops/_upsample_bilinear2d_aa_backward_ops.h new file mode 100644 index 0000000000000000000000000000000000000000..20b57e40ebda9a1febd4cac8032f8d1720ec1db9 --- /dev/null +++ b/videollama2/lib/python3.10/site-packages/torch/include/ATen/ops/_upsample_bilinear2d_aa_backward_ops.h @@ -0,0 +1,39 @@ +#pragma once + +// @generated by torchgen/gen.py from Operator.h + +#include +#include + +// Forward declarations of any types needed in the operator signatures. +// We can't directly include these classes because it will cause circular include dependencies. +// This file is included by TensorBody.h, which defines the Tensor class. +#include + +namespace at { +namespace _ops { + + +struct TORCH_API _upsample_bilinear2d_aa_backward_grad_input { + using schema = at::Tensor & (const at::Tensor &, c10::SymIntArrayRef, c10::SymIntArrayRef, bool, c10::optional, c10::optional, at::Tensor &); + using ptr_schema = schema*; + // See Note [static constexpr char* members for windows NVCC] + STATIC_CONSTEXPR_STR_INL_EXCEPT_WIN_CUDA(name, "aten::_upsample_bilinear2d_aa_backward") + STATIC_CONSTEXPR_STR_INL_EXCEPT_WIN_CUDA(overload_name, "grad_input") + STATIC_CONSTEXPR_STR_INL_EXCEPT_WIN_CUDA(schema_str, "_upsample_bilinear2d_aa_backward.grad_input(Tensor grad_output, SymInt[2] output_size, SymInt[4] input_size, bool align_corners, float? scales_h=None, float? scales_w=None, *, Tensor(a!) grad_input) -> Tensor(a!)") + static at::Tensor & call(const at::Tensor & grad_output, c10::SymIntArrayRef output_size, c10::SymIntArrayRef input_size, bool align_corners, c10::optional scales_h, c10::optional scales_w, at::Tensor & grad_input); + static at::Tensor & redispatch(c10::DispatchKeySet dispatchKeySet, const at::Tensor & grad_output, c10::SymIntArrayRef output_size, c10::SymIntArrayRef input_size, bool align_corners, c10::optional scales_h, c10::optional scales_w, at::Tensor & grad_input); +}; + +struct TORCH_API _upsample_bilinear2d_aa_backward { + using schema = at::Tensor (const at::Tensor &, c10::SymIntArrayRef, c10::SymIntArrayRef, bool, c10::optional, c10::optional); + using ptr_schema = schema*; + // See Note [static constexpr char* members for windows NVCC] + STATIC_CONSTEXPR_STR_INL_EXCEPT_WIN_CUDA(name, "aten::_upsample_bilinear2d_aa_backward") + STATIC_CONSTEXPR_STR_INL_EXCEPT_WIN_CUDA(overload_name, "") + STATIC_CONSTEXPR_STR_INL_EXCEPT_WIN_CUDA(schema_str, "_upsample_bilinear2d_aa_backward(Tensor grad_output, SymInt[2] output_size, SymInt[4] input_size, bool align_corners, float? scales_h=None, float? scales_w=None) -> Tensor") + static at::Tensor call(const at::Tensor & grad_output, c10::SymIntArrayRef output_size, c10::SymIntArrayRef input_size, bool align_corners, c10::optional scales_h, c10::optional scales_w); + static at::Tensor redispatch(c10::DispatchKeySet dispatchKeySet, const at::Tensor & grad_output, c10::SymIntArrayRef output_size, c10::SymIntArrayRef input_size, bool align_corners, c10::optional scales_h, c10::optional scales_w); +}; + +}} // namespace at::_ops diff --git a/videollama2/lib/python3.10/site-packages/torch/include/ATen/ops/_upsample_nearest_exact1d_meta.h b/videollama2/lib/python3.10/site-packages/torch/include/ATen/ops/_upsample_nearest_exact1d_meta.h new file mode 100644 index 0000000000000000000000000000000000000000..dfadbef4b311f1b45466fb67f9d8fd93743228f0 --- /dev/null +++ b/videollama2/lib/python3.10/site-packages/torch/include/ATen/ops/_upsample_nearest_exact1d_meta.h @@ -0,0 +1,27 @@ +#pragma once + +// @generated by torchgen/gen.py from NativeMetaFunction.h + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +namespace at { +namespace meta { + +struct TORCH_API structured__upsample_nearest_exact1d : public at::impl::MetaBase { + + + void meta(const at::Tensor & self, at::ArrayRef output_size, c10::optional scales); +}; + +} // namespace native +} // namespace at diff --git a/videollama2/lib/python3.10/site-packages/torch/include/ATen/ops/amax_compositeexplicitautogradnonfunctional_dispatch.h b/videollama2/lib/python3.10/site-packages/torch/include/ATen/ops/amax_compositeexplicitautogradnonfunctional_dispatch.h new file mode 100644 index 0000000000000000000000000000000000000000..d2958f75befdb414a595f9d9971228e13d9f371e --- /dev/null +++ b/videollama2/lib/python3.10/site-packages/torch/include/ATen/ops/amax_compositeexplicitautogradnonfunctional_dispatch.h @@ -0,0 +1,23 @@ +#pragma once +// @generated by torchgen/gen.py from DispatchKeyFunction.h + +// NB: The implementing C++ file is RegisterDispatchKey.cpp + +// The only #includes we need are for custom classes that have defaults in the C++ API +#include +#include +#include + +// Forward declarations of any types needed in the operator signatures. +// We can't directly include these classes because it will cause circular include dependencies. +// This file is included by TensorBody.h, which defines the Tensor class. +#include + +namespace at { + +namespace compositeexplicitautogradnonfunctional { + +TORCH_API at::Tensor amax(const at::Tensor & self, at::IntArrayRef dim={}, bool keepdim=false); + +} // namespace compositeexplicitautogradnonfunctional +} // namespace at diff --git a/videollama2/lib/python3.10/site-packages/torch/include/ATen/ops/arccosh.h b/videollama2/lib/python3.10/site-packages/torch/include/ATen/ops/arccosh.h new file mode 100644 index 0000000000000000000000000000000000000000..3335e73c2e0cd6ccabe35e595440e4940b9be439 --- /dev/null +++ b/videollama2/lib/python3.10/site-packages/torch/include/ATen/ops/arccosh.h @@ -0,0 +1,44 @@ +#pragma once + +// @generated by torchgen/gen.py from Function.h + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + + + +#include + +namespace at { + + +// aten::arccosh(Tensor self) -> Tensor +inline at::Tensor arccosh(const at::Tensor & self) { + return at::_ops::arccosh::call(self); +} + +// aten::arccosh_(Tensor(a!) self) -> Tensor(a!) +inline at::Tensor & arccosh_(at::Tensor & self) { + return at::_ops::arccosh_::call(self); +} + +// aten::arccosh.out(Tensor self, *, Tensor(a!) out) -> Tensor(a!) +inline at::Tensor & arccosh_out(at::Tensor & out, const at::Tensor & self) { + return at::_ops::arccosh_out::call(self, out); +} +// aten::arccosh.out(Tensor self, *, Tensor(a!) out) -> Tensor(a!) +inline at::Tensor & arccosh_outf(const at::Tensor & self, at::Tensor & out) { + return at::_ops::arccosh_out::call(self, out); +} + +} diff --git a/videollama2/lib/python3.10/site-packages/torch/include/ATen/ops/conv_depthwise3d_ops.h b/videollama2/lib/python3.10/site-packages/torch/include/ATen/ops/conv_depthwise3d_ops.h new file mode 100644 index 0000000000000000000000000000000000000000..2c4d95d5c66a927b15b790db57abe89e3d3536b7 --- /dev/null +++ b/videollama2/lib/python3.10/site-packages/torch/include/ATen/ops/conv_depthwise3d_ops.h @@ -0,0 +1,39 @@ +#pragma once + +// @generated by torchgen/gen.py from Operator.h + +#include +#include + +// Forward declarations of any types needed in the operator signatures. +// We can't directly include these classes because it will cause circular include dependencies. +// This file is included by TensorBody.h, which defines the Tensor class. +#include + +namespace at { +namespace _ops { + + +struct TORCH_API conv_depthwise3d { + using schema = at::Tensor (const at::Tensor &, const at::Tensor &, c10::SymIntArrayRef, const c10::optional &, c10::SymIntArrayRef, c10::SymIntArrayRef, c10::SymIntArrayRef); + using ptr_schema = schema*; + // See Note [static constexpr char* members for windows NVCC] + STATIC_CONSTEXPR_STR_INL_EXCEPT_WIN_CUDA(name, "aten::conv_depthwise3d") + STATIC_CONSTEXPR_STR_INL_EXCEPT_WIN_CUDA(overload_name, "") + STATIC_CONSTEXPR_STR_INL_EXCEPT_WIN_CUDA(schema_str, "conv_depthwise3d(Tensor self, Tensor weight, SymInt[3] kernel_size, Tensor? bias, SymInt[3] stride, SymInt[3] padding, SymInt[3] dilation) -> Tensor") + static at::Tensor call(const at::Tensor & self, const at::Tensor & weight, c10::SymIntArrayRef kernel_size, const c10::optional & bias, c10::SymIntArrayRef stride, c10::SymIntArrayRef padding, c10::SymIntArrayRef dilation); + static at::Tensor redispatch(c10::DispatchKeySet dispatchKeySet, const at::Tensor & self, const at::Tensor & weight, c10::SymIntArrayRef kernel_size, const c10::optional & bias, c10::SymIntArrayRef stride, c10::SymIntArrayRef padding, c10::SymIntArrayRef dilation); +}; + +struct TORCH_API conv_depthwise3d_out { + using schema = at::Tensor & (const at::Tensor &, const at::Tensor &, c10::SymIntArrayRef, const c10::optional &, c10::SymIntArrayRef, c10::SymIntArrayRef, c10::SymIntArrayRef, at::Tensor &); + using ptr_schema = schema*; + // See Note [static constexpr char* members for windows NVCC] + STATIC_CONSTEXPR_STR_INL_EXCEPT_WIN_CUDA(name, "aten::conv_depthwise3d") + STATIC_CONSTEXPR_STR_INL_EXCEPT_WIN_CUDA(overload_name, "out") + STATIC_CONSTEXPR_STR_INL_EXCEPT_WIN_CUDA(schema_str, "conv_depthwise3d.out(Tensor self, Tensor weight, SymInt[3] kernel_size, Tensor? bias, SymInt[3] stride, SymInt[3] padding, SymInt[3] dilation, *, Tensor(a!) out) -> Tensor(a!)") + static at::Tensor & call(const at::Tensor & self, const at::Tensor & weight, c10::SymIntArrayRef kernel_size, const c10::optional & bias, c10::SymIntArrayRef stride, c10::SymIntArrayRef padding, c10::SymIntArrayRef dilation, at::Tensor & out); + static at::Tensor & redispatch(c10::DispatchKeySet dispatchKeySet, const at::Tensor & self, const at::Tensor & weight, c10::SymIntArrayRef kernel_size, const c10::optional & bias, c10::SymIntArrayRef stride, c10::SymIntArrayRef padding, c10::SymIntArrayRef dilation, at::Tensor & out); +}; + +}} // namespace at::_ops diff --git a/videollama2/lib/python3.10/site-packages/torch/include/ATen/ops/cross_ops.h b/videollama2/lib/python3.10/site-packages/torch/include/ATen/ops/cross_ops.h new file mode 100644 index 0000000000000000000000000000000000000000..6ebd8716872ab89b0909acf29c4adafe5f75ed0b --- /dev/null +++ b/videollama2/lib/python3.10/site-packages/torch/include/ATen/ops/cross_ops.h @@ -0,0 +1,39 @@ +#pragma once + +// @generated by torchgen/gen.py from Operator.h + +#include +#include + +// Forward declarations of any types needed in the operator signatures. +// We can't directly include these classes because it will cause circular include dependencies. +// This file is included by TensorBody.h, which defines the Tensor class. +#include + +namespace at { +namespace _ops { + + +struct TORCH_API cross_out { + using schema = at::Tensor & (const at::Tensor &, const at::Tensor &, c10::optional, at::Tensor &); + using ptr_schema = schema*; + // See Note [static constexpr char* members for windows NVCC] + STATIC_CONSTEXPR_STR_INL_EXCEPT_WIN_CUDA(name, "aten::cross") + STATIC_CONSTEXPR_STR_INL_EXCEPT_WIN_CUDA(overload_name, "out") + STATIC_CONSTEXPR_STR_INL_EXCEPT_WIN_CUDA(schema_str, "cross.out(Tensor self, Tensor other, int? dim=None, *, Tensor(a!) out) -> Tensor(a!)") + static at::Tensor & call(const at::Tensor & self, const at::Tensor & other, c10::optional dim, at::Tensor & out); + static at::Tensor & redispatch(c10::DispatchKeySet dispatchKeySet, const at::Tensor & self, const at::Tensor & other, c10::optional dim, at::Tensor & out); +}; + +struct TORCH_API cross { + using schema = at::Tensor (const at::Tensor &, const at::Tensor &, c10::optional); + using ptr_schema = schema*; + // See Note [static constexpr char* members for windows NVCC] + STATIC_CONSTEXPR_STR_INL_EXCEPT_WIN_CUDA(name, "aten::cross") + STATIC_CONSTEXPR_STR_INL_EXCEPT_WIN_CUDA(overload_name, "") + STATIC_CONSTEXPR_STR_INL_EXCEPT_WIN_CUDA(schema_str, "cross(Tensor self, Tensor other, int? dim=None) -> Tensor") + static at::Tensor call(const at::Tensor & self, const at::Tensor & other, c10::optional dim); + static at::Tensor redispatch(c10::DispatchKeySet dispatchKeySet, const at::Tensor & self, const at::Tensor & other, c10::optional dim); +}; + +}} // namespace at::_ops diff --git a/videollama2/lib/python3.10/site-packages/torch/include/ATen/ops/cudnn_convolution_relu_native.h b/videollama2/lib/python3.10/site-packages/torch/include/ATen/ops/cudnn_convolution_relu_native.h new file mode 100644 index 0000000000000000000000000000000000000000..ff901f9083b3fbf9e7da4319bd1b169d37b0906e --- /dev/null +++ b/videollama2/lib/python3.10/site-packages/torch/include/ATen/ops/cudnn_convolution_relu_native.h @@ -0,0 +1,22 @@ +#pragma once + +// @generated by torchgen/gen.py from NativeFunction.h + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + + +namespace at { +namespace native { +TORCH_API at::Tensor & cudnn_convolution_relu_out_symint(const at::Tensor & self, const at::Tensor & weight, const c10::optional & bias, c10::SymIntArrayRef stride, c10::SymIntArrayRef padding, c10::SymIntArrayRef dilation, c10::SymInt groups, at::Tensor & out); +TORCH_API at::Tensor cudnn_convolution_relu(const at::Tensor & self, const at::Tensor & weight, const c10::optional & bias, at::IntArrayRef stride, at::IntArrayRef padding, at::IntArrayRef dilation, int64_t groups); +} // namespace native +} // namespace at diff --git a/videollama2/lib/python3.10/site-packages/torch/include/ATen/ops/data_ops.h b/videollama2/lib/python3.10/site-packages/torch/include/ATen/ops/data_ops.h new file mode 100644 index 0000000000000000000000000000000000000000..3083709be0839b5ee052dd59bb4e82536e890bbf --- /dev/null +++ b/videollama2/lib/python3.10/site-packages/torch/include/ATen/ops/data_ops.h @@ -0,0 +1,28 @@ +#pragma once + +// @generated by torchgen/gen.py from Operator.h + +#include +#include + +// Forward declarations of any types needed in the operator signatures. +// We can't directly include these classes because it will cause circular include dependencies. +// This file is included by TensorBody.h, which defines the Tensor class. +#include + +namespace at { +namespace _ops { + + +struct TORCH_API data { + using schema = at::Tensor (const at::Tensor &); + using ptr_schema = schema*; + // See Note [static constexpr char* members for windows NVCC] + STATIC_CONSTEXPR_STR_INL_EXCEPT_WIN_CUDA(name, "aten::data") + STATIC_CONSTEXPR_STR_INL_EXCEPT_WIN_CUDA(overload_name, "") + STATIC_CONSTEXPR_STR_INL_EXCEPT_WIN_CUDA(schema_str, "data(Tensor self) -> Tensor") + static at::Tensor call(const at::Tensor & self); + static at::Tensor redispatch(c10::DispatchKeySet dispatchKeySet, const at::Tensor & self); +}; + +}} // namespace at::_ops diff --git a/videollama2/lib/python3.10/site-packages/torch/include/ATen/ops/digamma_cpu_dispatch.h b/videollama2/lib/python3.10/site-packages/torch/include/ATen/ops/digamma_cpu_dispatch.h new file mode 100644 index 0000000000000000000000000000000000000000..1474453f1644deb4f2c42ebe05c3db4c7693e814 --- /dev/null +++ b/videollama2/lib/python3.10/site-packages/torch/include/ATen/ops/digamma_cpu_dispatch.h @@ -0,0 +1,26 @@ +#pragma once +// @generated by torchgen/gen.py from DispatchKeyFunction.h + +// NB: The implementing C++ file is RegisterDispatchKey.cpp + +// The only #includes we need are for custom classes that have defaults in the C++ API +#include +#include +#include + +// Forward declarations of any types needed in the operator signatures. +// We can't directly include these classes because it will cause circular include dependencies. +// This file is included by TensorBody.h, which defines the Tensor class. +#include + +namespace at { + +namespace cpu { + +TORCH_API at::Tensor digamma(const at::Tensor & self); +TORCH_API at::Tensor & digamma_out(at::Tensor & out, const at::Tensor & self); +TORCH_API at::Tensor & digamma_outf(const at::Tensor & self, at::Tensor & out); +TORCH_API at::Tensor & digamma_(at::Tensor & self); + +} // namespace cpu +} // namespace at diff --git a/videollama2/lib/python3.10/site-packages/torch/include/ATen/ops/divide_ops.h b/videollama2/lib/python3.10/site-packages/torch/include/ATen/ops/divide_ops.h new file mode 100644 index 0000000000000000000000000000000000000000..727e465b37750abbf18e21abddc3d9197982d497 --- /dev/null +++ b/videollama2/lib/python3.10/site-packages/torch/include/ATen/ops/divide_ops.h @@ -0,0 +1,127 @@ +#pragma once + +// @generated by torchgen/gen.py from Operator.h + +#include +#include + +// Forward declarations of any types needed in the operator signatures. +// We can't directly include these classes because it will cause circular include dependencies. +// This file is included by TensorBody.h, which defines the Tensor class. +#include + +namespace at { +namespace _ops { + + +struct TORCH_API divide_Tensor { + using schema = at::Tensor (const at::Tensor &, const at::Tensor &); + using ptr_schema = schema*; + // See Note [static constexpr char* members for windows NVCC] + STATIC_CONSTEXPR_STR_INL_EXCEPT_WIN_CUDA(name, "aten::divide") + STATIC_CONSTEXPR_STR_INL_EXCEPT_WIN_CUDA(overload_name, "Tensor") + STATIC_CONSTEXPR_STR_INL_EXCEPT_WIN_CUDA(schema_str, "divide.Tensor(Tensor self, Tensor other) -> Tensor") + static at::Tensor call(const at::Tensor & self, const at::Tensor & other); + static at::Tensor redispatch(c10::DispatchKeySet dispatchKeySet, const at::Tensor & self, const at::Tensor & other); +}; + +struct TORCH_API divide__Tensor { + using schema = at::Tensor & (at::Tensor &, const at::Tensor &); + using ptr_schema = schema*; + // See Note [static constexpr char* members for windows NVCC] + STATIC_CONSTEXPR_STR_INL_EXCEPT_WIN_CUDA(name, "aten::divide_") + STATIC_CONSTEXPR_STR_INL_EXCEPT_WIN_CUDA(overload_name, "Tensor") + STATIC_CONSTEXPR_STR_INL_EXCEPT_WIN_CUDA(schema_str, "divide_.Tensor(Tensor(a!) self, Tensor other) -> Tensor(a!)") + static at::Tensor & call(at::Tensor & self, const at::Tensor & other); + static at::Tensor & redispatch(c10::DispatchKeySet dispatchKeySet, at::Tensor & self, const at::Tensor & other); +}; + +struct TORCH_API divide_out { + using schema = at::Tensor & (const at::Tensor &, const at::Tensor &, at::Tensor &); + using ptr_schema = schema*; + // See Note [static constexpr char* members for windows NVCC] + STATIC_CONSTEXPR_STR_INL_EXCEPT_WIN_CUDA(name, "aten::divide") + STATIC_CONSTEXPR_STR_INL_EXCEPT_WIN_CUDA(overload_name, "out") + STATIC_CONSTEXPR_STR_INL_EXCEPT_WIN_CUDA(schema_str, "divide.out(Tensor self, Tensor other, *, Tensor(a!) out) -> Tensor(a!)") + static at::Tensor & call(const at::Tensor & self, const at::Tensor & other, at::Tensor & out); + static at::Tensor & redispatch(c10::DispatchKeySet dispatchKeySet, const at::Tensor & self, const at::Tensor & other, at::Tensor & out); +}; + +struct TORCH_API divide_Scalar { + using schema = at::Tensor (const at::Tensor &, const at::Scalar &); + using ptr_schema = schema*; + // See Note [static constexpr char* members for windows NVCC] + STATIC_CONSTEXPR_STR_INL_EXCEPT_WIN_CUDA(name, "aten::divide") + STATIC_CONSTEXPR_STR_INL_EXCEPT_WIN_CUDA(overload_name, "Scalar") + STATIC_CONSTEXPR_STR_INL_EXCEPT_WIN_CUDA(schema_str, "divide.Scalar(Tensor self, Scalar other) -> Tensor") + static at::Tensor call(const at::Tensor & self, const at::Scalar & other); + static at::Tensor redispatch(c10::DispatchKeySet dispatchKeySet, const at::Tensor & self, const at::Scalar & other); +}; + +struct TORCH_API divide__Scalar { + using schema = at::Tensor & (at::Tensor &, const at::Scalar &); + using ptr_schema = schema*; + // See Note [static constexpr char* members for windows NVCC] + STATIC_CONSTEXPR_STR_INL_EXCEPT_WIN_CUDA(name, "aten::divide_") + STATIC_CONSTEXPR_STR_INL_EXCEPT_WIN_CUDA(overload_name, "Scalar") + STATIC_CONSTEXPR_STR_INL_EXCEPT_WIN_CUDA(schema_str, "divide_.Scalar(Tensor(a!) self, Scalar other) -> Tensor(a!)") + static at::Tensor & call(at::Tensor & self, const at::Scalar & other); + static at::Tensor & redispatch(c10::DispatchKeySet dispatchKeySet, at::Tensor & self, const at::Scalar & other); +}; + +struct TORCH_API divide_Tensor_mode { + using schema = at::Tensor (const at::Tensor &, const at::Tensor &, c10::optional); + using ptr_schema = schema*; + // See Note [static constexpr char* members for windows NVCC] + STATIC_CONSTEXPR_STR_INL_EXCEPT_WIN_CUDA(name, "aten::divide") + STATIC_CONSTEXPR_STR_INL_EXCEPT_WIN_CUDA(overload_name, "Tensor_mode") + STATIC_CONSTEXPR_STR_INL_EXCEPT_WIN_CUDA(schema_str, "divide.Tensor_mode(Tensor self, Tensor other, *, str? rounding_mode) -> Tensor") + static at::Tensor call(const at::Tensor & self, const at::Tensor & other, c10::optional rounding_mode); + static at::Tensor redispatch(c10::DispatchKeySet dispatchKeySet, const at::Tensor & self, const at::Tensor & other, c10::optional rounding_mode); +}; + +struct TORCH_API divide__Tensor_mode { + using schema = at::Tensor & (at::Tensor &, const at::Tensor &, c10::optional); + using ptr_schema = schema*; + // See Note [static constexpr char* members for windows NVCC] + STATIC_CONSTEXPR_STR_INL_EXCEPT_WIN_CUDA(name, "aten::divide_") + STATIC_CONSTEXPR_STR_INL_EXCEPT_WIN_CUDA(overload_name, "Tensor_mode") + STATIC_CONSTEXPR_STR_INL_EXCEPT_WIN_CUDA(schema_str, "divide_.Tensor_mode(Tensor(a!) self, Tensor other, *, str? rounding_mode) -> Tensor(a!)") + static at::Tensor & call(at::Tensor & self, const at::Tensor & other, c10::optional rounding_mode); + static at::Tensor & redispatch(c10::DispatchKeySet dispatchKeySet, at::Tensor & self, const at::Tensor & other, c10::optional rounding_mode); +}; + +struct TORCH_API divide_out_mode { + using schema = at::Tensor & (const at::Tensor &, const at::Tensor &, c10::optional, at::Tensor &); + using ptr_schema = schema*; + // See Note [static constexpr char* members for windows NVCC] + STATIC_CONSTEXPR_STR_INL_EXCEPT_WIN_CUDA(name, "aten::divide") + STATIC_CONSTEXPR_STR_INL_EXCEPT_WIN_CUDA(overload_name, "out_mode") + STATIC_CONSTEXPR_STR_INL_EXCEPT_WIN_CUDA(schema_str, "divide.out_mode(Tensor self, Tensor other, *, str? rounding_mode, Tensor(a!) out) -> Tensor(a!)") + static at::Tensor & call(const at::Tensor & self, const at::Tensor & other, c10::optional rounding_mode, at::Tensor & out); + static at::Tensor & redispatch(c10::DispatchKeySet dispatchKeySet, const at::Tensor & self, const at::Tensor & other, c10::optional rounding_mode, at::Tensor & out); +}; + +struct TORCH_API divide_Scalar_mode { + using schema = at::Tensor (const at::Tensor &, const at::Scalar &, c10::optional); + using ptr_schema = schema*; + // See Note [static constexpr char* members for windows NVCC] + STATIC_CONSTEXPR_STR_INL_EXCEPT_WIN_CUDA(name, "aten::divide") + STATIC_CONSTEXPR_STR_INL_EXCEPT_WIN_CUDA(overload_name, "Scalar_mode") + STATIC_CONSTEXPR_STR_INL_EXCEPT_WIN_CUDA(schema_str, "divide.Scalar_mode(Tensor self, Scalar other, *, str? rounding_mode) -> Tensor") + static at::Tensor call(const at::Tensor & self, const at::Scalar & other, c10::optional rounding_mode); + static at::Tensor redispatch(c10::DispatchKeySet dispatchKeySet, const at::Tensor & self, const at::Scalar & other, c10::optional rounding_mode); +}; + +struct TORCH_API divide__Scalar_mode { + using schema = at::Tensor & (at::Tensor &, const at::Scalar &, c10::optional); + using ptr_schema = schema*; + // See Note [static constexpr char* members for windows NVCC] + STATIC_CONSTEXPR_STR_INL_EXCEPT_WIN_CUDA(name, "aten::divide_") + STATIC_CONSTEXPR_STR_INL_EXCEPT_WIN_CUDA(overload_name, "Scalar_mode") + STATIC_CONSTEXPR_STR_INL_EXCEPT_WIN_CUDA(schema_str, "divide_.Scalar_mode(Tensor(a!) self, Scalar other, *, str? rounding_mode) -> Tensor(a!)") + static at::Tensor & call(at::Tensor & self, const at::Scalar & other, c10::optional rounding_mode); + static at::Tensor & redispatch(c10::DispatchKeySet dispatchKeySet, at::Tensor & self, const at::Scalar & other, c10::optional rounding_mode); +}; + +}} // namespace at::_ops diff --git a/videollama2/lib/python3.10/site-packages/torch/include/ATen/ops/fft_fft2_compositeimplicitautograd_dispatch.h b/videollama2/lib/python3.10/site-packages/torch/include/ATen/ops/fft_fft2_compositeimplicitautograd_dispatch.h new file mode 100644 index 0000000000000000000000000000000000000000..f2c0430c55f70ead3a75af86f913f5fcbbe46bda --- /dev/null +++ b/videollama2/lib/python3.10/site-packages/torch/include/ATen/ops/fft_fft2_compositeimplicitautograd_dispatch.h @@ -0,0 +1,28 @@ +#pragma once +// @generated by torchgen/gen.py from DispatchKeyFunction.h + +// NB: The implementing C++ file is RegisterDispatchKey.cpp + +// The only #includes we need are for custom classes that have defaults in the C++ API +#include +#include +#include + +// Forward declarations of any types needed in the operator signatures. +// We can't directly include these classes because it will cause circular include dependencies. +// This file is included by TensorBody.h, which defines the Tensor class. +#include + +namespace at { + +namespace compositeimplicitautograd { + +TORCH_API at::Tensor fft_fft2(const at::Tensor & self, at::OptionalIntArrayRef s=c10::nullopt, at::IntArrayRef dim={-2,-1}, c10::optional norm=c10::nullopt); +TORCH_API at::Tensor fft_fft2_symint(const at::Tensor & self, at::OptionalSymIntArrayRef s=c10::nullopt, at::IntArrayRef dim={-2,-1}, c10::optional norm=c10::nullopt); +TORCH_API at::Tensor & fft_fft2_out(at::Tensor & out, const at::Tensor & self, at::OptionalIntArrayRef s=c10::nullopt, at::IntArrayRef dim={-2,-1}, c10::optional norm=c10::nullopt); +TORCH_API at::Tensor & fft_fft2_outf(const at::Tensor & self, at::OptionalIntArrayRef s, at::IntArrayRef dim, c10::optional norm, at::Tensor & out); +TORCH_API at::Tensor & fft_fft2_symint_out(at::Tensor & out, const at::Tensor & self, at::OptionalSymIntArrayRef s=c10::nullopt, at::IntArrayRef dim={-2,-1}, c10::optional norm=c10::nullopt); +TORCH_API at::Tensor & fft_fft2_symint_outf(const at::Tensor & self, at::OptionalSymIntArrayRef s, at::IntArrayRef dim, c10::optional norm, at::Tensor & out); + +} // namespace compositeimplicitautograd +} // namespace at diff --git a/videollama2/lib/python3.10/site-packages/torch/include/ATen/ops/fft_ifftn_compositeimplicitautograd_dispatch.h b/videollama2/lib/python3.10/site-packages/torch/include/ATen/ops/fft_ifftn_compositeimplicitautograd_dispatch.h new file mode 100644 index 0000000000000000000000000000000000000000..d6ac95bab6898082d475d9fa8435e44ce0c290be --- /dev/null +++ b/videollama2/lib/python3.10/site-packages/torch/include/ATen/ops/fft_ifftn_compositeimplicitautograd_dispatch.h @@ -0,0 +1,28 @@ +#pragma once +// @generated by torchgen/gen.py from DispatchKeyFunction.h + +// NB: The implementing C++ file is RegisterDispatchKey.cpp + +// The only #includes we need are for custom classes that have defaults in the C++ API +#include +#include +#include + +// Forward declarations of any types needed in the operator signatures. +// We can't directly include these classes because it will cause circular include dependencies. +// This file is included by TensorBody.h, which defines the Tensor class. +#include + +namespace at { + +namespace compositeimplicitautograd { + +TORCH_API at::Tensor fft_ifftn(const at::Tensor & self, at::OptionalIntArrayRef s=c10::nullopt, at::OptionalIntArrayRef dim=c10::nullopt, c10::optional norm=c10::nullopt); +TORCH_API at::Tensor fft_ifftn_symint(const at::Tensor & self, at::OptionalSymIntArrayRef s=c10::nullopt, at::OptionalIntArrayRef dim=c10::nullopt, c10::optional norm=c10::nullopt); +TORCH_API at::Tensor & fft_ifftn_out(at::Tensor & out, const at::Tensor & self, at::OptionalIntArrayRef s=c10::nullopt, at::OptionalIntArrayRef dim=c10::nullopt, c10::optional norm=c10::nullopt); +TORCH_API at::Tensor & fft_ifftn_outf(const at::Tensor & self, at::OptionalIntArrayRef s, at::OptionalIntArrayRef dim, c10::optional norm, at::Tensor & out); +TORCH_API at::Tensor & fft_ifftn_symint_out(at::Tensor & out, const at::Tensor & self, at::OptionalSymIntArrayRef s=c10::nullopt, at::OptionalIntArrayRef dim=c10::nullopt, c10::optional norm=c10::nullopt); +TORCH_API at::Tensor & fft_ifftn_symint_outf(const at::Tensor & self, at::OptionalSymIntArrayRef s, at::OptionalIntArrayRef dim, c10::optional norm, at::Tensor & out); + +} // namespace compositeimplicitautograd +} // namespace at diff --git a/videollama2/lib/python3.10/site-packages/torch/include/ATen/ops/fft_rfftn.h b/videollama2/lib/python3.10/site-packages/torch/include/ATen/ops/fft_rfftn.h new file mode 100644 index 0000000000000000000000000000000000000000..2d236a3157004e4b1a100e010c676d5ca18947f5 --- /dev/null +++ b/videollama2/lib/python3.10/site-packages/torch/include/ATen/ops/fft_rfftn.h @@ -0,0 +1,91 @@ +#pragma once + +// @generated by torchgen/gen.py from Function.h + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + + + +#include + +namespace at { + + +// aten::fft_rfftn(Tensor self, SymInt[1]? s=None, int[1]? dim=None, str? norm=None) -> Tensor +inline at::Tensor fft_rfftn(const at::Tensor & self, at::OptionalIntArrayRef s=c10::nullopt, at::OptionalIntArrayRef dim=c10::nullopt, c10::optional norm=c10::nullopt) { + return at::_ops::fft_rfftn::call(self, s.has_value() ? c10::make_optional(c10::fromIntArrayRefSlow(*s)) : c10::nullopt, dim, norm); +} +namespace symint { + template ::value>> + at::Tensor fft_rfftn(const at::Tensor & self, at::OptionalIntArrayRef s=c10::nullopt, at::OptionalIntArrayRef dim=c10::nullopt, c10::optional norm=c10::nullopt) { + return at::_ops::fft_rfftn::call(self, s.has_value() ? c10::make_optional(c10::fromIntArrayRefSlow(*s)) : c10::nullopt, dim, norm); + } +} + +// aten::fft_rfftn(Tensor self, SymInt[1]? s=None, int[1]? dim=None, str? norm=None) -> Tensor +inline at::Tensor fft_rfftn_symint(const at::Tensor & self, at::OptionalSymIntArrayRef s=c10::nullopt, at::OptionalIntArrayRef dim=c10::nullopt, c10::optional norm=c10::nullopt) { + return at::_ops::fft_rfftn::call(self, s, dim, norm); +} +namespace symint { + template ::value>> + at::Tensor fft_rfftn(const at::Tensor & self, at::OptionalSymIntArrayRef s=c10::nullopt, at::OptionalIntArrayRef dim=c10::nullopt, c10::optional norm=c10::nullopt) { + return at::_ops::fft_rfftn::call(self, s, dim, norm); + } +} + +// aten::fft_rfftn.out(Tensor self, SymInt[1]? s=None, int[1]? dim=None, str? norm=None, *, Tensor(a!) out) -> Tensor(a!) +inline at::Tensor & fft_rfftn_out(at::Tensor & out, const at::Tensor & self, at::OptionalIntArrayRef s=c10::nullopt, at::OptionalIntArrayRef dim=c10::nullopt, c10::optional norm=c10::nullopt) { + return at::_ops::fft_rfftn_out::call(self, s.has_value() ? c10::make_optional(c10::fromIntArrayRefSlow(*s)) : c10::nullopt, dim, norm, out); +} +namespace symint { + template ::value>> + at::Tensor & fft_rfftn_out(at::Tensor & out, const at::Tensor & self, at::OptionalIntArrayRef s=c10::nullopt, at::OptionalIntArrayRef dim=c10::nullopt, c10::optional norm=c10::nullopt) { + return at::_ops::fft_rfftn_out::call(self, s.has_value() ? c10::make_optional(c10::fromIntArrayRefSlow(*s)) : c10::nullopt, dim, norm, out); + } +} + +// aten::fft_rfftn.out(Tensor self, SymInt[1]? s=None, int[1]? dim=None, str? norm=None, *, Tensor(a!) out) -> Tensor(a!) +inline at::Tensor & fft_rfftn_outf(const at::Tensor & self, at::OptionalIntArrayRef s, at::OptionalIntArrayRef dim, c10::optional norm, at::Tensor & out) { + return at::_ops::fft_rfftn_out::call(self, s.has_value() ? c10::make_optional(c10::fromIntArrayRefSlow(*s)) : c10::nullopt, dim, norm, out); +} +namespace symint { + template ::value>> + at::Tensor & fft_rfftn_outf(const at::Tensor & self, at::OptionalIntArrayRef s, at::OptionalIntArrayRef dim, c10::optional norm, at::Tensor & out) { + return at::_ops::fft_rfftn_out::call(self, s.has_value() ? c10::make_optional(c10::fromIntArrayRefSlow(*s)) : c10::nullopt, dim, norm, out); + } +} + +// aten::fft_rfftn.out(Tensor self, SymInt[1]? s=None, int[1]? dim=None, str? norm=None, *, Tensor(a!) out) -> Tensor(a!) +inline at::Tensor & fft_rfftn_symint_out(at::Tensor & out, const at::Tensor & self, at::OptionalSymIntArrayRef s=c10::nullopt, at::OptionalIntArrayRef dim=c10::nullopt, c10::optional norm=c10::nullopt) { + return at::_ops::fft_rfftn_out::call(self, s, dim, norm, out); +} +namespace symint { + template ::value>> + at::Tensor & fft_rfftn_out(at::Tensor & out, const at::Tensor & self, at::OptionalSymIntArrayRef s=c10::nullopt, at::OptionalIntArrayRef dim=c10::nullopt, c10::optional norm=c10::nullopt) { + return at::_ops::fft_rfftn_out::call(self, s, dim, norm, out); + } +} + +// aten::fft_rfftn.out(Tensor self, SymInt[1]? s=None, int[1]? dim=None, str? norm=None, *, Tensor(a!) out) -> Tensor(a!) +inline at::Tensor & fft_rfftn_symint_outf(const at::Tensor & self, at::OptionalSymIntArrayRef s, at::OptionalIntArrayRef dim, c10::optional norm, at::Tensor & out) { + return at::_ops::fft_rfftn_out::call(self, s, dim, norm, out); +} +namespace symint { + template ::value>> + at::Tensor & fft_rfftn_outf(const at::Tensor & self, at::OptionalSymIntArrayRef s, at::OptionalIntArrayRef dim, c10::optional norm, at::Tensor & out) { + return at::_ops::fft_rfftn_out::call(self, s, dim, norm, out); + } +} + +} diff --git a/videollama2/lib/python3.10/site-packages/torch/include/ATen/ops/fill.h b/videollama2/lib/python3.10/site-packages/torch/include/ATen/ops/fill.h new file mode 100644 index 0000000000000000000000000000000000000000..2aad5b3b1789d6ccb9948ab4f411378d44983682 --- /dev/null +++ b/videollama2/lib/python3.10/site-packages/torch/include/ATen/ops/fill.h @@ -0,0 +1,63 @@ +#pragma once + +// @generated by torchgen/gen.py from Function.h + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + + + +#include + +namespace at { + + +// aten::fill.Scalar(Tensor self, Scalar value) -> Tensor +inline at::Tensor fill(const at::Tensor & self, const at::Scalar & value) { + return at::_ops::fill_Scalar::call(self, value); +} + +// aten::fill.Tensor(Tensor self, Tensor value) -> Tensor +inline at::Tensor fill(const at::Tensor & self, const at::Tensor & value) { + return at::_ops::fill_Tensor::call(self, value); +} + +// aten::fill_.Scalar(Tensor(a!) self, Scalar value) -> Tensor(a!) +inline at::Tensor & fill_(at::Tensor & self, const at::Scalar & value) { + return at::_ops::fill__Scalar::call(self, value); +} + +// aten::fill_.Tensor(Tensor(a!) self, Tensor value) -> Tensor(a!) +inline at::Tensor & fill_(at::Tensor & self, const at::Tensor & value) { + return at::_ops::fill__Tensor::call(self, value); +} + +// aten::fill.Scalar_out(Tensor self, Scalar value, *, Tensor(a!) out) -> Tensor(a!) +inline at::Tensor & fill_out(at::Tensor & out, const at::Tensor & self, const at::Scalar & value) { + return at::_ops::fill_Scalar_out::call(self, value, out); +} +// aten::fill.Scalar_out(Tensor self, Scalar value, *, Tensor(a!) out) -> Tensor(a!) +inline at::Tensor & fill_outf(const at::Tensor & self, const at::Scalar & value, at::Tensor & out) { + return at::_ops::fill_Scalar_out::call(self, value, out); +} + +// aten::fill.Tensor_out(Tensor self, Tensor value, *, Tensor(a!) out) -> Tensor(a!) +inline at::Tensor & fill_out(at::Tensor & out, const at::Tensor & self, const at::Tensor & value) { + return at::_ops::fill_Tensor_out::call(self, value, out); +} +// aten::fill.Tensor_out(Tensor self, Tensor value, *, Tensor(a!) out) -> Tensor(a!) +inline at::Tensor & fill_outf(const at::Tensor & self, const at::Tensor & value, at::Tensor & out) { + return at::_ops::fill_Tensor_out::call(self, value, out); +} + +} diff --git a/videollama2/lib/python3.10/site-packages/torch/include/ATen/ops/group_norm_compositeimplicitautograd_dispatch.h b/videollama2/lib/python3.10/site-packages/torch/include/ATen/ops/group_norm_compositeimplicitautograd_dispatch.h new file mode 100644 index 0000000000000000000000000000000000000000..cc86fcea7422f130b2fe9a101b017823f30e659c --- /dev/null +++ b/videollama2/lib/python3.10/site-packages/torch/include/ATen/ops/group_norm_compositeimplicitautograd_dispatch.h @@ -0,0 +1,23 @@ +#pragma once +// @generated by torchgen/gen.py from DispatchKeyFunction.h + +// NB: The implementing C++ file is RegisterDispatchKey.cpp + +// The only #includes we need are for custom classes that have defaults in the C++ API +#include +#include +#include + +// Forward declarations of any types needed in the operator signatures. +// We can't directly include these classes because it will cause circular include dependencies. +// This file is included by TensorBody.h, which defines the Tensor class. +#include + +namespace at { + +namespace compositeimplicitautograd { + +TORCH_API at::Tensor group_norm(const at::Tensor & input, int64_t num_groups, const c10::optional & weight={}, const c10::optional & bias={}, double eps=1e-05, bool cudnn_enabled=true); + +} // namespace compositeimplicitautograd +} // namespace at diff --git a/videollama2/lib/python3.10/site-packages/torch/include/ATen/ops/hann_window_ops.h b/videollama2/lib/python3.10/site-packages/torch/include/ATen/ops/hann_window_ops.h new file mode 100644 index 0000000000000000000000000000000000000000..983d9e156e6319fc5d3999f0ac7e22c18705f106 --- /dev/null +++ b/videollama2/lib/python3.10/site-packages/torch/include/ATen/ops/hann_window_ops.h @@ -0,0 +1,61 @@ +#pragma once + +// @generated by torchgen/gen.py from Operator.h + +#include +#include + +// Forward declarations of any types needed in the operator signatures. +// We can't directly include these classes because it will cause circular include dependencies. +// This file is included by TensorBody.h, which defines the Tensor class. +#include + +namespace at { +namespace _ops { + + +struct TORCH_API hann_window { + using schema = at::Tensor (int64_t, c10::optional, c10::optional, c10::optional, c10::optional); + using ptr_schema = schema*; + // See Note [static constexpr char* members for windows NVCC] + STATIC_CONSTEXPR_STR_INL_EXCEPT_WIN_CUDA(name, "aten::hann_window") + STATIC_CONSTEXPR_STR_INL_EXCEPT_WIN_CUDA(overload_name, "") + STATIC_CONSTEXPR_STR_INL_EXCEPT_WIN_CUDA(schema_str, "hann_window(int window_length, *, ScalarType? dtype=None, Layout? layout=None, Device? device=None, bool? pin_memory=None) -> Tensor") + static at::Tensor call(int64_t window_length, c10::optional dtype, c10::optional layout, c10::optional device, c10::optional pin_memory); + static at::Tensor redispatch(c10::DispatchKeySet dispatchKeySet, int64_t window_length, c10::optional dtype, c10::optional layout, c10::optional device, c10::optional pin_memory); +}; + +struct TORCH_API hann_window_periodic { + using schema = at::Tensor (int64_t, bool, c10::optional, c10::optional, c10::optional, c10::optional); + using ptr_schema = schema*; + // See Note [static constexpr char* members for windows NVCC] + STATIC_CONSTEXPR_STR_INL_EXCEPT_WIN_CUDA(name, "aten::hann_window") + STATIC_CONSTEXPR_STR_INL_EXCEPT_WIN_CUDA(overload_name, "periodic") + STATIC_CONSTEXPR_STR_INL_EXCEPT_WIN_CUDA(schema_str, "hann_window.periodic(int window_length, bool periodic, *, ScalarType? dtype=None, Layout? layout=None, Device? device=None, bool? pin_memory=None) -> Tensor") + static at::Tensor call(int64_t window_length, bool periodic, c10::optional dtype, c10::optional layout, c10::optional device, c10::optional pin_memory); + static at::Tensor redispatch(c10::DispatchKeySet dispatchKeySet, int64_t window_length, bool periodic, c10::optional dtype, c10::optional layout, c10::optional device, c10::optional pin_memory); +}; + +struct TORCH_API hann_window_out { + using schema = at::Tensor & (int64_t, at::Tensor &); + using ptr_schema = schema*; + // See Note [static constexpr char* members for windows NVCC] + STATIC_CONSTEXPR_STR_INL_EXCEPT_WIN_CUDA(name, "aten::hann_window") + STATIC_CONSTEXPR_STR_INL_EXCEPT_WIN_CUDA(overload_name, "out") + STATIC_CONSTEXPR_STR_INL_EXCEPT_WIN_CUDA(schema_str, "hann_window.out(int window_length, *, Tensor(a!) out) -> Tensor(a!)") + static at::Tensor & call(int64_t window_length, at::Tensor & out); + static at::Tensor & redispatch(c10::DispatchKeySet dispatchKeySet, int64_t window_length, at::Tensor & out); +}; + +struct TORCH_API hann_window_periodic_out { + using schema = at::Tensor & (int64_t, bool, at::Tensor &); + using ptr_schema = schema*; + // See Note [static constexpr char* members for windows NVCC] + STATIC_CONSTEXPR_STR_INL_EXCEPT_WIN_CUDA(name, "aten::hann_window") + STATIC_CONSTEXPR_STR_INL_EXCEPT_WIN_CUDA(overload_name, "periodic_out") + STATIC_CONSTEXPR_STR_INL_EXCEPT_WIN_CUDA(schema_str, "hann_window.periodic_out(int window_length, bool periodic, *, Tensor(a!) out) -> Tensor(a!)") + static at::Tensor & call(int64_t window_length, bool periodic, at::Tensor & out); + static at::Tensor & redispatch(c10::DispatchKeySet dispatchKeySet, int64_t window_length, bool periodic, at::Tensor & out); +}; + +}} // namespace at::_ops diff --git a/videollama2/lib/python3.10/site-packages/torch/include/ATen/ops/kaiser_window_compositeexplicitautograd_dispatch.h b/videollama2/lib/python3.10/site-packages/torch/include/ATen/ops/kaiser_window_compositeexplicitautograd_dispatch.h new file mode 100644 index 0000000000000000000000000000000000000000..4e0fed016566596b6dfd1845c027137314a03009 --- /dev/null +++ b/videollama2/lib/python3.10/site-packages/torch/include/ATen/ops/kaiser_window_compositeexplicitautograd_dispatch.h @@ -0,0 +1,34 @@ +#pragma once +// @generated by torchgen/gen.py from DispatchKeyFunction.h + +// NB: The implementing C++ file is RegisterDispatchKey.cpp + +// The only #includes we need are for custom classes that have defaults in the C++ API +#include +#include +#include + +// Forward declarations of any types needed in the operator signatures. +// We can't directly include these classes because it will cause circular include dependencies. +// This file is included by TensorBody.h, which defines the Tensor class. +#include + +namespace at { + +namespace compositeexplicitautograd { + +TORCH_API at::Tensor kaiser_window(int64_t window_length, at::TensorOptions options={}); +TORCH_API at::Tensor kaiser_window(int64_t window_length, c10::optional dtype, c10::optional layout, c10::optional device, c10::optional pin_memory); +TORCH_API at::Tensor & kaiser_window_out(at::Tensor & out, int64_t window_length); +TORCH_API at::Tensor & kaiser_window_outf(int64_t window_length, at::Tensor & out); +TORCH_API at::Tensor kaiser_window(int64_t window_length, bool periodic, at::TensorOptions options={}); +TORCH_API at::Tensor kaiser_window(int64_t window_length, bool periodic, c10::optional dtype, c10::optional layout, c10::optional device, c10::optional pin_memory); +TORCH_API at::Tensor & kaiser_window_out(at::Tensor & out, int64_t window_length, bool periodic); +TORCH_API at::Tensor & kaiser_window_outf(int64_t window_length, bool periodic, at::Tensor & out); +TORCH_API at::Tensor kaiser_window(int64_t window_length, bool periodic, double beta, at::TensorOptions options={}); +TORCH_API at::Tensor kaiser_window(int64_t window_length, bool periodic, double beta, c10::optional dtype, c10::optional layout, c10::optional device, c10::optional pin_memory); +TORCH_API at::Tensor & kaiser_window_out(at::Tensor & out, int64_t window_length, bool periodic, double beta); +TORCH_API at::Tensor & kaiser_window_outf(int64_t window_length, bool periodic, double beta, at::Tensor & out); + +} // namespace compositeexplicitautograd +} // namespace at diff --git a/videollama2/lib/python3.10/site-packages/torch/include/ATen/ops/linalg_eigvals_ops.h b/videollama2/lib/python3.10/site-packages/torch/include/ATen/ops/linalg_eigvals_ops.h new file mode 100644 index 0000000000000000000000000000000000000000..4fc0beb7820d8697067cc8ddcdb246bf6323e5d8 --- /dev/null +++ b/videollama2/lib/python3.10/site-packages/torch/include/ATen/ops/linalg_eigvals_ops.h @@ -0,0 +1,39 @@ +#pragma once + +// @generated by torchgen/gen.py from Operator.h + +#include +#include + +// Forward declarations of any types needed in the operator signatures. +// We can't directly include these classes because it will cause circular include dependencies. +// This file is included by TensorBody.h, which defines the Tensor class. +#include + +namespace at { +namespace _ops { + + +struct TORCH_API linalg_eigvals { + using schema = at::Tensor (const at::Tensor &); + using ptr_schema = schema*; + // See Note [static constexpr char* members for windows NVCC] + STATIC_CONSTEXPR_STR_INL_EXCEPT_WIN_CUDA(name, "aten::linalg_eigvals") + STATIC_CONSTEXPR_STR_INL_EXCEPT_WIN_CUDA(overload_name, "") + STATIC_CONSTEXPR_STR_INL_EXCEPT_WIN_CUDA(schema_str, "linalg_eigvals(Tensor self) -> Tensor") + static at::Tensor call(const at::Tensor & self); + static at::Tensor redispatch(c10::DispatchKeySet dispatchKeySet, const at::Tensor & self); +}; + +struct TORCH_API linalg_eigvals_out { + using schema = at::Tensor & (const at::Tensor &, at::Tensor &); + using ptr_schema = schema*; + // See Note [static constexpr char* members for windows NVCC] + STATIC_CONSTEXPR_STR_INL_EXCEPT_WIN_CUDA(name, "aten::linalg_eigvals") + STATIC_CONSTEXPR_STR_INL_EXCEPT_WIN_CUDA(overload_name, "out") + STATIC_CONSTEXPR_STR_INL_EXCEPT_WIN_CUDA(schema_str, "linalg_eigvals.out(Tensor self, *, Tensor(a!) out) -> Tensor(a!)") + static at::Tensor & call(const at::Tensor & self, at::Tensor & out); + static at::Tensor & redispatch(c10::DispatchKeySet dispatchKeySet, const at::Tensor & self, at::Tensor & out); +}; + +}} // namespace at::_ops diff --git a/videollama2/lib/python3.10/site-packages/torch/include/ATen/ops/linalg_householder_product_ops.h b/videollama2/lib/python3.10/site-packages/torch/include/ATen/ops/linalg_householder_product_ops.h new file mode 100644 index 0000000000000000000000000000000000000000..f4abedf4910d3717b83d1631888a7bd4ce7d39c4 --- /dev/null +++ b/videollama2/lib/python3.10/site-packages/torch/include/ATen/ops/linalg_householder_product_ops.h @@ -0,0 +1,39 @@ +#pragma once + +// @generated by torchgen/gen.py from Operator.h + +#include +#include + +// Forward declarations of any types needed in the operator signatures. +// We can't directly include these classes because it will cause circular include dependencies. +// This file is included by TensorBody.h, which defines the Tensor class. +#include + +namespace at { +namespace _ops { + + +struct TORCH_API linalg_householder_product { + using schema = at::Tensor (const at::Tensor &, const at::Tensor &); + using ptr_schema = schema*; + // See Note [static constexpr char* members for windows NVCC] + STATIC_CONSTEXPR_STR_INL_EXCEPT_WIN_CUDA(name, "aten::linalg_householder_product") + STATIC_CONSTEXPR_STR_INL_EXCEPT_WIN_CUDA(overload_name, "") + STATIC_CONSTEXPR_STR_INL_EXCEPT_WIN_CUDA(schema_str, "linalg_householder_product(Tensor input, Tensor tau) -> Tensor") + static at::Tensor call(const at::Tensor & input, const at::Tensor & tau); + static at::Tensor redispatch(c10::DispatchKeySet dispatchKeySet, const at::Tensor & input, const at::Tensor & tau); +}; + +struct TORCH_API linalg_householder_product_out { + using schema = at::Tensor & (const at::Tensor &, const at::Tensor &, at::Tensor &); + using ptr_schema = schema*; + // See Note [static constexpr char* members for windows NVCC] + STATIC_CONSTEXPR_STR_INL_EXCEPT_WIN_CUDA(name, "aten::linalg_householder_product") + STATIC_CONSTEXPR_STR_INL_EXCEPT_WIN_CUDA(overload_name, "out") + STATIC_CONSTEXPR_STR_INL_EXCEPT_WIN_CUDA(schema_str, "linalg_householder_product.out(Tensor input, Tensor tau, *, Tensor(a!) out) -> Tensor(a!)") + static at::Tensor & call(const at::Tensor & input, const at::Tensor & tau, at::Tensor & out); + static at::Tensor & redispatch(c10::DispatchKeySet dispatchKeySet, const at::Tensor & input, const at::Tensor & tau, at::Tensor & out); +}; + +}} // namespace at::_ops diff --git a/videollama2/lib/python3.10/site-packages/torch/include/ATen/ops/log_normal_cpu_dispatch.h b/videollama2/lib/python3.10/site-packages/torch/include/ATen/ops/log_normal_cpu_dispatch.h new file mode 100644 index 0000000000000000000000000000000000000000..7f058396ee17549b3d40c9b2323e16fc7f7651a4 --- /dev/null +++ b/videollama2/lib/python3.10/site-packages/torch/include/ATen/ops/log_normal_cpu_dispatch.h @@ -0,0 +1,23 @@ +#pragma once +// @generated by torchgen/gen.py from DispatchKeyFunction.h + +// NB: The implementing C++ file is RegisterDispatchKey.cpp + +// The only #includes we need are for custom classes that have defaults in the C++ API +#include +#include +#include + +// Forward declarations of any types needed in the operator signatures. +// We can't directly include these classes because it will cause circular include dependencies. +// This file is included by TensorBody.h, which defines the Tensor class. +#include + +namespace at { + +namespace cpu { + +TORCH_API at::Tensor & log_normal_(at::Tensor & self, double mean=1, double std=2, c10::optional generator=c10::nullopt); + +} // namespace cpu +} // namespace at diff --git a/videollama2/lib/python3.10/site-packages/torch/include/ATen/ops/logaddexp_cpu_dispatch.h b/videollama2/lib/python3.10/site-packages/torch/include/ATen/ops/logaddexp_cpu_dispatch.h new file mode 100644 index 0000000000000000000000000000000000000000..e4ce066c20fce6053ebfe50f3b47612c451d212e --- /dev/null +++ b/videollama2/lib/python3.10/site-packages/torch/include/ATen/ops/logaddexp_cpu_dispatch.h @@ -0,0 +1,25 @@ +#pragma once +// @generated by torchgen/gen.py from DispatchKeyFunction.h + +// NB: The implementing C++ file is RegisterDispatchKey.cpp + +// The only #includes we need are for custom classes that have defaults in the C++ API +#include +#include +#include + +// Forward declarations of any types needed in the operator signatures. +// We can't directly include these classes because it will cause circular include dependencies. +// This file is included by TensorBody.h, which defines the Tensor class. +#include + +namespace at { + +namespace cpu { + +TORCH_API at::Tensor logaddexp(const at::Tensor & self, const at::Tensor & other); +TORCH_API at::Tensor & logaddexp_out(at::Tensor & out, const at::Tensor & self, const at::Tensor & other); +TORCH_API at::Tensor & logaddexp_outf(const at::Tensor & self, const at::Tensor & other, at::Tensor & out); + +} // namespace cpu +} // namespace at diff --git a/videollama2/lib/python3.10/site-packages/torch/include/ATen/ops/logical_not.h b/videollama2/lib/python3.10/site-packages/torch/include/ATen/ops/logical_not.h new file mode 100644 index 0000000000000000000000000000000000000000..a9d4232ebc373b7802bb6c25c7a62f3e6d7e99a2 --- /dev/null +++ b/videollama2/lib/python3.10/site-packages/torch/include/ATen/ops/logical_not.h @@ -0,0 +1,39 @@ +#pragma once + +// @generated by torchgen/gen.py from Function.h + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + + + +#include + +namespace at { + + +// aten::logical_not(Tensor self) -> Tensor +inline at::Tensor logical_not(const at::Tensor & self) { + return at::_ops::logical_not::call(self); +} + +// aten::logical_not.out(Tensor self, *, Tensor(a!) out) -> Tensor(a!) +inline at::Tensor & logical_not_out(at::Tensor & out, const at::Tensor & self) { + return at::_ops::logical_not_out::call(self, out); +} +// aten::logical_not.out(Tensor self, *, Tensor(a!) out) -> Tensor(a!) +inline at::Tensor & logical_not_outf(const at::Tensor & self, at::Tensor & out) { + return at::_ops::logical_not_out::call(self, out); +} + +} diff --git a/videollama2/lib/python3.10/site-packages/torch/include/ATen/ops/max_pool3d_with_indices_backward_native.h b/videollama2/lib/python3.10/site-packages/torch/include/ATen/ops/max_pool3d_with_indices_backward_native.h new file mode 100644 index 0000000000000000000000000000000000000000..1350bf4ec06f18e2077a67c38cf3af99857de50e --- /dev/null +++ b/videollama2/lib/python3.10/site-packages/torch/include/ATen/ops/max_pool3d_with_indices_backward_native.h @@ -0,0 +1,24 @@ +#pragma once + +// @generated by torchgen/gen.py from NativeFunction.h + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + + +namespace at { +namespace native { +TORCH_API at::Tensor max_pool3d_with_indices_backward_cpu(const at::Tensor & grad_output, const at::Tensor & self, at::IntArrayRef kernel_size, at::IntArrayRef stride, at::IntArrayRef padding, at::IntArrayRef dilation, bool ceil_mode, const at::Tensor & indices); +TORCH_API at::Tensor & max_pool3d_with_indices_backward_out_cpu(const at::Tensor & grad_output, const at::Tensor & self, at::IntArrayRef kernel_size, at::IntArrayRef stride, at::IntArrayRef padding, at::IntArrayRef dilation, bool ceil_mode, const at::Tensor & indices, at::Tensor & grad_input); +TORCH_API at::Tensor max_pool3d_with_indices_backward_cuda(const at::Tensor & grad_output, const at::Tensor & self, at::IntArrayRef kernel_size, at::IntArrayRef stride, at::IntArrayRef padding, at::IntArrayRef dilation, bool ceil_mode, const at::Tensor & indices); +TORCH_API at::Tensor & max_pool3d_with_indices_backward_out_cuda(const at::Tensor & grad_output, const at::Tensor & self, at::IntArrayRef kernel_size, at::IntArrayRef stride, at::IntArrayRef padding, at::IntArrayRef dilation, bool ceil_mode, const at::Tensor & indices, at::Tensor & grad_input); +} // namespace native +} // namespace at diff --git a/videollama2/lib/python3.10/site-packages/torch/include/ATen/ops/mish_cpu_dispatch.h b/videollama2/lib/python3.10/site-packages/torch/include/ATen/ops/mish_cpu_dispatch.h new file mode 100644 index 0000000000000000000000000000000000000000..806e108437c6b578d888da3c02051172513ce3f7 --- /dev/null +++ b/videollama2/lib/python3.10/site-packages/torch/include/ATen/ops/mish_cpu_dispatch.h @@ -0,0 +1,26 @@ +#pragma once +// @generated by torchgen/gen.py from DispatchKeyFunction.h + +// NB: The implementing C++ file is RegisterDispatchKey.cpp + +// The only #includes we need are for custom classes that have defaults in the C++ API +#include +#include +#include + +// Forward declarations of any types needed in the operator signatures. +// We can't directly include these classes because it will cause circular include dependencies. +// This file is included by TensorBody.h, which defines the Tensor class. +#include + +namespace at { + +namespace cpu { + +TORCH_API at::Tensor mish(const at::Tensor & self); +TORCH_API at::Tensor & mish_out(at::Tensor & out, const at::Tensor & self); +TORCH_API at::Tensor & mish_outf(const at::Tensor & self, at::Tensor & out); +TORCH_API at::Tensor & mish_(at::Tensor & self); + +} // namespace cpu +} // namespace at diff --git a/videollama2/lib/python3.10/site-packages/torch/include/ATen/ops/mv_compositeexplicitautograd_dispatch.h b/videollama2/lib/python3.10/site-packages/torch/include/ATen/ops/mv_compositeexplicitautograd_dispatch.h new file mode 100644 index 0000000000000000000000000000000000000000..1c9f10b9910e489df4b1f2cf237cdddb237a0f97 --- /dev/null +++ b/videollama2/lib/python3.10/site-packages/torch/include/ATen/ops/mv_compositeexplicitautograd_dispatch.h @@ -0,0 +1,25 @@ +#pragma once +// @generated by torchgen/gen.py from DispatchKeyFunction.h + +// NB: The implementing C++ file is RegisterDispatchKey.cpp + +// The only #includes we need are for custom classes that have defaults in the C++ API +#include +#include +#include + +// Forward declarations of any types needed in the operator signatures. +// We can't directly include these classes because it will cause circular include dependencies. +// This file is included by TensorBody.h, which defines the Tensor class. +#include + +namespace at { + +namespace compositeexplicitautograd { + +TORCH_API at::Tensor mv(const at::Tensor & self, const at::Tensor & vec); +TORCH_API at::Tensor & mv_out(at::Tensor & out, const at::Tensor & self, const at::Tensor & vec); +TORCH_API at::Tensor & mv_outf(const at::Tensor & self, const at::Tensor & vec, at::Tensor & out); + +} // namespace compositeexplicitautograd +} // namespace at diff --git a/videollama2/lib/python3.10/site-packages/torch/include/ATen/ops/nansum_cuda_dispatch.h b/videollama2/lib/python3.10/site-packages/torch/include/ATen/ops/nansum_cuda_dispatch.h new file mode 100644 index 0000000000000000000000000000000000000000..a52e309b612a71dad4b3c26462d66b80cc63ef47 --- /dev/null +++ b/videollama2/lib/python3.10/site-packages/torch/include/ATen/ops/nansum_cuda_dispatch.h @@ -0,0 +1,25 @@ +#pragma once +// @generated by torchgen/gen.py from DispatchKeyFunction.h + +// NB: The implementing C++ file is RegisterDispatchKey.cpp + +// The only #includes we need are for custom classes that have defaults in the C++ API +#include +#include +#include + +// Forward declarations of any types needed in the operator signatures. +// We can't directly include these classes because it will cause circular include dependencies. +// This file is included by TensorBody.h, which defines the Tensor class. +#include + +namespace at { + +namespace cuda { + +TORCH_API at::Tensor nansum(const at::Tensor & self, at::OptionalIntArrayRef dim=c10::nullopt, bool keepdim=false, c10::optional dtype=c10::nullopt); +TORCH_API at::Tensor & nansum_out(at::Tensor & out, const at::Tensor & self, at::OptionalIntArrayRef dim=c10::nullopt, bool keepdim=false, c10::optional dtype=c10::nullopt); +TORCH_API at::Tensor & nansum_outf(const at::Tensor & self, at::OptionalIntArrayRef dim, bool keepdim, c10::optional dtype, at::Tensor & out); + +} // namespace cuda +} // namespace at diff --git a/videollama2/lib/python3.10/site-packages/torch/include/ATen/ops/nextafter_compositeexplicitautogradnonfunctional_dispatch.h b/videollama2/lib/python3.10/site-packages/torch/include/ATen/ops/nextafter_compositeexplicitautogradnonfunctional_dispatch.h new file mode 100644 index 0000000000000000000000000000000000000000..966a835e28805362dd75061f8074ce1cdec65ac1 --- /dev/null +++ b/videollama2/lib/python3.10/site-packages/torch/include/ATen/ops/nextafter_compositeexplicitautogradnonfunctional_dispatch.h @@ -0,0 +1,24 @@ +#pragma once +// @generated by torchgen/gen.py from DispatchKeyFunction.h + +// NB: The implementing C++ file is RegisterDispatchKey.cpp + +// The only #includes we need are for custom classes that have defaults in the C++ API +#include +#include +#include + +// Forward declarations of any types needed in the operator signatures. +// We can't directly include these classes because it will cause circular include dependencies. +// This file is included by TensorBody.h, which defines the Tensor class. +#include + +namespace at { + +namespace compositeexplicitautogradnonfunctional { + +TORCH_API at::Tensor nextafter(const at::Tensor & self, const at::Tensor & other); +TORCH_API at::Tensor & nextafter_(at::Tensor & self, const at::Tensor & other); + +} // namespace compositeexplicitautogradnonfunctional +} // namespace at diff --git a/videollama2/lib/python3.10/site-packages/torch/include/ATen/ops/nonzero_cpu_dispatch.h b/videollama2/lib/python3.10/site-packages/torch/include/ATen/ops/nonzero_cpu_dispatch.h new file mode 100644 index 0000000000000000000000000000000000000000..bfeb60ce37e7b5d808c126ecc6d1e17ee7fba447 --- /dev/null +++ b/videollama2/lib/python3.10/site-packages/torch/include/ATen/ops/nonzero_cpu_dispatch.h @@ -0,0 +1,25 @@ +#pragma once +// @generated by torchgen/gen.py from DispatchKeyFunction.h + +// NB: The implementing C++ file is RegisterDispatchKey.cpp + +// The only #includes we need are for custom classes that have defaults in the C++ API +#include +#include +#include + +// Forward declarations of any types needed in the operator signatures. +// We can't directly include these classes because it will cause circular include dependencies. +// This file is included by TensorBody.h, which defines the Tensor class. +#include + +namespace at { + +namespace cpu { + +TORCH_API at::Tensor nonzero(const at::Tensor & self); +TORCH_API at::Tensor & nonzero_out(at::Tensor & out, const at::Tensor & self); +TORCH_API at::Tensor & nonzero_outf(const at::Tensor & self, at::Tensor & out); + +} // namespace cpu +} // namespace at diff --git a/videollama2/lib/python3.10/site-packages/torch/include/ATen/ops/ones_like_native.h b/videollama2/lib/python3.10/site-packages/torch/include/ATen/ops/ones_like_native.h new file mode 100644 index 0000000000000000000000000000000000000000..1b5a78bead69378ded9d77e0da068c9d88180e1e --- /dev/null +++ b/videollama2/lib/python3.10/site-packages/torch/include/ATen/ops/ones_like_native.h @@ -0,0 +1,22 @@ +#pragma once + +// @generated by torchgen/gen.py from NativeFunction.h + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + + +namespace at { +namespace native { +TORCH_API at::Tensor ones_like(const at::Tensor & self, c10::optional dtype={}, c10::optional layout={}, c10::optional device={}, c10::optional pin_memory={}, c10::optional memory_format=c10::nullopt); +TORCH_API at::Tensor & ones_like_out(const at::Tensor & self, c10::optional memory_format, at::Tensor & out); +} // namespace native +} // namespace at diff --git a/videollama2/lib/python3.10/site-packages/torch/include/ATen/ops/range_meta_dispatch.h b/videollama2/lib/python3.10/site-packages/torch/include/ATen/ops/range_meta_dispatch.h new file mode 100644 index 0000000000000000000000000000000000000000..77e98257def78cb0657b1ae6ede7e8c08b0a3c5c --- /dev/null +++ b/videollama2/lib/python3.10/site-packages/torch/include/ATen/ops/range_meta_dispatch.h @@ -0,0 +1,24 @@ +#pragma once +// @generated by torchgen/gen.py from DispatchKeyFunction.h + +// NB: The implementing C++ file is RegisterDispatchKey.cpp + +// The only #includes we need are for custom classes that have defaults in the C++ API +#include +#include +#include + +// Forward declarations of any types needed in the operator signatures. +// We can't directly include these classes because it will cause circular include dependencies. +// This file is included by TensorBody.h, which defines the Tensor class. +#include + +namespace at { + +namespace meta { + +TORCH_API at::Tensor & range_out(at::Tensor & out, const at::Scalar & start, const at::Scalar & end, const at::Scalar & step); +TORCH_API at::Tensor & range_outf(const at::Scalar & start, const at::Scalar & end, const at::Scalar & step, at::Tensor & out); + +} // namespace meta +} // namespace at diff --git a/videollama2/lib/python3.10/site-packages/torch/include/ATen/ops/select_backward_compositeexplicitautogradnonfunctional_dispatch.h b/videollama2/lib/python3.10/site-packages/torch/include/ATen/ops/select_backward_compositeexplicitautogradnonfunctional_dispatch.h new file mode 100644 index 0000000000000000000000000000000000000000..642dcb59ccba60111b50636d699d07663d81ad65 --- /dev/null +++ b/videollama2/lib/python3.10/site-packages/torch/include/ATen/ops/select_backward_compositeexplicitautogradnonfunctional_dispatch.h @@ -0,0 +1,24 @@ +#pragma once +// @generated by torchgen/gen.py from DispatchKeyFunction.h + +// NB: The implementing C++ file is RegisterDispatchKey.cpp + +// The only #includes we need are for custom classes that have defaults in the C++ API +#include +#include +#include + +// Forward declarations of any types needed in the operator signatures. +// We can't directly include these classes because it will cause circular include dependencies. +// This file is included by TensorBody.h, which defines the Tensor class. +#include + +namespace at { + +namespace compositeexplicitautogradnonfunctional { + +TORCH_API at::Tensor select_backward(const at::Tensor & grad_output, at::IntArrayRef input_sizes, int64_t dim, int64_t index); +TORCH_API at::Tensor select_backward_symint(const at::Tensor & grad_output, c10::SymIntArrayRef input_sizes, int64_t dim, c10::SymInt index); + +} // namespace compositeexplicitautogradnonfunctional +} // namespace at diff --git a/videollama2/lib/python3.10/site-packages/torch/include/ATen/ops/select_scatter_compositeexplicitautograd_dispatch.h b/videollama2/lib/python3.10/site-packages/torch/include/ATen/ops/select_scatter_compositeexplicitautograd_dispatch.h new file mode 100644 index 0000000000000000000000000000000000000000..66e425c5b1a119dc16751055a855331999ebe3ee --- /dev/null +++ b/videollama2/lib/python3.10/site-packages/torch/include/ATen/ops/select_scatter_compositeexplicitautograd_dispatch.h @@ -0,0 +1,26 @@ +#pragma once +// @generated by torchgen/gen.py from DispatchKeyFunction.h + +// NB: The implementing C++ file is RegisterDispatchKey.cpp + +// The only #includes we need are for custom classes that have defaults in the C++ API +#include +#include +#include + +// Forward declarations of any types needed in the operator signatures. +// We can't directly include these classes because it will cause circular include dependencies. +// This file is included by TensorBody.h, which defines the Tensor class. +#include + +namespace at { + +namespace compositeexplicitautograd { + +TORCH_API at::Tensor & select_scatter_out(at::Tensor & out, const at::Tensor & self, const at::Tensor & src, int64_t dim, int64_t index); +TORCH_API at::Tensor & select_scatter_outf(const at::Tensor & self, const at::Tensor & src, int64_t dim, int64_t index, at::Tensor & out); +TORCH_API at::Tensor & select_scatter_symint_out(at::Tensor & out, const at::Tensor & self, const at::Tensor & src, int64_t dim, c10::SymInt index); +TORCH_API at::Tensor & select_scatter_symint_outf(const at::Tensor & self, const at::Tensor & src, int64_t dim, c10::SymInt index, at::Tensor & out); + +} // namespace compositeexplicitautograd +} // namespace at diff --git a/videollama2/lib/python3.10/site-packages/torch/include/ATen/ops/set_data_ops.h b/videollama2/lib/python3.10/site-packages/torch/include/ATen/ops/set_data_ops.h new file mode 100644 index 0000000000000000000000000000000000000000..86bf5fdc01b197b6ae761db42f17bd450baf3a54 --- /dev/null +++ b/videollama2/lib/python3.10/site-packages/torch/include/ATen/ops/set_data_ops.h @@ -0,0 +1,28 @@ +#pragma once + +// @generated by torchgen/gen.py from Operator.h + +#include +#include + +// Forward declarations of any types needed in the operator signatures. +// We can't directly include these classes because it will cause circular include dependencies. +// This file is included by TensorBody.h, which defines the Tensor class. +#include + +namespace at { +namespace _ops { + + +struct TORCH_API set_data { + using schema = void (at::Tensor &, const at::Tensor &); + using ptr_schema = schema*; + // See Note [static constexpr char* members for windows NVCC] + STATIC_CONSTEXPR_STR_INL_EXCEPT_WIN_CUDA(name, "aten::set_data") + STATIC_CONSTEXPR_STR_INL_EXCEPT_WIN_CUDA(overload_name, "") + STATIC_CONSTEXPR_STR_INL_EXCEPT_WIN_CUDA(schema_str, "set_data(Tensor(a!) self, Tensor new_data) -> ()") + static void call(at::Tensor & self, const at::Tensor & new_data); + static void redispatch(c10::DispatchKeySet dispatchKeySet, at::Tensor & self, const at::Tensor & new_data); +}; + +}} // namespace at::_ops diff --git a/videollama2/lib/python3.10/site-packages/torch/include/ATen/ops/sign_ops.h b/videollama2/lib/python3.10/site-packages/torch/include/ATen/ops/sign_ops.h new file mode 100644 index 0000000000000000000000000000000000000000..e93ccf0367d83c3eeae71196b1fa051992eba8da --- /dev/null +++ b/videollama2/lib/python3.10/site-packages/torch/include/ATen/ops/sign_ops.h @@ -0,0 +1,50 @@ +#pragma once + +// @generated by torchgen/gen.py from Operator.h + +#include +#include + +// Forward declarations of any types needed in the operator signatures. +// We can't directly include these classes because it will cause circular include dependencies. +// This file is included by TensorBody.h, which defines the Tensor class. +#include + +namespace at { +namespace _ops { + + +struct TORCH_API sign { + using schema = at::Tensor (const at::Tensor &); + using ptr_schema = schema*; + // See Note [static constexpr char* members for windows NVCC] + STATIC_CONSTEXPR_STR_INL_EXCEPT_WIN_CUDA(name, "aten::sign") + STATIC_CONSTEXPR_STR_INL_EXCEPT_WIN_CUDA(overload_name, "") + STATIC_CONSTEXPR_STR_INL_EXCEPT_WIN_CUDA(schema_str, "sign(Tensor self) -> Tensor") + static at::Tensor call(const at::Tensor & self); + static at::Tensor redispatch(c10::DispatchKeySet dispatchKeySet, const at::Tensor & self); +}; + +struct TORCH_API sign_ { + using schema = at::Tensor & (at::Tensor &); + using ptr_schema = schema*; + // See Note [static constexpr char* members for windows NVCC] + STATIC_CONSTEXPR_STR_INL_EXCEPT_WIN_CUDA(name, "aten::sign_") + STATIC_CONSTEXPR_STR_INL_EXCEPT_WIN_CUDA(overload_name, "") + STATIC_CONSTEXPR_STR_INL_EXCEPT_WIN_CUDA(schema_str, "sign_(Tensor(a!) self) -> Tensor(a!)") + static at::Tensor & call(at::Tensor & self); + static at::Tensor & redispatch(c10::DispatchKeySet dispatchKeySet, at::Tensor & self); +}; + +struct TORCH_API sign_out { + using schema = at::Tensor & (const at::Tensor &, at::Tensor &); + using ptr_schema = schema*; + // See Note [static constexpr char* members for windows NVCC] + STATIC_CONSTEXPR_STR_INL_EXCEPT_WIN_CUDA(name, "aten::sign") + STATIC_CONSTEXPR_STR_INL_EXCEPT_WIN_CUDA(overload_name, "out") + STATIC_CONSTEXPR_STR_INL_EXCEPT_WIN_CUDA(schema_str, "sign.out(Tensor self, *, Tensor(a!) out) -> Tensor(a!)") + static at::Tensor & call(const at::Tensor & self, at::Tensor & out); + static at::Tensor & redispatch(c10::DispatchKeySet dispatchKeySet, const at::Tensor & self, at::Tensor & out); +}; + +}} // namespace at::_ops diff --git a/videollama2/lib/python3.10/site-packages/torch/include/ATen/ops/t_copy_native.h b/videollama2/lib/python3.10/site-packages/torch/include/ATen/ops/t_copy_native.h new file mode 100644 index 0000000000000000000000000000000000000000..d1b53e7f675474217cfd978253f938d7fb3d4801 --- /dev/null +++ b/videollama2/lib/python3.10/site-packages/torch/include/ATen/ops/t_copy_native.h @@ -0,0 +1,22 @@ +#pragma once + +// @generated by torchgen/gen.py from NativeFunction.h + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + + +namespace at { +namespace native { +TORCH_API at::Tensor & t_copy_out(const at::Tensor & self, at::Tensor & out); +TORCH_API at::Tensor t_copy(const at::Tensor & self); +} // namespace native +} // namespace at diff --git a/videollama2/lib/python3.10/site-packages/torch/include/ATen/ops/to_mkldnn.h b/videollama2/lib/python3.10/site-packages/torch/include/ATen/ops/to_mkldnn.h new file mode 100644 index 0000000000000000000000000000000000000000..9430f7b93d85c9fa573f80df83e18d5c6cf2c968 --- /dev/null +++ b/videollama2/lib/python3.10/site-packages/torch/include/ATen/ops/to_mkldnn.h @@ -0,0 +1,34 @@ +#pragma once + +// @generated by torchgen/gen.py from Function.h + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + + + +#include + +namespace at { + + +// aten::to_mkldnn.out(Tensor self, ScalarType? dtype=None, *, Tensor(a!) out) -> Tensor(a!) +inline at::Tensor & to_mkldnn_out(at::Tensor & out, const at::Tensor & self, c10::optional dtype=c10::nullopt) { + return at::_ops::to_mkldnn_out::call(self, dtype, out); +} +// aten::to_mkldnn.out(Tensor self, ScalarType? dtype=None, *, Tensor(a!) out) -> Tensor(a!) +inline at::Tensor & to_mkldnn_outf(const at::Tensor & self, c10::optional dtype, at::Tensor & out) { + return at::_ops::to_mkldnn_out::call(self, dtype, out); +} + +} diff --git a/videollama2/lib/python3.10/site-packages/torch/include/ATen/ops/trace_ops.h b/videollama2/lib/python3.10/site-packages/torch/include/ATen/ops/trace_ops.h new file mode 100644 index 0000000000000000000000000000000000000000..5160db093adeedbdbbe7f6fd6e76d24c223a19a1 --- /dev/null +++ b/videollama2/lib/python3.10/site-packages/torch/include/ATen/ops/trace_ops.h @@ -0,0 +1,39 @@ +#pragma once + +// @generated by torchgen/gen.py from Operator.h + +#include +#include + +// Forward declarations of any types needed in the operator signatures. +// We can't directly include these classes because it will cause circular include dependencies. +// This file is included by TensorBody.h, which defines the Tensor class. +#include + +namespace at { +namespace _ops { + + +struct TORCH_API trace { + using schema = at::Tensor (const at::Tensor &); + using ptr_schema = schema*; + // See Note [static constexpr char* members for windows NVCC] + STATIC_CONSTEXPR_STR_INL_EXCEPT_WIN_CUDA(name, "aten::trace") + STATIC_CONSTEXPR_STR_INL_EXCEPT_WIN_CUDA(overload_name, "") + STATIC_CONSTEXPR_STR_INL_EXCEPT_WIN_CUDA(schema_str, "trace(Tensor self) -> Tensor") + static at::Tensor call(const at::Tensor & self); + static at::Tensor redispatch(c10::DispatchKeySet dispatchKeySet, const at::Tensor & self); +}; + +struct TORCH_API trace_out { + using schema = at::Tensor & (const at::Tensor &, at::Tensor &); + using ptr_schema = schema*; + // See Note [static constexpr char* members for windows NVCC] + STATIC_CONSTEXPR_STR_INL_EXCEPT_WIN_CUDA(name, "aten::trace") + STATIC_CONSTEXPR_STR_INL_EXCEPT_WIN_CUDA(overload_name, "out") + STATIC_CONSTEXPR_STR_INL_EXCEPT_WIN_CUDA(schema_str, "trace.out(Tensor self, *, Tensor(a!) out) -> Tensor(a!)") + static at::Tensor & call(const at::Tensor & self, at::Tensor & out); + static at::Tensor & redispatch(c10::DispatchKeySet dispatchKeySet, const at::Tensor & self, at::Tensor & out); +}; + +}} // namespace at::_ops diff --git a/videollama2/lib/python3.10/site-packages/torch/include/ATen/ops/view_as_real_cuda_dispatch.h b/videollama2/lib/python3.10/site-packages/torch/include/ATen/ops/view_as_real_cuda_dispatch.h new file mode 100644 index 0000000000000000000000000000000000000000..f73e2a9b5f1aede026ad7cd32488f728cd2eb2d6 --- /dev/null +++ b/videollama2/lib/python3.10/site-packages/torch/include/ATen/ops/view_as_real_cuda_dispatch.h @@ -0,0 +1,23 @@ +#pragma once +// @generated by torchgen/gen.py from DispatchKeyFunction.h + +// NB: The implementing C++ file is RegisterDispatchKey.cpp + +// The only #includes we need are for custom classes that have defaults in the C++ API +#include +#include +#include + +// Forward declarations of any types needed in the operator signatures. +// We can't directly include these classes because it will cause circular include dependencies. +// This file is included by TensorBody.h, which defines the Tensor class. +#include + +namespace at { + +namespace cuda { + +TORCH_API at::Tensor view_as_real(const at::Tensor & self); + +} // namespace cuda +} // namespace at diff --git a/videollama2/lib/python3.10/site-packages/torch/include/ATen/ops/where.h b/videollama2/lib/python3.10/site-packages/torch/include/ATen/ops/where.h new file mode 100644 index 0000000000000000000000000000000000000000..3d21f410fd827ed187004ada3c98e45cac52689c --- /dev/null +++ b/videollama2/lib/python3.10/site-packages/torch/include/ATen/ops/where.h @@ -0,0 +1,59 @@ +#pragma once + +// @generated by torchgen/gen.py from Function.h + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + + + +#include + +namespace at { + + +// aten::where.self(Tensor condition, Tensor self, Tensor other) -> Tensor +inline at::Tensor where(const at::Tensor & condition, const at::Tensor & self, const at::Tensor & other) { + return at::_ops::where_self::call(condition, self, other); +} + +// aten::where.self_out(Tensor condition, Tensor self, Tensor other, *, Tensor(a!) out) -> Tensor(a!) +inline at::Tensor & where_out(at::Tensor & out, const at::Tensor & condition, const at::Tensor & self, const at::Tensor & other) { + return at::_ops::where_self_out::call(condition, self, other, out); +} +// aten::where.self_out(Tensor condition, Tensor self, Tensor other, *, Tensor(a!) out) -> Tensor(a!) +inline at::Tensor & where_outf(const at::Tensor & condition, const at::Tensor & self, const at::Tensor & other, at::Tensor & out) { + return at::_ops::where_self_out::call(condition, self, other, out); +} + +// aten::where.ScalarSelf(Tensor condition, Scalar self, Tensor other) -> Tensor +inline at::Tensor where(const at::Tensor & condition, const at::Scalar & self, const at::Tensor & other) { + return at::_ops::where_ScalarSelf::call(condition, self, other); +} + +// aten::where.ScalarOther(Tensor condition, Tensor self, Scalar other) -> Tensor +inline at::Tensor where(const at::Tensor & condition, const at::Tensor & self, const at::Scalar & other) { + return at::_ops::where_ScalarOther::call(condition, self, other); +} + +// aten::where.Scalar(Tensor condition, Scalar self, Scalar other) -> Tensor +inline at::Tensor where(const at::Tensor & condition, const at::Scalar & self, const at::Scalar & other) { + return at::_ops::where_Scalar::call(condition, self, other); +} + +// aten::where(Tensor condition) -> Tensor[] +inline ::std::vector where(const at::Tensor & condition) { + return at::_ops::where::call(condition); +} + +} diff --git a/vllm/lib/python3.10/site-packages/ray/rllib/evaluation/__pycache__/sample_batch_builder.cpython-310.pyc b/vllm/lib/python3.10/site-packages/ray/rllib/evaluation/__pycache__/sample_batch_builder.cpython-310.pyc new file mode 100644 index 0000000000000000000000000000000000000000..996fdc2e46c98d4b06093f93dc67aa6d2de93b1b Binary files /dev/null and b/vllm/lib/python3.10/site-packages/ray/rllib/evaluation/__pycache__/sample_batch_builder.cpython-310.pyc differ diff --git a/vllm/lib/python3.10/site-packages/ray/rllib/evaluation/collectors/__init__.py b/vllm/lib/python3.10/site-packages/ray/rllib/evaluation/collectors/__init__.py new file mode 100644 index 0000000000000000000000000000000000000000..e69de29bb2d1d6434b8b29ae775ad8c2e48c5391 diff --git a/vllm/lib/python3.10/site-packages/ray/rllib/evaluation/collectors/__pycache__/sample_collector.cpython-310.pyc b/vllm/lib/python3.10/site-packages/ray/rllib/evaluation/collectors/__pycache__/sample_collector.cpython-310.pyc new file mode 100644 index 0000000000000000000000000000000000000000..98e86e74951138089bb38c57b6e70fe94c97b031 Binary files /dev/null and b/vllm/lib/python3.10/site-packages/ray/rllib/evaluation/collectors/__pycache__/sample_collector.cpython-310.pyc differ diff --git a/vllm/lib/python3.10/site-packages/ray/rllib/evaluation/sampler.py b/vllm/lib/python3.10/site-packages/ray/rllib/evaluation/sampler.py new file mode 100644 index 0000000000000000000000000000000000000000..dadc65451cce36be4c2bc2a2d11e9a9b6d2ec2ba --- /dev/null +++ b/vllm/lib/python3.10/site-packages/ray/rllib/evaluation/sampler.py @@ -0,0 +1,253 @@ +import logging +import queue +from abc import ABCMeta, abstractmethod +from collections import defaultdict, namedtuple +from typing import ( + TYPE_CHECKING, + Any, + List, + Optional, + Type, + Union, +) + +from ray.rllib.env.base_env import BaseEnv, convert_to_base_env +from ray.rllib.evaluation.collectors.sample_collector import SampleCollector +from ray.rllib.evaluation.collectors.simple_list_collector import SimpleListCollector +from ray.rllib.evaluation.env_runner_v2 import EnvRunnerV2, _PerfStats +from ray.rllib.evaluation.metrics import RolloutMetrics +from ray.rllib.offline import InputReader +from ray.rllib.policy.sample_batch import concat_samples +from ray.rllib.utils.annotations import OldAPIStack, override +from ray.rllib.utils.deprecation import deprecation_warning, DEPRECATED_VALUE +from ray.rllib.utils.framework import try_import_tf +from ray.rllib.utils.typing import SampleBatchType +from ray.util.debug import log_once + +if TYPE_CHECKING: + from ray.rllib.algorithms.callbacks import DefaultCallbacks + from ray.rllib.evaluation.observation_function import ObservationFunction + from ray.rllib.evaluation.rollout_worker import RolloutWorker + +tf1, tf, _ = try_import_tf() +logger = logging.getLogger(__name__) + +_PolicyEvalData = namedtuple( + "_PolicyEvalData", + ["env_id", "agent_id", "obs", "info", "rnn_state", "prev_action", "prev_reward"], +) + +# A batch of RNN states with dimensions [state_index, batch, state_object]. +StateBatch = List[List[Any]] + + +class _NewEpisodeDefaultDict(defaultdict): + def __missing__(self, env_id): + if self.default_factory is None: + raise KeyError(env_id) + else: + ret = self[env_id] = self.default_factory(env_id) + return ret + + +@OldAPIStack +class SamplerInput(InputReader, metaclass=ABCMeta): + """Reads input experiences from an existing sampler.""" + + @override(InputReader) + def next(self) -> SampleBatchType: + batches = [self.get_data()] + batches.extend(self.get_extra_batches()) + if len(batches) == 0: + raise RuntimeError("No data available from sampler.") + return concat_samples(batches) + + @abstractmethod + def get_data(self) -> SampleBatchType: + """Called by `self.next()` to return the next batch of data. + + Override this in child classes. + + Returns: + The next batch of data. + """ + raise NotImplementedError + + @abstractmethod + def get_metrics(self) -> List[RolloutMetrics]: + """Returns list of episode metrics since the last call to this method. + + The list will contain one RolloutMetrics object per completed episode. + + Returns: + List of RolloutMetrics objects, one per completed episode since + the last call to this method. + """ + raise NotImplementedError + + @abstractmethod + def get_extra_batches(self) -> List[SampleBatchType]: + """Returns list of extra batches since the last call to this method. + + The list will contain all SampleBatches or + MultiAgentBatches that the user has provided thus-far. Users can + add these "extra batches" to an episode by calling the episode's + `add_extra_batch([SampleBatchType])` method. This can be done from + inside an overridden `Policy.compute_actions_from_input_dict(..., + episodes)` or from a custom callback's `on_episode_[start|step|end]()` + methods. + + Returns: + List of SamplesBatches or MultiAgentBatches provided thus-far by + the user since the last call to this method. + """ + raise NotImplementedError + + +@OldAPIStack +class SyncSampler(SamplerInput): + """Sync SamplerInput that collects experiences when `get_data()` is called.""" + + def __init__( + self, + *, + worker: "RolloutWorker", + env: BaseEnv, + clip_rewards: Union[bool, float], + rollout_fragment_length: int, + count_steps_by: str = "env_steps", + callbacks: "DefaultCallbacks", + multiple_episodes_in_batch: bool = False, + normalize_actions: bool = True, + clip_actions: bool = False, + observation_fn: Optional["ObservationFunction"] = None, + sample_collector_class: Optional[Type[SampleCollector]] = None, + render: bool = False, + # Obsolete. + policies=None, + policy_mapping_fn=None, + preprocessors=None, + obs_filters=None, + tf_sess=None, + horizon=DEPRECATED_VALUE, + soft_horizon=DEPRECATED_VALUE, + no_done_at_end=DEPRECATED_VALUE, + ): + """Initializes a SyncSampler instance. + + Args: + worker: The RolloutWorker that will use this Sampler for sampling. + env: Any Env object. Will be converted into an RLlib BaseEnv. + clip_rewards: True for +/-1.0 clipping, + actual float value for +/- value clipping. False for no + clipping. + rollout_fragment_length: The length of a fragment to collect + before building a SampleBatch from the data and resetting + the SampleBatchBuilder object. + count_steps_by: One of "env_steps" (default) or "agent_steps". + Use "agent_steps", if you want rollout lengths to be counted + by individual agent steps. In a multi-agent env, + a single env_step contains one or more agent_steps, depending + on how many agents are present at any given time in the + ongoing episode. + callbacks: The Callbacks object to use when episode + events happen during rollout. + multiple_episodes_in_batch: Whether to pack multiple + episodes into each batch. This guarantees batches will be + exactly `rollout_fragment_length` in size. + normalize_actions: Whether to normalize actions to the + action space's bounds. + clip_actions: Whether to clip actions according to the + given action_space's bounds. + observation_fn: Optional multi-agent observation func to use for + preprocessing observations. + sample_collector_class: An optional SampleCollector sub-class to + use to collect, store, and retrieve environment-, model-, + and sampler data. + render: Whether to try to render the environment after each step. + """ + # All of the following arguments are deprecated. They will instead be + # provided via the passed in `worker` arg, e.g. `worker.policy_map`. + if log_once("deprecated_sync_sampler_args"): + if policies is not None: + deprecation_warning(old="policies") + if policy_mapping_fn is not None: + deprecation_warning(old="policy_mapping_fn") + if preprocessors is not None: + deprecation_warning(old="preprocessors") + if obs_filters is not None: + deprecation_warning(old="obs_filters") + if tf_sess is not None: + deprecation_warning(old="tf_sess") + if horizon != DEPRECATED_VALUE: + deprecation_warning(old="horizon", error=True) + if soft_horizon != DEPRECATED_VALUE: + deprecation_warning(old="soft_horizon", error=True) + if no_done_at_end != DEPRECATED_VALUE: + deprecation_warning(old="no_done_at_end", error=True) + + self.base_env = convert_to_base_env(env) + self.rollout_fragment_length = rollout_fragment_length + self.extra_batches = queue.Queue() + self.perf_stats = _PerfStats( + ema_coef=worker.config.sampler_perf_stats_ema_coef, + ) + if not sample_collector_class: + sample_collector_class = SimpleListCollector + self.sample_collector = sample_collector_class( + worker.policy_map, + clip_rewards, + callbacks, + multiple_episodes_in_batch, + rollout_fragment_length, + count_steps_by=count_steps_by, + ) + self.render = render + + # Keep a reference to the underlying EnvRunnerV2 instance for + # unit testing purpose. + self._env_runner_obj = EnvRunnerV2( + worker=worker, + base_env=self.base_env, + multiple_episodes_in_batch=multiple_episodes_in_batch, + callbacks=callbacks, + perf_stats=self.perf_stats, + rollout_fragment_length=rollout_fragment_length, + count_steps_by=count_steps_by, + render=self.render, + ) + self._env_runner = self._env_runner_obj.run() + self.metrics_queue = queue.Queue() + + @override(SamplerInput) + def get_data(self) -> SampleBatchType: + while True: + item = next(self._env_runner) + if isinstance(item, RolloutMetrics): + self.metrics_queue.put(item) + else: + return item + + @override(SamplerInput) + def get_metrics(self) -> List[RolloutMetrics]: + completed = [] + while True: + try: + completed.append( + self.metrics_queue.get_nowait()._replace( + perf_stats=self.perf_stats.get() + ) + ) + except queue.Empty: + break + return completed + + @override(SamplerInput) + def get_extra_batches(self) -> List[SampleBatchType]: + extra = [] + while True: + try: + extra.append(self.extra_batches.get_nowait()) + except queue.Empty: + break + return extra diff --git a/vllm/lib/python3.10/site-packages/ray/tune/examples/bohb_example.py b/vllm/lib/python3.10/site-packages/ray/tune/examples/bohb_example.py new file mode 100644 index 0000000000000000000000000000000000000000..2bf409327b740deb1e789a242b31d2995827f5ca --- /dev/null +++ b/vllm/lib/python3.10/site-packages/ray/tune/examples/bohb_example.py @@ -0,0 +1,108 @@ +#!/usr/bin/env python + +"""This example demonstrates the usage of BOHB with Ray Tune. + +Requires the HpBandSter and ConfigSpace libraries to be installed +(`pip install hpbandster ConfigSpace`). +""" + +import json +import os +import time + +import numpy as np + +import ray +from ray import train, tune +from ray.tune import Trainable +from ray.tune.schedulers.hb_bohb import HyperBandForBOHB +from ray.tune.search.bohb import TuneBOHB + + +class MyTrainableClass(Trainable): + """Example agent whose learning curve is a random sigmoid. + + The dummy hyperparameters "width" and "height" determine the slope and + maximum reward value reached. + """ + + def setup(self, config): + self.timestep = 0 + + def step(self): + self.timestep += 1 + v = np.tanh(float(self.timestep) / self.config.get("width", 1)) + v *= self.config.get("height", 1) + time.sleep(0.1) + # Here we use `episode_reward_mean`, but you can also report other + # objectives such as loss or accuracy. + return {"episode_reward_mean": v} + + def save_checkpoint(self, checkpoint_dir): + path = os.path.join(checkpoint_dir, "checkpoint") + with open(path, "w") as f: + f.write(json.dumps({"timestep": self.timestep})) + + def load_checkpoint(self, checkpoint_dir): + path = os.path.join(checkpoint_dir, "checkpoint") + with open(path, "r") as f: + self.timestep = json.loads(f.read())["timestep"] + + +if __name__ == "__main__": + import sys + + if sys.version_info >= (3, 12): + # TuneBOHB is not compatible with Python 3.12 + sys.exit(0) + + ray.init(num_cpus=8) + + config = { + "iterations": 100, + "width": tune.uniform(0, 20), + "height": tune.uniform(-100, 100), + "activation": tune.choice(["relu", "tanh"]), + } + + # Optional: Pass the parameter space yourself + # import ConfigSpace as CS + # config_space = CS.ConfigurationSpace() + # config_space.add_hyperparameter( + # CS.UniformFloatHyperparameter("width", lower=0, upper=20)) + # config_space.add_hyperparameter( + # CS.UniformFloatHyperparameter("height", lower=-100, upper=100)) + # config_space.add_hyperparameter( + # CS.CategoricalHyperparameter( + # "activation", choices=["relu", "tanh"])) + + max_iterations = 10 + bohb_hyperband = HyperBandForBOHB( + time_attr="training_iteration", + max_t=max_iterations, + reduction_factor=2, + stop_last_trials=False, + ) + + bohb_search = TuneBOHB( + # space=config_space, # If you want to set the space manually + ) + bohb_search = tune.search.ConcurrencyLimiter(bohb_search, max_concurrent=4) + + tuner = tune.Tuner( + MyTrainableClass, + run_config=train.RunConfig( + name="bohb_test", stop={"training_iteration": max_iterations} + ), + tune_config=tune.TuneConfig( + metric="episode_reward_mean", + mode="max", + scheduler=bohb_hyperband, + search_alg=bohb_search, + num_samples=32, + ), + param_space=config, + ) + results = tuner.fit() + + print("Best hyperparameters found were: ", results.get_best_result().config) diff --git a/vllm/lib/python3.10/site-packages/ray/tune/examples/hyperopt_conditional_search_space_example.py b/vllm/lib/python3.10/site-packages/ray/tune/examples/hyperopt_conditional_search_space_example.py new file mode 100644 index 0000000000000000000000000000000000000000..741f9fe23be0ec67bcd730c69d233de1b8ad9d7b --- /dev/null +++ b/vllm/lib/python3.10/site-packages/ray/tune/examples/hyperopt_conditional_search_space_example.py @@ -0,0 +1,110 @@ +"""This example demonstrates the usage of conditional search spaces with Tune. + +It also checks that it is usable with a separate scheduler. + +Requires the HyperOpt library to be installed (`pip install hyperopt`). + +For an example of using a Tune search space, see +:doc:`/tune/examples/hyperopt_example`. +""" + +import time + +from hyperopt import hp + +import ray +from ray import train, tune +from ray.tune.schedulers import AsyncHyperBandScheduler +from ray.tune.search import ConcurrencyLimiter +from ray.tune.search.hyperopt import HyperOptSearch + + +def f_unpack_dict(dct): + """ + Unpacks all sub-dictionaries in given dictionary recursively. + There should be no duplicated keys across all nested + subdictionaries, or some instances will be lost without warning + + Source: https://www.kaggle.com/fanvacoolt/tutorial-on-hyperopt + + Parameters: + ---------------- + dct : dictionary to unpack + + Returns: + ---------------- + : unpacked dictionary + """ + + res = {} + for k, v in dct.items(): + if isinstance(v, dict): + res = {**res, **f_unpack_dict(v)} + else: + res[k] = v + + return res + + +def evaluation_fn(step, width, height, mult=1): + return (0.1 + width * step / 100) ** (-1) + height * 0.1 * mult + + +def easy_objective(config_in): + # Hyperparameters + config = f_unpack_dict(config_in) + width, height, mult = config["width"], config["height"], config.get("mult", 1) + print(config) + + for step in range(config["steps"]): + # Iterative training function - can be any arbitrary training procedure + intermediate_score = evaluation_fn(step, width, height, mult) + # Feed the score back back to Tune. + train.report({"iterations": step, "mean_loss": intermediate_score}) + time.sleep(0.1) + + +config_space = { + "activation": hp.choice( + "activation", + [ + {"activation": "relu", "mult": hp.uniform("mult", 1, 2)}, + {"activation": "tanh"}, + ], + ), + "width": hp.uniform("width", 0, 20), + "height": hp.uniform("heright", -100, 100), + "steps": 100, +} + + +def run_hyperopt_tune(config_dict=config_space, smoke_test=False): + algo = HyperOptSearch(space=config_dict, metric="mean_loss", mode="min") + algo = ConcurrencyLimiter(algo, max_concurrent=4) + scheduler = AsyncHyperBandScheduler() + tuner = tune.Tuner( + easy_objective, + tune_config=tune.TuneConfig( + metric="mean_loss", + mode="min", + search_alg=algo, + scheduler=scheduler, + num_samples=10 if smoke_test else 100, + ), + ) + results = tuner.fit() + print("Best hyperparameters found were: ", results.get_best_result().config) + + +if __name__ == "__main__": + import argparse + + parser = argparse.ArgumentParser() + parser.add_argument( + "--smoke-test", action="store_true", help="Finish quickly for testing" + ) + args, _ = parser.parse_known_args() + + ray.init(configure_logging=False) + + run_hyperopt_tune(smoke_test=args.smoke_test) diff --git a/vllm/lib/python3.10/site-packages/ray/tune/examples/mlflow_ptl.py b/vllm/lib/python3.10/site-packages/ray/tune/examples/mlflow_ptl.py new file mode 100644 index 0000000000000000000000000000000000000000..e1828661b98cd8e2013152c3f9aeeaf7cb51aa6d --- /dev/null +++ b/vllm/lib/python3.10/site-packages/ray/tune/examples/mlflow_ptl.py @@ -0,0 +1,105 @@ +"""An example showing how to use Pytorch Lightning training, Ray Tune +HPO, and MLflow autologging all together.""" + +import os +import tempfile + +import mlflow +import pytorch_lightning as pl + +from ray import train, tune +from ray.air.integrations.mlflow import setup_mlflow +from ray.tune.examples.mnist_ptl_mini import LightningMNISTClassifier, MNISTDataModule +from ray.tune.integration.pytorch_lightning import TuneReportCallback + + +def train_mnist_tune(config, data_dir=None, num_epochs=10, num_gpus=0): + setup_mlflow( + config, + experiment_name=config.get("experiment_name", None), + tracking_uri=config.get("tracking_uri", None), + ) + + model = LightningMNISTClassifier(config, data_dir) + dm = MNISTDataModule( + data_dir=data_dir, num_workers=1, batch_size=config["batch_size"] + ) + metrics = {"loss": "ptl/val_loss", "acc": "ptl/val_accuracy"} + mlflow.pytorch.autolog() + trainer = pl.Trainer( + max_epochs=num_epochs, + gpus=num_gpus, + progress_bar_refresh_rate=0, + callbacks=[TuneReportCallback(metrics, on="validation_end")], + ) + trainer.fit(model, dm) + + +def tune_mnist( + num_samples=10, + num_epochs=10, + gpus_per_trial=0, + tracking_uri=None, + experiment_name="ptl_autologging_example", +): + data_dir = os.path.join(tempfile.gettempdir(), "mnist_data_") + # Download data + MNISTDataModule(data_dir=data_dir, batch_size=32).prepare_data() + + # Set the MLflow experiment, or create it if it does not exist. + mlflow.set_tracking_uri(tracking_uri) + mlflow.set_experiment(experiment_name) + + config = { + "layer_1": tune.choice([32, 64, 128]), + "layer_2": tune.choice([64, 128, 256]), + "lr": tune.loguniform(1e-4, 1e-1), + "batch_size": tune.choice([32, 64, 128]), + "experiment_name": experiment_name, + "tracking_uri": mlflow.get_tracking_uri(), + "data_dir": os.path.join(tempfile.gettempdir(), "mnist_data_"), + "num_epochs": num_epochs, + } + + trainable = tune.with_parameters( + train_mnist_tune, + data_dir=data_dir, + num_epochs=num_epochs, + num_gpus=gpus_per_trial, + ) + + tuner = tune.Tuner( + tune.with_resources(trainable, resources={"cpu": 1, "gpu": gpus_per_trial}), + tune_config=tune.TuneConfig( + metric="loss", + mode="min", + num_samples=num_samples, + ), + run_config=train.RunConfig( + name="tune_mnist", + ), + param_space=config, + ) + results = tuner.fit() + + print("Best hyperparameters found were: ", results.get_best_result().config) + + +if __name__ == "__main__": + import argparse + + parser = argparse.ArgumentParser() + parser.add_argument( + "--smoke-test", action="store_true", help="Finish quickly for testing" + ) + args, _ = parser.parse_known_args() + + if args.smoke_test: + tune_mnist( + num_samples=1, + num_epochs=1, + gpus_per_trial=0, + tracking_uri=os.path.join(tempfile.gettempdir(), "mlruns"), + ) + else: + tune_mnist(num_samples=10, num_epochs=10, gpus_per_trial=0) diff --git a/vllm/lib/python3.10/site-packages/ray/tune/examples/nevergrad_example.py b/vllm/lib/python3.10/site-packages/ray/tune/examples/nevergrad_example.py new file mode 100644 index 0000000000000000000000000000000000000000..e579b781c857d1fd7ec3f0345a811d0b2c235989 --- /dev/null +++ b/vllm/lib/python3.10/site-packages/ray/tune/examples/nevergrad_example.py @@ -0,0 +1,77 @@ +"""This example demonstrates the usage of Nevergrad with Ray Tune. + +It also checks that it is usable with a separate scheduler. + +Requires the Nevergrad library to be installed (`pip install nevergrad`). +""" + +import time + +from ray import train, tune +from ray.tune.schedulers import AsyncHyperBandScheduler +from ray.tune.search import ConcurrencyLimiter +from ray.tune.search.nevergrad import NevergradSearch + + +def evaluation_fn(step, width, height): + return (0.1 + width * step / 100) ** (-1) + height * 0.1 + + +def easy_objective(config): + # Hyperparameters + width, height = config["width"], config["height"] + + for step in range(config["steps"]): + # Iterative training function - can be any arbitrary training procedure + intermediate_score = evaluation_fn(step, width, height) + # Feed the score back back to Tune. + train.report({"iterations": step, "mean_loss": intermediate_score}) + time.sleep(0.1) + + +if __name__ == "__main__": + import argparse + + import nevergrad as ng + + parser = argparse.ArgumentParser() + parser.add_argument( + "--smoke-test", action="store_true", help="Finish quickly for testing" + ) + args, _ = parser.parse_known_args() + + # Optional: Pass the parameter space yourself + # space = ng.p.Dict( + # width=ng.p.Scalar(lower=0, upper=20), + # height=ng.p.Scalar(lower=-100, upper=100), + # activation=ng.p.Choice(choices=["relu", "tanh"]) + # ) + + algo = NevergradSearch( + optimizer=ng.optimizers.OnePlusOne, + # space=space, # If you want to set the space manually + ) + algo = ConcurrencyLimiter(algo, max_concurrent=4) + + scheduler = AsyncHyperBandScheduler() + + tuner = tune.Tuner( + easy_objective, + tune_config=tune.TuneConfig( + metric="mean_loss", + mode="min", + search_alg=algo, + scheduler=scheduler, + num_samples=10 if args.smoke_test else 50, + ), + run_config=train.RunConfig(name="nevergrad"), + param_space={ + "steps": 100, + "width": tune.uniform(0, 20), + "height": tune.uniform(-100, 100), + "activation": tune.choice(["relu", "tanh"]), + }, + ) + results = tuner.fit() + + print("Best hyperparameters found were: ", results.get_best_result().config) diff --git a/vllm/lib/python3.10/site-packages/ray/tune/examples/optuna_define_by_run_example.py b/vllm/lib/python3.10/site-packages/ray/tune/examples/optuna_define_by_run_example.py new file mode 100644 index 0000000000000000000000000000000000000000..443fa3549ca15ba5c0f30f6fd3bd5bfe9729e3b5 --- /dev/null +++ b/vllm/lib/python3.10/site-packages/ray/tune/examples/optuna_define_by_run_example.py @@ -0,0 +1,93 @@ +"""This example demonstrates the usage of Optuna define-by-run with Ray Tune. + +It also checks that it is usable with a separate scheduler. + +Requires the Optuna library to be installed (`pip install optuna`). + +For an example of using a Tune search space, see +:doc:`/tune/examples/optuna_example`. +""" + +import time +from typing import Any, Dict, Optional + +import ray +from ray import train, tune +from ray.tune.schedulers import AsyncHyperBandScheduler +from ray.tune.search import ConcurrencyLimiter +from ray.tune.search.optuna import OptunaSearch + + +def evaluation_fn(step, width, height, mult=1): + return (0.1 + width * step / 100) ** (-1) + height * 0.1 * mult + + +def easy_objective(config): + # Hyperparameters + width, height, mult = config["width"], config["height"], config.get("mult", 1) + print(config) + + for step in range(config["steps"]): + # Iterative training function - can be any arbitrary training procedure + intermediate_score = evaluation_fn(step, width, height, mult) + # Feed the score back back to Tune. + train.report({"iterations": step, "mean_loss": intermediate_score}) + time.sleep(0.1) + + +def define_by_run_func(trial) -> Optional[Dict[str, Any]]: + """Define-by-run function to create the search space. + + Ensure no actual computation takes place here. That should go into + the trainable passed to ``Tuner`` (in this example, that's + ``easy_objective``). + + For more information, see https://optuna.readthedocs.io/en/stable\ +/tutorial/10_key_features/002_configurations.html + + This function should either return None or a dict with constant values. + """ + # This param is not used in the objective function. + activation = trial.suggest_categorical("activation", ["relu", "tanh"]) + trial.suggest_float("width", 0, 20) + trial.suggest_float("height", -100, 100) + + # Define-by-run allows for conditional search spaces. + if activation == "relu": + trial.suggest_float("mult", 1, 2) + + # Return all constants in a dictionary. + return {"steps": 100} + + +def run_optuna_tune(smoke_test=False): + algo = OptunaSearch(space=define_by_run_func, metric="mean_loss", mode="min") + algo = ConcurrencyLimiter(algo, max_concurrent=4) + scheduler = AsyncHyperBandScheduler() + tuner = tune.Tuner( + easy_objective, + tune_config=tune.TuneConfig( + metric="mean_loss", + mode="min", + search_alg=algo, + scheduler=scheduler, + num_samples=10 if smoke_test else 100, + ), + ) + results = tuner.fit() + + print("Best hyperparameters found were: ", results.get_best_result().config) + + +if __name__ == "__main__": + import argparse + + parser = argparse.ArgumentParser() + parser.add_argument( + "--smoke-test", action="store_true", help="Finish quickly for testing" + ) + args, _ = parser.parse_known_args() + + ray.init(configure_logging=False) + + run_optuna_tune(smoke_test=args.smoke_test) diff --git a/vllm/lib/python3.10/site-packages/ray/tune/examples/optuna_example.py b/vllm/lib/python3.10/site-packages/ray/tune/examples/optuna_example.py new file mode 100644 index 0000000000000000000000000000000000000000..17a7dfc7fe7209c4f615274a21e7214c49d5857d --- /dev/null +++ b/vllm/lib/python3.10/site-packages/ray/tune/examples/optuna_example.py @@ -0,0 +1,73 @@ +"""This example demonstrates the usage of Optuna with Ray Tune. + +It also checks that it is usable with a separate scheduler. + +Requires the Optuna library to be installed (`pip install optuna`). + +For an example of using an Optuna define-by-run function, see +:doc:`/tune/examples/optuna_define_by_run_example`. +""" + +import time + +import ray +from ray import train, tune +from ray.tune.schedulers import AsyncHyperBandScheduler +from ray.tune.search import ConcurrencyLimiter +from ray.tune.search.optuna import OptunaSearch + + +def evaluation_fn(step, width, height): + return (0.1 + width * step / 100) ** (-1) + height * 0.1 + + +def easy_objective(config): + # Hyperparameters + width, height = config["width"], config["height"] + + for step in range(config["steps"]): + # Iterative training function - can be any arbitrary training procedure + intermediate_score = evaluation_fn(step, width, height) + # Feed the score back back to Tune. + train.report({"iterations": step, "mean_loss": intermediate_score}) + time.sleep(0.1) + + +def run_optuna_tune(smoke_test=False): + algo = OptunaSearch() + algo = ConcurrencyLimiter(algo, max_concurrent=4) + scheduler = AsyncHyperBandScheduler() + tuner = tune.Tuner( + easy_objective, + tune_config=tune.TuneConfig( + metric="mean_loss", + mode="min", + search_alg=algo, + scheduler=scheduler, + num_samples=10 if smoke_test else 100, + ), + param_space={ + "steps": 100, + "width": tune.uniform(0, 20), + "height": tune.uniform(-100, 100), + # This is an ignored parameter. + "activation": tune.choice(["relu", "tanh"]), + }, + ) + results = tuner.fit() + + print("Best hyperparameters found were: ", results.get_best_result().config) + + +if __name__ == "__main__": + import argparse + + parser = argparse.ArgumentParser() + parser.add_argument( + "--smoke-test", action="store_true", help="Finish quickly for testing" + ) + args, _ = parser.parse_known_args() + + ray.init(configure_logging=False) + + run_optuna_tune(smoke_test=args.smoke_test) diff --git a/vllm/lib/python3.10/site-packages/ray/tune/examples/pb2_example.py b/vllm/lib/python3.10/site-packages/ray/tune/examples/pb2_example.py new file mode 100644 index 0000000000000000000000000000000000000000..ba1e94fb3d021d6c6114aab12ed37eb674df94ee --- /dev/null +++ b/vllm/lib/python3.10/site-packages/ray/tune/examples/pb2_example.py @@ -0,0 +1,62 @@ +#!/usr/bin/env python + +import argparse + +import ray +from ray import train, tune +from ray.tune.examples.pbt_function import pbt_function +from ray.tune.schedulers.pb2 import PB2 + +if __name__ == "__main__": + parser = argparse.ArgumentParser() + parser.add_argument( + "--smoke-test", action="store_true", help="Finish quickly for testing" + ) + args, _ = parser.parse_known_args() + + if args.smoke_test: + ray.init(num_cpus=2) # force pausing to happen for test + + perturbation_interval = 5 + pbt = PB2( + time_attr="training_iteration", + perturbation_interval=perturbation_interval, + hyperparam_bounds={ + # hyperparameter bounds. + "lr": [0.0001, 0.02], + }, + ) + + tuner = tune.Tuner( + pbt_function, + run_config=train.RunConfig( + name="pbt_test", + verbose=False, + stop={ + "training_iteration": 30, + }, + failure_config=train.FailureConfig( + fail_fast=True, + ), + ), + tune_config=tune.TuneConfig( + scheduler=pbt, + metric="mean_accuracy", + mode="max", + num_samples=8, + reuse_actors=True, + ), + param_space={ + "lr": 0.0001, + # note: this parameter is perturbed but has no effect on + # the model training in this example + "some_other_factor": 1, + # This parameter is not perturbed and is used to determine + # checkpoint frequency. We set checkpoints and perturbations + # to happen at the same frequency. + "checkpoint_interval": perturbation_interval, + }, + ) + results = tuner.fit() + + print("Best hyperparameters found were: ", results.get_best_result().config) diff --git a/vllm/lib/python3.10/site-packages/ray/tune/examples/pb2_ppo_example.py b/vllm/lib/python3.10/site-packages/ray/tune/examples/pb2_ppo_example.py new file mode 100644 index 0000000000000000000000000000000000000000..75d184beefdedf412bb48d48dd628164ac8518c1 --- /dev/null +++ b/vllm/lib/python3.10/site-packages/ray/tune/examples/pb2_ppo_example.py @@ -0,0 +1,157 @@ +import argparse +import os +import random +from datetime import datetime + +import pandas as pd + +from ray.tune import run, sample_from +from ray.tune.schedulers import PopulationBasedTraining +from ray.tune.schedulers.pb2 import PB2 + + +# Postprocess the perturbed config to ensure it's still valid used if PBT. +def explore(config): + # Ensure we collect enough timesteps to do sgd. + if config["train_batch_size"] < config["sgd_minibatch_size"] * 2: + config["train_batch_size"] = config["sgd_minibatch_size"] * 2 + # Ensure we run at least one sgd iter. + if config["lambda"] > 1: + config["lambda"] = 1 + config["train_batch_size"] = int(config["train_batch_size"]) + return config + + +if __name__ == "__main__": + parser = argparse.ArgumentParser() + parser.add_argument("--max", type=int, default=1000000) + parser.add_argument("--algo", type=str, default="PPO") + parser.add_argument("--num_workers", type=int, default=4) + parser.add_argument("--num_samples", type=int, default=4) + parser.add_argument("--t_ready", type=int, default=50000) + parser.add_argument("--seed", type=int, default=0) + parser.add_argument( + "--horizon", type=int, default=1600 + ) # make this 1000 for other envs + parser.add_argument("--perturb", type=float, default=0.25) # if using PBT + parser.add_argument("--env_name", type=str, default="BipedalWalker-v2") + parser.add_argument( + "--criteria", type=str, default="timesteps_total" + ) # "training_iteration", "time_total_s" + parser.add_argument( + "--net", type=str, default="32_32" + ) # May be important to use a larger network for bigger tasks. + parser.add_argument("--filename", type=str, default="") + parser.add_argument("--method", type=str, default="pb2") # ['pbt', 'pb2'] + parser.add_argument("--save_csv", type=bool, default=False) + + args = parser.parse_args() + + # bipedalwalker needs 1600 + if args.env_name in ["BipedalWalker-v2", "BipedalWalker-v3"]: + horizon = 1600 + else: + horizon = 1000 + + pbt = PopulationBasedTraining( + time_attr=args.criteria, + metric="episode_reward_mean", + mode="max", + perturbation_interval=args.t_ready, + resample_probability=args.perturb, + quantile_fraction=args.perturb, # copy bottom % with top % + # Specifies the search space for these hyperparams + hyperparam_mutations={ + "lambda": lambda: random.uniform(0.9, 1.0), + "clip_param": lambda: random.uniform(0.1, 0.5), + "lr": lambda: random.uniform(1e-3, 1e-5), + "train_batch_size": lambda: random.randint(1000, 60000), + }, + custom_explore_fn=explore, + ) + + pb2 = PB2( + time_attr=args.criteria, + metric="episode_reward_mean", + mode="max", + perturbation_interval=args.t_ready, + quantile_fraction=args.perturb, # copy bottom % with top % + # Specifies the hyperparam search space + hyperparam_bounds={ + "lambda": [0.9, 1.0], + "clip_param": [0.1, 0.5], + "lr": [1e-5, 1e-3], + "train_batch_size": [1000, 60000], + }, + ) + + methods = {"pbt": pbt, "pb2": pb2} + + timelog = ( + str(datetime.date(datetime.now())) + "_" + str(datetime.time(datetime.now())) + ) + + args.dir = "{}_{}_{}_Size{}_{}_{}".format( + args.algo, + args.filename, + args.method, + str(args.num_samples), + args.env_name, + args.criteria, + ) + + analysis = run( + args.algo, + name="{}_{}_{}_seed{}_{}".format( + timelog, args.method, args.env_name, str(args.seed), args.filename + ), + scheduler=methods[args.method], + verbose=1, + num_samples=args.num_samples, + reuse_actors=True, + stop={args.criteria: args.max}, + config={ + "env": args.env_name, + "log_level": "INFO", + "seed": args.seed, + "kl_coeff": 1.0, + "num_gpus": 0, + "horizon": horizon, + "observation_filter": "MeanStdFilter", + "model": { + "fcnet_hiddens": [ + int(args.net.split("_")[0]), + int(args.net.split("_")[1]), + ], + "free_log_std": True, + }, + "num_sgd_iter": 10, + "sgd_minibatch_size": 128, + "lambda": sample_from(lambda spec: random.uniform(0.9, 1.0)), + "clip_param": sample_from(lambda spec: random.uniform(0.1, 0.5)), + "lr": sample_from(lambda spec: random.uniform(1e-3, 1e-5)), + "train_batch_size": sample_from(lambda spec: random.randint(1000, 60000)), + }, + ) + + all_dfs = list(analysis.trial_dataframes.values()) + + results = pd.DataFrame() + for i in range(args.num_samples): + df = all_dfs[i] + df = df[ + [ + "timesteps_total", + "episodes_total", + "episode_reward_mean", + "info/learner/default_policy/cur_kl_coeff", + ] + ] + df["Agent"] = i + results = pd.concat([results, df]).reset_index(drop=True) + + if args.save_csv: + if not (os.path.exists("data/" + args.dir)): + os.makedirs("data/" + args.dir) + + results.to_csv("data/{}/seed{}.csv".format(args.dir, str(args.seed))) diff --git a/vllm/lib/python3.10/site-packages/ray/tune/examples/pbt_convnet_function_example.py b/vllm/lib/python3.10/site-packages/ray/tune/examples/pbt_convnet_function_example.py new file mode 100644 index 0000000000000000000000000000000000000000..b4ef69507ba6fb66d0c69833595f09922c001768 --- /dev/null +++ b/vllm/lib/python3.10/site-packages/ray/tune/examples/pbt_convnet_function_example.py @@ -0,0 +1,146 @@ +#!/usr/bin/env python + +# __tutorial_imports_begin__ +import argparse +import os + +import numpy as np +import torch +import torch.optim as optim + +import ray +from ray import train, tune +from ray.train import Checkpoint +from ray.tune.examples.mnist_pytorch import ConvNet, get_data_loaders, test_func +from ray.tune.schedulers import PopulationBasedTraining + +# __tutorial_imports_end__ + + +# __train_begin__ +def train_convnet(config): + # Create our data loaders, model, and optmizer. + step = 0 + train_loader, test_loader = get_data_loaders() + model = ConvNet() + optimizer = optim.SGD( + model.parameters(), + lr=config.get("lr", 0.01), + momentum=config.get("momentum", 0.9), + ) + + # If `get_checkpoint()` is not None, then we are resuming from a checkpoint. + # Load model state and iteration step from checkpoint. + if train.get_checkpoint(): + print("Loading from checkpoint.") + loaded_checkpoint = train.get_checkpoint() + with loaded_checkpoint.as_directory() as loaded_checkpoint_dir: + path = os.path.join(loaded_checkpoint_dir, "checkpoint.pt") + checkpoint = torch.load(path) + model.load_state_dict(checkpoint["model"]) + step = checkpoint["step"] + + while True: + ray.tune.examples.mnist_pytorch.train_func(model, optimizer, train_loader) + acc = test_func(model, test_loader) + checkpoint = None + if step % 5 == 0: + # Every 5 steps, checkpoint our current state. + # First get the checkpoint directory from tune. + # Need to create a directory under current working directory + # to construct checkpoint object from. + os.makedirs("my_model", exist_ok=True) + torch.save( + { + "step": step, + "model": model.state_dict(), + }, + "my_model/checkpoint.pt", + ) + checkpoint = Checkpoint.from_directory("my_model") + + step += 1 + train.report({"mean_accuracy": acc}, checkpoint=checkpoint) + + +# __train_end__ + + +def eval_best_model(results: tune.ResultGrid): + """Test the best model given output of tuner.fit().""" + with results.get_best_result().checkpoint.as_directory() as best_checkpoint_path: + best_model = ConvNet() + best_checkpoint = torch.load( + os.path.join(best_checkpoint_path, "checkpoint.pt") + ) + best_model.load_state_dict(best_checkpoint["model"]) + # Note that test only runs on a small random set of the test data, thus the + # accuracy may be different from metrics shown in tuning process. + test_acc = test_func(best_model, get_data_loaders()[1]) + print("best model accuracy: ", test_acc) + + +if __name__ == "__main__": + parser = argparse.ArgumentParser() + parser.add_argument( + "--smoke-test", action="store_true", help="Finish quickly for testing" + ) + args, _ = parser.parse_known_args() + + # __pbt_begin__ + scheduler = PopulationBasedTraining( + time_attr="training_iteration", + perturbation_interval=5, + hyperparam_mutations={ + # distribution for resampling + "lr": lambda: np.random.uniform(0.0001, 1), + # allow perturbations within this set of categorical values + "momentum": [0.8, 0.9, 0.99], + }, + ) + + # __pbt_end__ + + # __tune_begin__ + class CustomStopper(tune.Stopper): + def __init__(self): + self.should_stop = False + + def __call__(self, trial_id, result): + max_iter = 5 if args.smoke_test else 100 + if not self.should_stop and result["mean_accuracy"] > 0.96: + self.should_stop = True + return self.should_stop or result["training_iteration"] >= max_iter + + def stop_all(self): + return self.should_stop + + stopper = CustomStopper() + + tuner = tune.Tuner( + train_convnet, + run_config=train.RunConfig( + name="pbt_test", + stop=stopper, + verbose=1, + checkpoint_config=train.CheckpointConfig( + checkpoint_score_attribute="mean_accuracy", + num_to_keep=4, + ), + ), + tune_config=tune.TuneConfig( + scheduler=scheduler, + metric="mean_accuracy", + mode="max", + num_samples=4, + reuse_actors=True, + ), + param_space={ + "lr": tune.uniform(0.001, 1), + "momentum": tune.uniform(0.001, 1), + }, + ) + results = tuner.fit() + # __tune_end__ + + eval_best_model(results) diff --git a/vllm/lib/python3.10/site-packages/ray/tune/examples/pbt_dcgan_mnist/__init__.py b/vllm/lib/python3.10/site-packages/ray/tune/examples/pbt_dcgan_mnist/__init__.py new file mode 100644 index 0000000000000000000000000000000000000000..e69de29bb2d1d6434b8b29ae775ad8c2e48c5391 diff --git a/vllm/lib/python3.10/site-packages/ray/tune/examples/pbt_dcgan_mnist/__pycache__/__init__.cpython-310.pyc b/vllm/lib/python3.10/site-packages/ray/tune/examples/pbt_dcgan_mnist/__pycache__/__init__.cpython-310.pyc new file mode 100644 index 0000000000000000000000000000000000000000..70c9aad36d5d40db9ed6c390ac0958120ee45582 Binary files /dev/null and b/vllm/lib/python3.10/site-packages/ray/tune/examples/pbt_dcgan_mnist/__pycache__/__init__.cpython-310.pyc differ diff --git a/vllm/lib/python3.10/site-packages/ray/tune/examples/pbt_dcgan_mnist/__pycache__/pbt_dcgan_mnist_func.cpython-310.pyc b/vllm/lib/python3.10/site-packages/ray/tune/examples/pbt_dcgan_mnist/__pycache__/pbt_dcgan_mnist_func.cpython-310.pyc new file mode 100644 index 0000000000000000000000000000000000000000..1c0b9e9063385bd0f8b9c471cb26c1cc7ab6feac Binary files /dev/null and b/vllm/lib/python3.10/site-packages/ray/tune/examples/pbt_dcgan_mnist/__pycache__/pbt_dcgan_mnist_func.cpython-310.pyc differ diff --git a/vllm/lib/python3.10/site-packages/ray/tune/examples/pbt_dcgan_mnist/__pycache__/pbt_dcgan_mnist_trainable.cpython-310.pyc b/vllm/lib/python3.10/site-packages/ray/tune/examples/pbt_dcgan_mnist/__pycache__/pbt_dcgan_mnist_trainable.cpython-310.pyc new file mode 100644 index 0000000000000000000000000000000000000000..15ed830c402229818b240fe4793a08c335631572 Binary files /dev/null and b/vllm/lib/python3.10/site-packages/ray/tune/examples/pbt_dcgan_mnist/__pycache__/pbt_dcgan_mnist_trainable.cpython-310.pyc differ diff --git a/vllm/lib/python3.10/site-packages/ray/tune/examples/pbt_dcgan_mnist/common.py b/vllm/lib/python3.10/site-packages/ray/tune/examples/pbt_dcgan_mnist/common.py new file mode 100644 index 0000000000000000000000000000000000000000..3f76e9e17531f9cabdd6dd8a98cb08833a37d6a0 --- /dev/null +++ b/vllm/lib/python3.10/site-packages/ray/tune/examples/pbt_dcgan_mnist/common.py @@ -0,0 +1,285 @@ +import os + +import matplotlib.animation as animation +import matplotlib.pyplot as plt +import numpy as np +import torch +import torch.nn as nn +import torch.nn.parallel +import torch.utils.data +import torchvision.datasets as dset +import torchvision.transforms as transforms +import torchvision.utils as vutils +from scipy.stats import entropy +from torch.autograd import Variable +from torch.nn import functional as F + +import ray + +# Training parameters +workers = 2 +batch_size = 64 +image_size = 32 + +# Number of channels in the training images. For color images this is 3 +nc = 1 + +# Size of z latent vector (i.e. size of generator input) +nz = 100 + +# Size of feature maps in generator +ngf = 32 + +# Size of feature maps in discriminator +ndf = 32 + +# Beta1 hyperparam for Adam optimizers +beta1 = 0.5 + +# iterations of actual training in each Trainable _train +train_iterations_per_step = 5 + +MODEL_PATH = os.path.expanduser("~/.ray/models/mnist_cnn.pt") + + +def get_data_loader(data_dir="~/data"): + dataset = dset.MNIST( + root=data_dir, + download=True, + transform=transforms.Compose( + [ + transforms.Resize(image_size), + transforms.ToTensor(), + transforms.Normalize((0.5,), (0.5,)), + ] + ), + ) + + # Create the dataloader + dataloader = torch.utils.data.DataLoader( + dataset, batch_size=batch_size, shuffle=True, num_workers=workers + ) + + return dataloader + + +# __GANmodel_begin__ +# custom weights initialization called on netG and netD +def weights_init(m): + classname = m.__class__.__name__ + if classname.find("Conv") != -1: + nn.init.normal_(m.weight.data, 0.0, 0.02) + elif classname.find("BatchNorm") != -1: + nn.init.normal_(m.weight.data, 1.0, 0.02) + nn.init.constant_(m.bias.data, 0) + + +# Generator Code +class Generator(nn.Module): + def __init__(self): + super(Generator, self).__init__() + self.main = nn.Sequential( + # input is Z, going into a convolution + nn.ConvTranspose2d(nz, ngf * 4, 4, 1, 0, bias=False), + nn.BatchNorm2d(ngf * 4), + nn.ReLU(True), + nn.ConvTranspose2d(ngf * 4, ngf * 2, 4, 2, 1, bias=False), + nn.BatchNorm2d(ngf * 2), + nn.ReLU(True), + nn.ConvTranspose2d(ngf * 2, ngf, 4, 2, 1, bias=False), + nn.BatchNorm2d(ngf), + nn.ReLU(True), + nn.ConvTranspose2d(ngf, nc, 4, 2, 1, bias=False), + nn.Tanh(), + ) + + def forward(self, input): + return self.main(input) + + +class Discriminator(nn.Module): + def __init__(self): + super(Discriminator, self).__init__() + self.main = nn.Sequential( + nn.Conv2d(nc, ndf, 4, 2, 1, bias=False), + nn.LeakyReLU(0.2, inplace=True), + nn.Conv2d(ndf, ndf * 2, 4, 2, 1, bias=False), + nn.BatchNorm2d(ndf * 2), + nn.LeakyReLU(0.2, inplace=True), + nn.Conv2d(ndf * 2, ndf * 4, 4, 2, 1, bias=False), + nn.BatchNorm2d(ndf * 4), + nn.LeakyReLU(0.2, inplace=True), + nn.Conv2d(ndf * 4, 1, 4, 1, 0, bias=False), + nn.Sigmoid(), + ) + + def forward(self, input): + return self.main(input) + + +# __GANmodel_end__ + + +# __INCEPTION_SCORE_begin__ +class Net(nn.Module): + """ + LeNet for MNist classification, used for inception_score + """ + + def __init__(self): + super(Net, self).__init__() + self.conv1 = nn.Conv2d(1, 10, kernel_size=5) + self.conv2 = nn.Conv2d(10, 20, kernel_size=5) + self.conv2_drop = nn.Dropout2d() + self.fc1 = nn.Linear(320, 50) + self.fc2 = nn.Linear(50, 10) + + def forward(self, x): + x = F.relu(F.max_pool2d(self.conv1(x), 2)) + x = F.relu(F.max_pool2d(self.conv2_drop(self.conv2(x)), 2)) + x = x.view(-1, 320) + x = F.relu(self.fc1(x)) + x = F.dropout(x, training=self.training) + x = self.fc2(x) + return F.log_softmax(x, dim=1) + + +def inception_score(imgs, mnist_model_ref, batch_size=32, splits=1): + N = len(imgs) + dtype = torch.FloatTensor + dataloader = torch.utils.data.DataLoader(imgs, batch_size=batch_size) + cm = ray.get(mnist_model_ref) # Get the mnist model from Ray object store. + up = nn.Upsample(size=(28, 28), mode="bilinear").type(dtype) + + def get_pred(x): + x = up(x) + x = cm(x) + return F.softmax(x).data.cpu().numpy() + + preds = np.zeros((N, 10)) + for i, batch in enumerate(dataloader, 0): + batch = batch.type(dtype) + batchv = Variable(batch) + batch_size_i = batch.size()[0] + preds[i * batch_size : i * batch_size + batch_size_i] = get_pred(batchv) + + # Now compute the mean kl-div + split_scores = [] + for k in range(splits): + part = preds[k * (N // splits) : (k + 1) * (N // splits), :] + py = np.mean(part, axis=0) + scores = [] + for i in range(part.shape[0]): + pyx = part[i, :] + scores.append(entropy(pyx, py)) + split_scores.append(np.exp(np.mean(scores))) + + return np.mean(split_scores), np.std(split_scores) + + +# __INCEPTION_SCORE_end__ + + +def train_func( + netD, + netG, + optimG, + optimD, + criterion, + dataloader, + iteration, + device, + mnist_model_ref, +): + real_label = 1 + fake_label = 0 + + for i, data in enumerate(dataloader, 0): + if i >= train_iterations_per_step: + break + + netD.zero_grad() + real_cpu = data[0].to(device) + b_size = real_cpu.size(0) + label = torch.full((b_size,), real_label, dtype=torch.float, device=device) + output = netD(real_cpu).view(-1) + errD_real = criterion(output, label) + errD_real.backward() + D_x = output.mean().item() + + noise = torch.randn(b_size, nz, 1, 1, device=device) + fake = netG(noise) + label.fill_(fake_label) + output = netD(fake.detach()).view(-1) + errD_fake = criterion(output, label) + errD_fake.backward() + D_G_z1 = output.mean().item() + errD = errD_real + errD_fake + optimD.step() + + netG.zero_grad() + label.fill_(real_label) + output = netD(fake).view(-1) + errG = criterion(output, label) + errG.backward() + D_G_z2 = output.mean().item() + optimG.step() + + is_score, is_std = inception_score(fake, mnist_model_ref) + + # Output training stats + if iteration % 10 == 0: + print( + "[%d/%d]\tLoss_D: %.4f\tLoss_G: %.4f\tD(x): %.4f\tD(G(z))" + ": %.4f / %.4f \tInception score: %.4f" + % ( + iteration, + len(dataloader), + errD.item(), + errG.item(), + D_x, + D_G_z1, + D_G_z2, + is_score, + ) + ) + + return errG.item(), errD.item(), is_score + + +def plot_images(dataloader): + # Plot some training images + real_batch = next(iter(dataloader)) + plt.figure(figsize=(8, 8)) + plt.axis("off") + plt.title("Original Images") + plt.imshow( + np.transpose( + vutils.make_grid(real_batch[0][:64], padding=2, normalize=True).cpu(), + (1, 2, 0), + ) + ) + + plt.show() + + +def demo_gan(checkpoint_paths): + img_list = [] + fixed_noise = torch.randn(64, nz, 1, 1) + for path in checkpoint_paths: + checkpoint_dict = torch.load(os.path.join(path, "checkpoint.pt")) + + loadedG = Generator() + loadedG.load_state_dict(checkpoint_dict["netGmodel"]) + with torch.no_grad(): + fake = loadedG(fixed_noise).detach().cpu() + img_list.append(vutils.make_grid(fake, padding=2, normalize=True)) + + fig = plt.figure(figsize=(8, 8)) + plt.axis("off") + ims = [[plt.imshow(np.transpose(i, (1, 2, 0)), animated=True)] for i in img_list] + ani = animation.ArtistAnimation( + fig, ims, interval=1000, repeat_delay=1000, blit=True + ) + ani.save("./generated.gif", writer="imagemagick", dpi=72) + plt.show() diff --git a/vllm/lib/python3.10/site-packages/ray/tune/examples/pbt_dcgan_mnist/pbt_dcgan_mnist_func.py b/vllm/lib/python3.10/site-packages/ray/tune/examples/pbt_dcgan_mnist/pbt_dcgan_mnist_func.py new file mode 100644 index 0000000000000000000000000000000000000000..acb1edae2a85a420fe6a757853a7cae1df818d86 --- /dev/null +++ b/vllm/lib/python3.10/site-packages/ray/tune/examples/pbt_dcgan_mnist/pbt_dcgan_mnist_func.py @@ -0,0 +1,191 @@ +#!/usr/bin/env python +""" +Example of training DCGAN on MNIST using PBT with Tune's function API. +""" +import argparse +import os +import tempfile + +import numpy as np +import torch +import torch.nn as nn +import torch.nn.parallel +import torch.optim as optim +import torch.utils.data +from filelock import FileLock + +import ray +from ray import train, tune +from ray.train import Checkpoint +from ray.tune.examples.pbt_dcgan_mnist.common import ( + MODEL_PATH, + Discriminator, + Generator, + Net, + beta1, + demo_gan, + get_data_loader, + plot_images, + train_func, + weights_init, +) +from ray.tune.schedulers import PopulationBasedTraining + + +# __Train_begin__ +def dcgan_train(config): + use_cuda = config.get("use_gpu") and torch.cuda.is_available() + device = torch.device("cuda" if use_cuda else "cpu") + netD = Discriminator().to(device) + netD.apply(weights_init) + netG = Generator().to(device) + netG.apply(weights_init) + criterion = nn.BCELoss() + optimizerD = optim.Adam( + netD.parameters(), lr=config.get("lr", 0.01), betas=(beta1, 0.999) + ) + optimizerG = optim.Adam( + netG.parameters(), lr=config.get("lr", 0.01), betas=(beta1, 0.999) + ) + with FileLock(os.path.expanduser("~/ray_results/.data.lock")): + dataloader = get_data_loader() + + step = 1 + checkpoint = train.get_checkpoint() + if checkpoint: + with checkpoint.as_directory() as checkpoint_dir: + checkpoint_dict = torch.load(os.path.join(checkpoint_dir, "checkpoint.pt")) + netD.load_state_dict(checkpoint_dict["netDmodel"]) + netG.load_state_dict(checkpoint_dict["netGmodel"]) + optimizerD.load_state_dict(checkpoint_dict["optimD"]) + optimizerG.load_state_dict(checkpoint_dict["optimG"]) + # Note: Make sure to increment the loaded step by 1 to get the + # current step. + last_step = checkpoint_dict["step"] + step = last_step + 1 + + # NOTE: It's important to set the optimizer learning rates + # again, since we want to explore the parameters passed in by PBT. + # Without this, we would continue using the exact same + # configuration as the trial whose checkpoint we are exploiting. + if "netD_lr" in config: + for param_group in optimizerD.param_groups: + param_group["lr"] = config["netD_lr"] + if "netG_lr" in config: + for param_group in optimizerG.param_groups: + param_group["lr"] = config["netG_lr"] + + while True: + lossG, lossD, is_score = train_func( + netD, + netG, + optimizerG, + optimizerD, + criterion, + dataloader, + step, + device, + config["mnist_model_ref"], + ) + metrics = {"lossg": lossG, "lossd": lossD, "is_score": is_score} + + if step % config["checkpoint_interval"] == 0: + with tempfile.TemporaryDirectory() as tmpdir: + torch.save( + { + "netDmodel": netD.state_dict(), + "netGmodel": netG.state_dict(), + "optimD": optimizerD.state_dict(), + "optimG": optimizerG.state_dict(), + "step": step, + }, + os.path.join(tmpdir, "checkpoint.pt"), + ) + train.report(metrics, checkpoint=Checkpoint.from_directory(tmpdir)) + else: + train.report(metrics) + + step += 1 + + +# __Train_end__ + + +def download_mnist_cnn(): + import urllib.request + + # Download a pre-trained MNIST model for inception score calculation. + # This is a tiny model (<100kb). + if not os.path.exists(MODEL_PATH): + print("downloading model") + os.makedirs(os.path.dirname(MODEL_PATH), exist_ok=True) + urllib.request.urlretrieve( + "https://github.com/ray-project/ray/raw/master/python/ray/tune/" + "examples/pbt_dcgan_mnist/mnist_cnn.pt", + MODEL_PATH, + ) + return MODEL_PATH + + +if __name__ == "__main__": + parser = argparse.ArgumentParser() + parser.add_argument( + "--smoke-test", action="store_true", help="Finish quickly for testing" + ) + parser.add_argument( + "--data-dir", type=str, default="~/data/", help="Set the path of the dataset." + ) + args, _ = parser.parse_known_args() + ray.init() + + download_mnist_cnn() + + dataloader = get_data_loader(args.data_dir) + if not args.smoke_test: + plot_images(dataloader) + + # __tune_begin__ + + # load the pretrained mnist classification model for inception_score + mnist_cnn = Net() + mnist_cnn.load_state_dict(torch.load(MODEL_PATH)) + mnist_cnn.eval() + # Put the model in Ray object store. + mnist_model_ref = ray.put(mnist_cnn) + + scheduler = PopulationBasedTraining( + perturbation_interval=5, + hyperparam_mutations={ + # distribution for resampling + "netG_lr": lambda: np.random.uniform(1e-2, 1e-5), + "netD_lr": lambda: np.random.uniform(1e-2, 1e-5), + }, + ) + + tune_iter = 5 if args.smoke_test else 300 + tuner = tune.Tuner( + dcgan_train, + run_config=train.RunConfig( + name="pbt_dcgan_mnist", + stop={"training_iteration": tune_iter}, + verbose=1, + ), + tune_config=tune.TuneConfig( + metric="is_score", + mode="max", + num_samples=8, + scheduler=scheduler, + ), + param_space={ + "netG_lr": tune.choice([0.0001, 0.0002, 0.0005]), + "netD_lr": tune.choice([0.0001, 0.0002, 0.0005]), + "mnist_model_ref": mnist_model_ref, + }, + ) + results = tuner.fit() + # __tune_end__ + + # demo of the trained Generators + if not args.smoke_test: + checkpoint_paths = [result.checkpoint.to_directory() for result in results] + demo_gan(checkpoint_paths) diff --git a/vllm/lib/python3.10/site-packages/ray/tune/examples/pbt_dcgan_mnist/pbt_dcgan_mnist_trainable.py b/vllm/lib/python3.10/site-packages/ray/tune/examples/pbt_dcgan_mnist/pbt_dcgan_mnist_trainable.py new file mode 100644 index 0000000000000000000000000000000000000000..6c6678fbbff7b92fb530127c68f9c2dedfe79a20 --- /dev/null +++ b/vllm/lib/python3.10/site-packages/ray/tune/examples/pbt_dcgan_mnist/pbt_dcgan_mnist_trainable.py @@ -0,0 +1,185 @@ +#!/usr/bin/env python +""" +Example of training DCGAN on MNIST using PBT with Tune's Trainable Class +API. +""" +import argparse +import os +import random + +import numpy as np +import torch +import torch.nn as nn +import torch.nn.parallel +import torch.optim as optim +import torch.utils.data +from filelock import FileLock + +import ray +from ray import train, tune +from ray.tune.examples.pbt_dcgan_mnist.common import ( + MODEL_PATH, + Discriminator, + Generator, + Net, + beta1, + demo_gan, + get_data_loader, + plot_images, + train_func, + weights_init, +) +from ray.tune.schedulers import PopulationBasedTraining + + +# __Trainable_begin__ +class PytorchTrainable(tune.Trainable): + def setup(self, config): + use_cuda = config.get("use_gpu") and torch.cuda.is_available() + self.device = torch.device("cuda" if use_cuda else "cpu") + self.netD = Discriminator().to(self.device) + self.netD.apply(weights_init) + self.netG = Generator().to(self.device) + self.netG.apply(weights_init) + self.criterion = nn.BCELoss() + self.optimizerD = optim.Adam( + self.netD.parameters(), lr=config.get("lr", 0.01), betas=(beta1, 0.999) + ) + self.optimizerG = optim.Adam( + self.netG.parameters(), lr=config.get("lr", 0.01), betas=(beta1, 0.999) + ) + with FileLock(os.path.expanduser("~/.data.lock")): + self.dataloader = get_data_loader(config.get("data_dir", "~/data")) + self.mnist_model_ref = config["mnist_model_ref"] + + def step(self): + lossG, lossD, is_score = train_func( + self.netD, + self.netG, + self.optimizerG, + self.optimizerD, + self.criterion, + self.dataloader, + self._iteration, + self.device, + self.mnist_model_ref, + ) + return {"lossg": lossG, "lossd": lossD, "is_score": is_score} + + def save_checkpoint(self, checkpoint_dir): + path = os.path.join(checkpoint_dir, "checkpoint.pt") + torch.save( + { + "netDmodel": self.netD.state_dict(), + "netGmodel": self.netG.state_dict(), + "optimD": self.optimizerD.state_dict(), + "optimG": self.optimizerG.state_dict(), + }, + path, + ) + + return checkpoint_dir + + def load_checkpoint(self, checkpoint_dir): + path = os.path.join(checkpoint_dir, "checkpoint.pt") + checkpoint = torch.load(path) + self.netD.load_state_dict(checkpoint["netDmodel"]) + self.netG.load_state_dict(checkpoint["netGmodel"]) + self.optimizerD.load_state_dict(checkpoint["optimD"]) + self.optimizerG.load_state_dict(checkpoint["optimG"]) + + def reset_config(self, new_config): + if "netD_lr" in new_config: + for param_group in self.optimizerD.param_groups: + param_group["lr"] = new_config["netD_lr"] + if "netG_lr" in new_config: + for param_group in self.optimizerG.param_groups: + param_group["lr"] = new_config["netG_lr"] + + self.config = new_config + return True + + +# __Trainable_end__ + +if __name__ == "__main__": + parser = argparse.ArgumentParser() + parser.add_argument( + "--smoke-test", action="store_true", help="Finish quickly for testing" + ) + parser.add_argument( + "--data-dir", type=str, default="~/data/", help="Set the path of the dataset." + ) + args, _ = parser.parse_known_args() + ray.init() + + import urllib.request + + # Download a pre-trained MNIST model for inception score calculation. + # This is a tiny model (<100kb). + if not os.path.exists(MODEL_PATH): + print("downloading model") + os.makedirs(os.path.dirname(MODEL_PATH), exist_ok=True) + urllib.request.urlretrieve( + "https://github.com/ray-project/ray/raw/master/python/ray/tune/" + "examples/pbt_dcgan_mnist/mnist_cnn.pt", + MODEL_PATH, + ) + + dataloader = get_data_loader() + if not args.smoke_test: + plot_images(dataloader) + + # load the pretrained mnist classification model for inception_score + mnist_cnn = Net() + mnist_cnn.load_state_dict(torch.load(MODEL_PATH)) + mnist_cnn.eval() + mnist_model_ref = ray.put(mnist_cnn) + + # __tune_begin__ + scheduler = PopulationBasedTraining( + time_attr="training_iteration", + perturbation_interval=5, + hyperparam_mutations={ + # distribution for resampling + "netG_lr": lambda: np.random.uniform(1e-2, 1e-5), + "netD_lr": lambda: np.random.uniform(1e-2, 1e-5), + }, + ) + + tune_iter = 10 if args.smoke_test else 300 + tuner = tune.Tuner( + PytorchTrainable, + run_config=train.RunConfig( + name="pbt_dcgan_mnist", + stop={"training_iteration": tune_iter}, + verbose=1, + checkpoint_config=train.CheckpointConfig(checkpoint_at_end=True), + ), + tune_config=tune.TuneConfig( + metric="is_score", + mode="max", + num_samples=8, + scheduler=scheduler, + reuse_actors=True, + ), + param_space={ + "netG_lr": tune.sample_from( + lambda spec: random.choice([0.0001, 0.0002, 0.0005]) + ), + "netD_lr": tune.sample_from( + lambda spec: random.choice([0.0001, 0.0002, 0.0005]) + ), + "mnist_model_ref": mnist_model_ref, + "data_dir": args.data_dir, + }, + ) + results = tuner.fit() + + # export_formats=[ExportFormat.MODEL] + # __tune_end__ + + # demo of the trained Generators + if not args.smoke_test: + checkpoint_paths = [result.checkpoint.to_directory() for result in results] + demo_gan(checkpoint_paths) diff --git a/vllm/lib/python3.10/site-packages/ray/tune/examples/pbt_transformers/__init__.py b/vllm/lib/python3.10/site-packages/ray/tune/examples/pbt_transformers/__init__.py new file mode 100644 index 0000000000000000000000000000000000000000..e69de29bb2d1d6434b8b29ae775ad8c2e48c5391 diff --git a/vllm/lib/python3.10/site-packages/ray/tune/examples/pbt_transformers/pbt_transformers.py b/vllm/lib/python3.10/site-packages/ray/tune/examples/pbt_transformers/pbt_transformers.py new file mode 100644 index 0000000000000000000000000000000000000000..eb8a9d9a1b79ac47b6acdc0ff4b6ac3a9b755ca5 --- /dev/null +++ b/vllm/lib/python3.10/site-packages/ray/tune/examples/pbt_transformers/pbt_transformers.py @@ -0,0 +1,166 @@ +""" +This example is uses the official +huggingface transformers `hyperparameter_search` API. +""" + +import os + +from transformers import ( + AutoConfig, + AutoModelForSequenceClassification, + AutoTokenizer, + GlueDataset, + GlueDataTrainingArguments, + Trainer, + TrainingArguments, + glue_tasks_num_labels, +) + +from ray import tune +from ray.train import CheckpointConfig +from ray.tune import CLIReporter +from ray.tune.examples.pbt_transformers.utils import ( + build_compute_metrics_fn, + download_data, +) +from ray.tune.schedulers import PopulationBasedTraining + + +def tune_transformer(num_samples=8, gpus_per_trial=0, smoke_test=False): + data_dir_name = "./data" if not smoke_test else "./test_data" + data_dir = os.path.abspath(os.path.join(os.getcwd(), data_dir_name)) + if not os.path.exists(data_dir): + os.mkdir(data_dir, 0o755) + + # Change these as needed. + model_name = ( + "bert-base-uncased" if not smoke_test else "sshleifer/tiny-distilroberta-base" + ) + task_name = "rte" + + task_data_dir = os.path.join(data_dir, task_name.upper()) + + num_labels = glue_tasks_num_labels[task_name] + + config = AutoConfig.from_pretrained( + model_name, num_labels=num_labels, finetuning_task=task_name + ) + + # Download and cache tokenizer, model, and features + print("Downloading and caching Tokenizer") + tokenizer = AutoTokenizer.from_pretrained(model_name) + + # Triggers tokenizer download to cache + print("Downloading and caching pre-trained model") + AutoModelForSequenceClassification.from_pretrained( + model_name, + config=config, + ) + + def get_model(): + return AutoModelForSequenceClassification.from_pretrained( + model_name, + config=config, + ) + + # Download data. + download_data(task_name, data_dir) + + data_args = GlueDataTrainingArguments(task_name=task_name, data_dir=task_data_dir) + + train_dataset = GlueDataset( + data_args, tokenizer=tokenizer, mode="train", cache_dir=task_data_dir + ) + eval_dataset = GlueDataset( + data_args, tokenizer=tokenizer, mode="dev", cache_dir=task_data_dir + ) + + training_args = TrainingArguments( + output_dir=".", + learning_rate=1e-5, # config + do_train=True, + do_eval=True, + no_cuda=gpus_per_trial <= 0, + evaluation_strategy="epoch", + save_strategy="epoch", + load_best_model_at_end=True, + num_train_epochs=2, # config + max_steps=-1, + per_device_train_batch_size=16, # config + per_device_eval_batch_size=16, # config + warmup_steps=0, + weight_decay=0.1, # config + logging_dir="./logs", + skip_memory_metrics=True, + report_to="none", + ) + + trainer = Trainer( + model_init=get_model, + args=training_args, + train_dataset=train_dataset, + eval_dataset=eval_dataset, + compute_metrics=build_compute_metrics_fn(task_name), + ) + + tune_config = { + "per_device_train_batch_size": 32, + "per_device_eval_batch_size": 32, + "num_train_epochs": tune.choice([2, 3, 4, 5]), + "max_steps": 1 if smoke_test else -1, # Used for smoke test. + } + + scheduler = PopulationBasedTraining( + time_attr="training_iteration", + metric="eval_acc", + mode="max", + perturbation_interval=1, + hyperparam_mutations={ + "weight_decay": tune.uniform(0.0, 0.3), + "learning_rate": tune.uniform(1e-5, 5e-5), + "per_device_train_batch_size": [16, 32, 64], + }, + ) + + reporter = CLIReporter( + parameter_columns={ + "weight_decay": "w_decay", + "learning_rate": "lr", + "per_device_train_batch_size": "train_bs/gpu", + "num_train_epochs": "num_epochs", + }, + metric_columns=["eval_acc", "eval_loss", "epoch", "training_iteration"], + ) + + trainer.hyperparameter_search( + hp_space=lambda _: tune_config, + backend="ray", + n_trials=num_samples, + resources_per_trial={"cpu": 1, "gpu": gpus_per_trial}, + scheduler=scheduler, + checkpoint_config=CheckpointConfig( + num_to_keep=1, + checkpoint_score_attribute="training_iteration", + ), + stop={"training_iteration": 1} if smoke_test else None, + progress_reporter=reporter, + local_dir="~/ray_results/", + name="tune_transformer_pbt", + log_to_file=True, + ) + + +if __name__ == "__main__": + import argparse + + parser = argparse.ArgumentParser() + parser.add_argument( + "--smoke-test", action="store_true", help="Finish quickly for testing" + ) + args, _ = parser.parse_known_args() + + if args.smoke_test: + tune_transformer(num_samples=1, gpus_per_trial=0, smoke_test=True) + else: + # You can change the number of GPUs here: + tune_transformer(num_samples=8, gpus_per_trial=1) diff --git a/vllm/lib/python3.10/site-packages/ray/tune/examples/pbt_transformers/utils.py b/vllm/lib/python3.10/site-packages/ray/tune/examples/pbt_transformers/utils.py new file mode 100644 index 0000000000000000000000000000000000000000..ff304664b98b2fe7835d18a5f7dc33a4a6563fd8 --- /dev/null +++ b/vllm/lib/python3.10/site-packages/ray/tune/examples/pbt_transformers/utils.py @@ -0,0 +1,46 @@ +"""Utilities to load and cache data.""" + +import os +from typing import Callable, Dict + +import numpy as np +from transformers import EvalPrediction, glue_compute_metrics, glue_output_modes + + +def build_compute_metrics_fn(task_name: str) -> Callable[[EvalPrediction], Dict]: + """Function from transformers/examples/text-classification/run_glue.py""" + output_mode = glue_output_modes[task_name] + + def compute_metrics_fn(p: EvalPrediction): + if output_mode == "classification": + preds = np.argmax(p.predictions, axis=1) + elif output_mode == "regression": + preds = np.squeeze(p.predictions) + metrics = glue_compute_metrics(task_name, preds, p.label_ids) + return metrics + + return compute_metrics_fn + + +def download_data(task_name, data_dir="./data"): + # Download RTE training data + print("Downloading dataset.") + import urllib + import zipfile + + if task_name == "rte": + url = "https://dl.fbaipublicfiles.com/glue/data/RTE.zip" + else: + raise ValueError("Unknown task: {}".format(task_name)) + data_file = os.path.join(data_dir, "{}.zip".format(task_name)) + if not os.path.exists(data_file): + urllib.request.urlretrieve(url, data_file) + with zipfile.ZipFile(data_file) as zip_ref: + zip_ref.extractall(data_dir) + print("Downloaded data for task {} to {}".format(task_name, data_dir)) + else: + print( + "Data already exists. Using downloaded data for task {} from {}".format( + task_name, data_dir + ) + ) diff --git a/vllm/lib/python3.10/site-packages/ray/tune/examples/pbt_tune_cifar10_with_keras.py b/vllm/lib/python3.10/site-packages/ray/tune/examples/pbt_tune_cifar10_with_keras.py new file mode 100644 index 0000000000000000000000000000000000000000..4b89d8fc563d4f866bf4655fd3097df22c7342aa --- /dev/null +++ b/vllm/lib/python3.10/site-packages/ray/tune/examples/pbt_tune_cifar10_with_keras.py @@ -0,0 +1,243 @@ +#!/usr/bin/env python +# -*- coding: utf-8 -*- +"""Train keras CNN on the CIFAR10 small images dataset. + +The model comes from: https://zhuanlan.zhihu.com/p/29214791, +and it gets to about 87% validation accuracy in 100 epochs. + +Note that the script requires a machine with 4 GPUs. You +can set {"gpu": 0} to use CPUs for training, although +it is less efficient. +""" + +from __future__ import print_function + +import argparse + +import numpy as np +import tensorflow as tf +from tensorflow.keras.datasets import cifar10 +from tensorflow.keras.layers import ( + Convolution2D, + Dense, + Dropout, + Flatten, + Input, + MaxPooling2D, +) +from tensorflow.keras.models import Model, load_model +from tensorflow.keras.preprocessing.image import ImageDataGenerator + +from ray import train, tune +from ray.tune import Trainable +from ray.tune.schedulers import PopulationBasedTraining + +num_classes = 10 +NUM_SAMPLES = 128 + + +class Cifar10Model(Trainable): + def _read_data(self): + # The data, split between train and test sets: + (x_train, y_train), (x_test, y_test) = cifar10.load_data() + + # Convert class vectors to binary class matrices. + y_train = tf.keras.utils.to_categorical(y_train, num_classes) + y_test = tf.keras.utils.to_categorical(y_test, num_classes) + + x_train = x_train.astype("float32") + x_train /= 255 + x_test = x_test.astype("float32") + x_test /= 255 + + return (x_train, y_train), (x_test, y_test) + + def _build_model(self, input_shape): + x = Input(shape=(32, 32, 3)) + y = x + y = Convolution2D( + filters=64, + kernel_size=3, + strides=1, + padding="same", + activation="relu", + kernel_initializer="he_normal", + )(y) + y = Convolution2D( + filters=64, + kernel_size=3, + strides=1, + padding="same", + activation="relu", + kernel_initializer="he_normal", + )(y) + y = MaxPooling2D(pool_size=2, strides=2, padding="same")(y) + + y = Convolution2D( + filters=128, + kernel_size=3, + strides=1, + padding="same", + activation="relu", + kernel_initializer="he_normal", + )(y) + y = Convolution2D( + filters=128, + kernel_size=3, + strides=1, + padding="same", + activation="relu", + kernel_initializer="he_normal", + )(y) + y = MaxPooling2D(pool_size=2, strides=2, padding="same")(y) + + y = Convolution2D( + filters=256, + kernel_size=3, + strides=1, + padding="same", + activation="relu", + kernel_initializer="he_normal", + )(y) + y = Convolution2D( + filters=256, + kernel_size=3, + strides=1, + padding="same", + activation="relu", + kernel_initializer="he_normal", + )(y) + y = MaxPooling2D(pool_size=2, strides=2, padding="same")(y) + + y = Flatten()(y) + y = Dropout(self.config.get("dropout", 0.5))(y) + y = Dense(units=10, activation="softmax", kernel_initializer="he_normal")(y) + + model = Model(inputs=x, outputs=y, name="model1") + return model + + def setup(self, config): + self.train_data, self.test_data = self._read_data() + x_train = self.train_data[0] + model = self._build_model(x_train.shape[1:]) + + opt = tf.keras.optimizers.Adadelta( + lr=self.config.get("lr", 1e-4), weight_decay=self.config.get("decay", 1e-4) + ) + model.compile( + loss="categorical_crossentropy", optimizer=opt, metrics=["accuracy"] + ) + self.model = model + + def step(self): + x_train, y_train = self.train_data + x_train, y_train = x_train[:NUM_SAMPLES], y_train[:NUM_SAMPLES] + x_test, y_test = self.test_data + x_test, y_test = x_test[:NUM_SAMPLES], y_test[:NUM_SAMPLES] + + aug_gen = ImageDataGenerator( + # set input mean to 0 over the dataset + featurewise_center=False, + # set each sample mean to 0 + samplewise_center=False, + # divide inputs by dataset std + featurewise_std_normalization=False, + # divide each input by its std + samplewise_std_normalization=False, + # apply ZCA whitening + zca_whitening=False, + # randomly rotate images in the range (degrees, 0 to 180) + rotation_range=0, + # randomly shift images horizontally (fraction of total width) + width_shift_range=0.1, + # randomly shift images vertically (fraction of total height) + height_shift_range=0.1, + # randomly flip images + horizontal_flip=True, + # randomly flip images + vertical_flip=False, + ) + + aug_gen.fit(x_train) + batch_size = self.config.get("batch_size", 64) + gen = aug_gen.flow(x_train, y_train, batch_size=batch_size) + self.model.fit_generator( + generator=gen, epochs=self.config.get("epochs", 1), validation_data=None + ) + + # loss, accuracy + _, accuracy = self.model.evaluate(x_test, y_test, verbose=0) + return {"mean_accuracy": accuracy} + + def save_checkpoint(self, checkpoint_dir): + file_path = checkpoint_dir + "/model" + self.model.save(file_path) + + def load_checkpoint(self, checkpoint_dir): + # See https://stackoverflow.com/a/42763323 + del self.model + file_path = checkpoint_dir + "/model" + self.model = load_model(file_path) + + def cleanup(self): + # If need, save your model when exit. + # saved_path = self.model.save(self.logdir) + # print("save model at: ", saved_path) + pass + + +if __name__ == "__main__": + parser = argparse.ArgumentParser() + parser.add_argument( + "--smoke-test", action="store_true", help="Finish quickly for testing" + ) + args, _ = parser.parse_known_args() + + space = { + "epochs": 1, + "batch_size": 64, + "lr": tune.grid_search([10**-4, 10**-5]), + "decay": tune.sample_from(lambda spec: spec.config.lr / 100.0), + "dropout": tune.grid_search([0.25, 0.5]), + } + if args.smoke_test: + space["lr"] = 10**-4 + space["dropout"] = 0.5 + + perturbation_interval = 10 + pbt = PopulationBasedTraining( + time_attr="training_iteration", + perturbation_interval=perturbation_interval, + hyperparam_mutations={ + "dropout": lambda _: np.random.uniform(0, 1), + }, + ) + + tuner = tune.Tuner( + tune.with_resources( + Cifar10Model, + resources={"cpu": 1, "gpu": 1}, + ), + run_config=train.RunConfig( + name="pbt_cifar10", + stop={ + "mean_accuracy": 0.80, + "training_iteration": 30, + }, + checkpoint_config=train.CheckpointConfig( + checkpoint_frequency=perturbation_interval, + checkpoint_score_attribute="mean_accuracy", + num_to_keep=2, + ), + ), + tune_config=tune.TuneConfig( + scheduler=pbt, + num_samples=4, + metric="mean_accuracy", + mode="max", + reuse_actors=True, + ), + param_space=space, + ) + results = tuner.fit() + print("Best hyperparameters found were: ", results.get_best_result().config)