forked from huggingface/candle
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #2 from spiceai/jack/spiceai
Update from `EricLBuehler/main`
- Loading branch information
Showing
122 changed files
with
6,457 additions
and
1,147 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
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,28 @@ | ||
#[cfg(feature = "accelerate")] | ||
extern crate accelerate_src; | ||
|
||
#[cfg(feature = "mkl")] | ||
extern crate intel_mkl_src; | ||
|
||
use anyhow::Result; | ||
use candle_core::{Device, Tensor}; | ||
|
||
fn main() -> Result<()> { | ||
// This requires the code to be run with MTL_CAPTURE_ENABLED=1 | ||
let device = Device::new_metal(0)?; | ||
let metal_device = match &device { | ||
Device::Metal(m) => m, | ||
_ => anyhow::bail!("unexpected device"), | ||
}; | ||
metal_device.capture("/tmp/candle.gputrace")?; | ||
// This first synchronize ensures that a new command buffer gets created after setting up the | ||
// capture scope. | ||
device.synchronize()?; | ||
let x = Tensor::randn(0f32, 1.0, (128, 128), &device)?; | ||
let x1 = x.add(&x)?; | ||
println!("{x1:?}"); | ||
// This second synchronize ensures that the command buffer gets commited before the end of the | ||
// capture scope. | ||
device.synchronize()?; | ||
Ok(()) | ||
} |
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
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,20 @@ | ||
# candle-beit | ||
|
||
[Beit](https://arxiv.org/abs/2106.08254) is a computer vision model. | ||
In this example, it is used as an ImageNet classifier: the model returns the | ||
probability for the image to belong to each of the 1000 ImageNet categories. | ||
|
||
## Running some example | ||
|
||
```bash | ||
cargo run --example beit --release -- --image candle-examples/examples/yolo-v8/assets/bike.jpg | ||
|
||
> mountain bike, all-terrain bike, off-roader: 56.16% | ||
> bicycle-built-for-two, tandem bicycle, tandem: 3.08% | ||
> maillot : 2.23% | ||
> alp : 0.88% | ||
> crash helmet : 0.85% | ||
|
||
``` | ||
|
||
![Leading group, Giro d'Italia 2021](../yolo-v8/assets/bike.jpg) |
Oops, something went wrong.