Remove compute capability lazy cell (#2580)
Remove compute capability lock We are only calling the `get_cuda_capability` function once, so avoiding the cost of multiple calls is not really necessary yet.
This commit is contained in:
parent
1028996fb3
commit
afc7ded84f
|
@ -1,9 +1,4 @@
|
||||||
use std::sync::LazyLock;
|
pub fn get_cuda_capability() -> Option<(usize, usize)> {
|
||||||
|
|
||||||
pub static COMPUTE_CAPABILITY: LazyLock<Option<(usize, usize)>> =
|
|
||||||
LazyLock::new(get_cuda_capability);
|
|
||||||
|
|
||||||
fn get_cuda_capability() -> Option<(usize, usize)> {
|
|
||||||
use pyo3::prelude::*;
|
use pyo3::prelude::*;
|
||||||
|
|
||||||
let py_get_capability = |py: Python| -> PyResult<(isize, isize)> {
|
let py_get_capability = |py: Python| -> PyResult<(isize, isize)> {
|
||||||
|
|
|
@ -66,7 +66,7 @@ fn get_config(
|
||||||
}
|
}
|
||||||
|
|
||||||
fn resolve_attention(config: &Option<Config>, lora_adapters: &Option<String>) -> (String, String) {
|
fn resolve_attention(config: &Option<Config>, lora_adapters: &Option<String>) -> (String, String) {
|
||||||
let compute_capability = *gpu::COMPUTE_CAPABILITY;
|
let compute_capability = gpu::get_cuda_capability();
|
||||||
let mut prefix_caching: Option<String> = std::env::var("USE_PREFIX_CACHING").ok();
|
let mut prefix_caching: Option<String> = std::env::var("USE_PREFIX_CACHING").ok();
|
||||||
let mut attention: Option<String> = std::env::var("ATTENTION").ok();
|
let mut attention: Option<String> = std::env::var("ATTENTION").ok();
|
||||||
if let Some(config) = config {
|
if let Some(config) = config {
|
||||||
|
|
Loading…
Reference in New Issue