Unverified Commit 9946165e authored by OlivierDehaene's avatar OlivierDehaene Committed by GitHub
Browse files

chore: add pre-commit (#1569)

parent 142cdabe
...@@ -13,4 +13,4 @@ build-flash-attention: flash-attention ...@@ -13,4 +13,4 @@ build-flash-attention: flash-attention
install-flash-attention: build-flash-attention install-flash-attention: build-flash-attention
pip uninstall flash_attn rotary_emb dropout_layer_norm -y || true pip uninstall flash_attn rotary_emb dropout_layer_norm -y || true
cd flash-attention && python setup.py install && cd csrc/layer_norm && python setup.py install && cd ../rotary && python setup.py install cd flash-attention && python setup.py install && cd csrc/layer_norm && python setup.py install && cd ../rotary && python setup.py install
\ No newline at end of file
...@@ -13,7 +13,7 @@ install-causal-conv1d: build-causal-conv1d ...@@ -13,7 +13,7 @@ install-causal-conv1d: build-causal-conv1d
cd causal-conv1d/ && pip install . cd causal-conv1d/ && pip install .
# selective-scan dependends on causal-conv1d # selective-scan dependends on causal-conv1d
selective-scan: selective-scan:
rm -rf mamba rm -rf mamba
git clone https://github.com/state-spaces/mamba.git mamba git clone https://github.com/state-spaces/mamba.git mamba
...@@ -21,8 +21,8 @@ build-selective-scan: selective-scan ...@@ -21,8 +21,8 @@ build-selective-scan: selective-scan
cd mamba/ && git fetch && git checkout $(selective_scan_commit) cd mamba/ && git fetch && git checkout $(selective_scan_commit)
cd mamba && python setup.py build cd mamba && python setup.py build
install-selective-scan: install-causal-conv1d build-selective-scan install-selective-scan: install-causal-conv1d build-selective-scan
pip uninstall selective-scan-cuda -y || true pip uninstall selective-scan-cuda -y || true
cd mamba && pip install . cd mamba && pip install .
build-all: build-causal-conv1d build-selective-scan build-all: build-causal-conv1d build-selective-scan
\ No newline at end of file
...@@ -12,4 +12,4 @@ make install ...@@ -12,4 +12,4 @@ make install
```shell ```shell
make run-dev make run-dev
``` ```
\ No newline at end of file
...@@ -247,4 +247,4 @@ PYBIND11_MODULE(TORCH_EXTENSION_NAME, m) { ...@@ -247,4 +247,4 @@ PYBIND11_MODULE(TORCH_EXTENSION_NAME, m) {
&forward, &forward,
"Bloom attention mechanism forward (CUDA)" "Bloom attention mechanism forward (CUDA)"
); );
} }
\ No newline at end of file
...@@ -16,4 +16,4 @@ void column_remap_cuda ...@@ -16,4 +16,4 @@ void column_remap_cuda
const uint32_t* x_map const uint32_t* x_map
); );
#endif #endif
\ No newline at end of file
...@@ -50,4 +50,4 @@ private: ...@@ -50,4 +50,4 @@ private:
void g_q4_keep_matrix(Q4Matrix* m); void g_q4_keep_matrix(Q4Matrix* m);
void g_q4_free_matrices(); void g_q4_free_matrices();
#endif #endif
\ No newline at end of file
...@@ -48,4 +48,4 @@ __host__ __forceinline__ hipblasStatus_t __compat_hipblasHgemm(hipblasHandle_t ...@@ -48,4 +48,4 @@ __host__ __forceinline__ hipblasStatus_t __compat_hipblasHgemm(hipblasHandle_t
#define rocblas_set_stream hipblasSetStream #define rocblas_set_stream hipblasSetStream
#define rocblas_hgemm __compat_hipblasHgemm #define rocblas_hgemm __compat_hipblasHgemm
#endif #endif
\ No newline at end of file
...@@ -118,4 +118,4 @@ public: ...@@ -118,4 +118,4 @@ public:
} }
}; };
#endif #endif
\ No newline at end of file
...@@ -33,4 +33,4 @@ void clear_tensor_cuda ...@@ -33,4 +33,4 @@ void clear_tensor_cuda
int size_n int size_n
); );
#endif #endif
\ No newline at end of file
...@@ -100,4 +100,4 @@ __forceinline__ __device__ void dequant_2bit_16 ...@@ -100,4 +100,4 @@ __forceinline__ __device__ void dequant_2bit_16
#endif #endif
#endif #endif
\ No newline at end of file
...@@ -224,4 +224,4 @@ __forceinline__ __device__ void dequant_4bit_8_gptq ...@@ -224,4 +224,4 @@ __forceinline__ __device__ void dequant_4bit_8_gptq
#endif #endif
#endif #endif
\ No newline at end of file
...@@ -204,4 +204,4 @@ __forceinline__ __device__ void dequant_5bit_32 ...@@ -204,4 +204,4 @@ __forceinline__ __device__ void dequant_5bit_32
#endif #endif
#endif #endif
\ No newline at end of file
...@@ -40,5 +40,3 @@ __forceinline__ __device__ void dequant_6bit_16 ...@@ -40,5 +40,3 @@ __forceinline__ __device__ void dequant_6bit_16
#endif #endif
#endif #endif
...@@ -35,4 +35,4 @@ __forceinline__ __device__ void dequant_8bit_8 ...@@ -35,4 +35,4 @@ __forceinline__ __device__ void dequant_8bit_8
#endif #endif
#endif #endif
\ No newline at end of file
...@@ -51,4 +51,4 @@ inline void gpu_assert(cudaError_t code, const char *file, int line, bool abort= ...@@ -51,4 +51,4 @@ inline void gpu_assert(cudaError_t code, const char *file, int line, bool abort=
void print_global_mem(const half* ptr, int rows, int columns, int stride); void print_global_mem(const half* ptr, int rows, int columns, int stride);
#endif #endif
\ No newline at end of file
...@@ -251,9 +251,9 @@ class LlamaMLP(nn.Module): ...@@ -251,9 +251,9 @@ class LlamaMLP(nn.Module):
if "gelu" not in act if "gelu" not in act
else lambda x: torch.nn.functional.gelu( else lambda x: torch.nn.functional.gelu(
x, x,
approximate="tanh" approximate=(
if act in ["gelu_fast", "gelu_pytorch_tanh"] "tanh" if act in ["gelu_fast", "gelu_pytorch_tanh"] else "none"
else "none", ),
) )
) )
# Fuse gate and up proj # Fuse gate and up proj
......
...@@ -255,9 +255,9 @@ class MistralMLP(nn.Module): ...@@ -255,9 +255,9 @@ class MistralMLP(nn.Module):
if "gelu" not in act if "gelu" not in act
else lambda x: torch.nn.functional.gelu( else lambda x: torch.nn.functional.gelu(
x, x,
approximate="tanh" approximate=(
if act in ["gelu_fast", "gelu_pytorch_tanh"] "tanh" if act in ["gelu_fast", "gelu_pytorch_tanh"] else "none"
else "none", ),
) )
) )
# Fuse gate and up proj # Fuse gate and up proj
......
...@@ -344,9 +344,9 @@ class BlockSparseMoE(nn.Module): ...@@ -344,9 +344,9 @@ class BlockSparseMoE(nn.Module):
if "gelu" in act: if "gelu" in act:
self.act = lambda x: torch.nn.functional.gelu( self.act = lambda x: torch.nn.functional.gelu(
x, x,
approximate="tanh" approximate=(
if act in ["gelu_fast", "gelu_pytorch_tanh"] "tanh" if act in ["gelu_fast", "gelu_pytorch_tanh"] else "none"
else "none", ),
) )
elif "silu" in act: elif "silu" in act:
self.act = torch.nn.functional.silu self.act = torch.nn.functional.silu
...@@ -600,9 +600,9 @@ class DenseMoE(nn.Module): ...@@ -600,9 +600,9 @@ class DenseMoE(nn.Module):
if "gelu" in act: if "gelu" in act:
self.act = lambda x: torch.nn.functional.gelu( self.act = lambda x: torch.nn.functional.gelu(
x, x,
approximate="tanh" approximate=(
if act in ["gelu_fast", "gelu_pytorch_tanh"] "tanh" if act in ["gelu_fast", "gelu_pytorch_tanh"] else "none"
else "none", ),
) )
elif "silu" in act: elif "silu" in act:
self.act = torch.nn.functional.silu self.act = torch.nn.functional.silu
......
...@@ -187,9 +187,9 @@ class FlashMLP(nn.Module): ...@@ -187,9 +187,9 @@ class FlashMLP(nn.Module):
if "gelu" not in act if "gelu" not in act
else lambda x: torch.nn.functional.gelu( else lambda x: torch.nn.functional.gelu(
x, x,
approximate="tanh" approximate=(
if act in ["gelu_fast", "gelu_pytorch_tanh"] "tanh" if act in ["gelu_fast", "gelu_pytorch_tanh"] else "none"
else "none", ),
) )
) )
......
...@@ -225,9 +225,9 @@ class PhiMLP(nn.Module): ...@@ -225,9 +225,9 @@ class PhiMLP(nn.Module):
if "gelu" not in act if "gelu" not in act
else lambda x: torch.nn.functional.gelu( else lambda x: torch.nn.functional.gelu(
x, x,
approximate="tanh" approximate=(
if act in ["gelu_fast", "gelu_pytorch_tanh"] "tanh" if act in ["gelu_fast", "gelu_pytorch_tanh"] else "none"
else "none", ),
) )
) )
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment