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
install-flash-attention: build-flash-attention
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
\ No newline at end of file
cd flash-attention && python setup.py install && cd csrc/layer_norm && python setup.py install && cd ../rotary && python setup.py install
......@@ -13,7 +13,7 @@ install-causal-conv1d: build-causal-conv1d
cd causal-conv1d/ && pip install .
# selective-scan dependends on causal-conv1d
selective-scan:
selective-scan:
rm -rf mamba
git clone https://github.com/state-spaces/mamba.git mamba
......@@ -21,8 +21,8 @@ build-selective-scan: selective-scan
cd mamba/ && git fetch && git checkout $(selective_scan_commit)
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
cd mamba && pip install .
build-all: build-causal-conv1d build-selective-scan
\ No newline at end of file
build-all: build-causal-conv1d build-selective-scan
......@@ -12,4 +12,4 @@ make install
```shell
make run-dev
```
\ No newline at end of file
```
......@@ -247,4 +247,4 @@ PYBIND11_MODULE(TORCH_EXTENSION_NAME, m) {
&forward,
"Bloom attention mechanism forward (CUDA)"
);
}
\ No newline at end of file
}
......@@ -16,4 +16,4 @@ void column_remap_cuda
const uint32_t* x_map
);
#endif
\ No newline at end of file
#endif
......@@ -50,4 +50,4 @@ private:
void g_q4_keep_matrix(Q4Matrix* m);
void g_q4_free_matrices();
#endif
\ No newline at end of file
#endif
......@@ -48,4 +48,4 @@ __host__ __forceinline__ hipblasStatus_t __compat_hipblasHgemm(hipblasHandle_t
#define rocblas_set_stream hipblasSetStream
#define rocblas_hgemm __compat_hipblasHgemm
#endif
\ No newline at end of file
#endif
......@@ -118,4 +118,4 @@ public:
}
};
#endif
\ No newline at end of file
#endif
......@@ -33,4 +33,4 @@ void clear_tensor_cuda
int size_n
);
#endif
\ No newline at end of file
#endif
......@@ -100,4 +100,4 @@ __forceinline__ __device__ void dequant_2bit_16
#endif
#endif
\ No newline at end of file
#endif
......@@ -224,4 +224,4 @@ __forceinline__ __device__ void dequant_4bit_8_gptq
#endif
#endif
\ No newline at end of file
#endif
......@@ -204,4 +204,4 @@ __forceinline__ __device__ void dequant_5bit_32
#endif
#endif
\ No newline at end of file
#endif
......@@ -40,5 +40,3 @@ __forceinline__ __device__ void dequant_6bit_16
#endif
#endif
......@@ -35,4 +35,4 @@ __forceinline__ __device__ void dequant_8bit_8
#endif
#endif
\ No newline at end of file
#endif
......@@ -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);
#endif
\ No newline at end of file
#endif
......@@ -251,9 +251,9 @@ class LlamaMLP(nn.Module):
if "gelu" not in act
else lambda x: torch.nn.functional.gelu(
x,
approximate="tanh"
if act in ["gelu_fast", "gelu_pytorch_tanh"]
else "none",
approximate=(
"tanh" if act in ["gelu_fast", "gelu_pytorch_tanh"] else "none"
),
)
)
# Fuse gate and up proj
......
......@@ -255,9 +255,9 @@ class MistralMLP(nn.Module):
if "gelu" not in act
else lambda x: torch.nn.functional.gelu(
x,
approximate="tanh"
if act in ["gelu_fast", "gelu_pytorch_tanh"]
else "none",
approximate=(
"tanh" if act in ["gelu_fast", "gelu_pytorch_tanh"] else "none"
),
)
)
# Fuse gate and up proj
......
......@@ -344,9 +344,9 @@ class BlockSparseMoE(nn.Module):
if "gelu" in act:
self.act = lambda x: torch.nn.functional.gelu(
x,
approximate="tanh"
if act in ["gelu_fast", "gelu_pytorch_tanh"]
else "none",
approximate=(
"tanh" if act in ["gelu_fast", "gelu_pytorch_tanh"] else "none"
),
)
elif "silu" in act:
self.act = torch.nn.functional.silu
......@@ -600,9 +600,9 @@ class DenseMoE(nn.Module):
if "gelu" in act:
self.act = lambda x: torch.nn.functional.gelu(
x,
approximate="tanh"
if act in ["gelu_fast", "gelu_pytorch_tanh"]
else "none",
approximate=(
"tanh" if act in ["gelu_fast", "gelu_pytorch_tanh"] else "none"
),
)
elif "silu" in act:
self.act = torch.nn.functional.silu
......
......@@ -187,9 +187,9 @@ class FlashMLP(nn.Module):
if "gelu" not in act
else lambda x: torch.nn.functional.gelu(
x,
approximate="tanh"
if act in ["gelu_fast", "gelu_pytorch_tanh"]
else "none",
approximate=(
"tanh" if act in ["gelu_fast", "gelu_pytorch_tanh"] else "none"
),
)
)
......
......@@ -225,9 +225,9 @@ class PhiMLP(nn.Module):
if "gelu" not in act
else lambda x: torch.nn.functional.gelu(
x,
approximate="tanh"
if act in ["gelu_fast", "gelu_pytorch_tanh"]
else "none",
approximate=(
"tanh" if act in ["gelu_fast", "gelu_pytorch_tanh"] 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