-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
removed version constraints for candle deps
- Loading branch information
1 parent
5445ff3
commit 91fc000
Showing
13 changed files
with
66 additions
and
63 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,3 @@ | ||
pub mod model; | ||
pub mod infer; | ||
pub mod utils; | ||
pub mod server; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
use once_cell::sync::Lazy; | ||
use candle_core::Device; | ||
|
||
#[cfg(all(feature = "metal", feature = "cuda"))] | ||
compile_error!("feature \"metal\" and feature \"cuda\" cannot be enabled at the same time"); | ||
|
||
#[cfg(feature = "metal")] | ||
pub static DEVICE: Lazy<Device> = | ||
Lazy::new(|| Device::new_metal(0).expect("No Metal device found.")); | ||
|
||
#[cfg(feature = "cuda")] | ||
pub static DEVICE: Lazy<Device> = | ||
Lazy::new(|| Device::new_cuda(0).expect("No CUDA device found.")); | ||
|
||
#[cfg(not(any(feature = "metal", feature = "cuda")))] | ||
pub static DEVICE: Lazy<Device> = Lazy::new(|| Device::Cpu); | ||
|
||
pub fn print_device_info() { | ||
|
||
#[cfg(not(any(feature = "metal", feature = "cuda")))] | ||
tracing::info!("Using CPU"); | ||
|
||
#[cfg(feature = "cuda")] | ||
tracing::info!("Using CUDA"); | ||
|
||
#[cfg(feature = "metal")] | ||
tracing::info!("Using Metal"); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,2 +1,4 @@ | ||
pub mod embedder; | ||
pub mod sentence_transformer; | ||
mod utils; | ||
pub mod device; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
use candle_core::Tensor; | ||
|
||
pub fn normalize_l2(v: &Tensor) -> candle_core::Result<Tensor> { | ||
v.broadcast_div(&v.sqr()?.sum_keepdim(1)?.sqrt()?) | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters