summaryrefslogtreecommitdiff
path: root/candle-examples/src
Commit message (Collapse)AuthorAgeFilesLines
* Lint fixes introduced with Rust 1.83 (#2646)Anubhab Bandyopadhyay2024-11-281-1/+0
| | | | | | | | | | | * Fixes for lint errors introduced with Rust 1.83 * rustfmt * Fix more lints. --------- Co-authored-by: Laurent <laurent.mazare@gmail.com>
* MobileCLIP models S1 and S2 (#2454)Jani Monoses2024-08-291-8/+27
| | | | | | | | | | | | | * Allow loading images with given std and mean * OpenCLIP text encoder component * Two MobileCLIP models * Clippy fixes. --------- Co-authored-by: Laurent <laurent.mazare@gmail.com>
* onnx: fix pad, unsqueeze (#2317)shua2024-07-232-3/+3
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * onnx: fix pad, unsqueeze both implementations have off-by-one errors: - Pad 'reflect' cycle for eg `dim==3` is `[0,1,2,1]` which has length of 4 (or `dim*2 - 2`) not 5 (current code `dim*2 - 1`) - Unsqueeze(-1) for tensor with `dim==3` should be 3 (ie `dim+index+1`) not 2 (ie currently `dim+index`) in addition, Pad is incorrectly calculating the starting padding. If we want to pad out 2 elements to the start, and we have this cycle of indices of length 6, then we should skip 4 elements, but currently we skip 2. A more visual representation of what's going on is below: ``` pad_start: 2 data: [a,b,c,d] indices: [0, 1, 2, 3, 2, 1, 0, 1, 2, 3, 2, 1, 0, ..] // zigzag between 0..4 actual: skip [ c d| c b a b] expected: ~ skip ~ [ c b| a b c d] ``` The values between `[` and `|` are padding and the values between `|` and `]` in the example should match the original data being padded. * Fix clippy lints. --------- Co-authored-by: Laurent <laurent.mazare@gmail.com>
* Add Mobilenet v4 (#2325)Jani Monoses2024-07-091-17/+13
| | | | | | | * Support different resolutions in load_image() * Added MobilenetV4 model. * Add MobileNetv4 to README
* Add DINOv2Reg4 + PlantCLEF2024 (#2293)v-espitalier2024-06-291-0/+18
| | | | | | | | | | | | | | | | | | | | * Add: DINOv2Reg4 with PlantCLEF2024 weights and example ( See https://arxiv.org/abs/2309.16588 and https://zenodo.org/records/10848263 ) * Remove extra files + update README to download them + remove extra lines * minor fix (README remove extra spaces) * minor fix (README: Fix image url) * Modif: Add back interpolate_pos_encoding() + fix when no interpolation + remove extra comments + Update README ( source image changed and so the predictions ) * Fix: Improve code lisibility with '$ cargo clippy' and '$ cargo fmt' * Another clippy fix. --------- Co-authored-by: x-VEspit <vincent.espitalier@cirad.fr> Co-authored-by: laurent <laurent.mazare@gmail.com>
* chore: fix some typos in comments (#2121)hardlydearly2024-04-281-2/+2
| | | Signed-off-by: hardlydearly <799511800@qq.com>
* Normalize loudness of the generated audio (#1795)Laurent Mazare2024-03-033-0/+537
| | | | | | | | | | | | | * Normalize loudness of the generated audio. * Lints. * One more lint. * Avoid running the bs1770 tests. * Another attempt at discarding doc comments. * Also normalize the loudness in the encodec example.
* Add the StarCoder2 model. (#1779)Laurent Mazare2024-02-281-1/+1
| | | | | | | * Add the StarCoder2 model. * Add the example code and get things to work. * And also tweak the readme.
* Encodec model. (#1771)Laurent Mazare2024-02-272-0/+57
| | | | | | | | | | | | | | | * Encodec model. * Fixes. * Add the padding functions. * Get the LSTM bit to work. * Get the encodec model to generate some tokens (decoder only for now). * Minor tweak. * Minor tweak.
* Fix token generation in bilingual models (non-English outputs) (#1668)Guoqing Bao2024-02-061-1/+1
| | | Co-authored-by: Guoqing Bao <guoqing.bao@enflame-tech.com>
* Helper function to load sharded safetensors files (#1481)Laurent Mazare2023-12-251-0/+27
| | | | | | | * Fix the quantized mistral example. * Add a helper function to load sharded safetensors weights. * Use the sharded loader.
* Metal part 1 - Scaffolding for metal. (#1308)Nicolas Patry2023-11-101-3/+14
| | | | | * Metal part 1 - Scaffolding for metal. * Remove tracing.
* Quantized version of mistral. (#1009)Laurent Mazare2023-09-301-2/+14
| | | | | | | | | | | | | | | * Quantized version of mistral. * Integrate the quantized mistral variant. * Use the quantized weight files. * Tweak the quantization command. * Fix the dtype when computing the rotary embeddings. * Update the readme with the quantized version. * Fix the decoding of the remaining tokens.
* Streaming mode for reporting the generated tokens (#1007)Laurent Mazare2023-09-302-0/+75
| | | | | | | | | * Token streaming. * Use the token output stream. * Flush the output. * Ensure that the last characters get reported.
* Move more models to candle-transformers (#796)Laurent Mazare2023-09-102-53/+0
| | | | | | | | | * Move dinov2. * Move efficientnet. * Move the quantized llama model. * Move segment-anything.
* Automatic mask generation (#779)Laurent Mazare2023-09-081-4/+4
| | | | | | | | | * A few more contiguous fixes for cuda. * Mask generation. * Generic bbox. * Generate all the masks.
* Automatic mask generator + point base mask (#773)Laurent Mazare2023-09-081-2/+28
| | | | | | | | | | | * Add more to the automatic mask generator. * Add the target point. * Fix. * Remove the allow-unused. * Mask post-processing.
* Segment-anything fixes: avoid normalizing twice. (#767)Laurent Mazare2023-09-071-0/+28
| | | | | * Segment-anything fixes: avoid normalizing twice. * More fixes for the image aspect ratio.
* img2img pipeline for stable diffusion. (#752)Laurent Mazare2023-09-061-4/+4
| | | | | | | | | | | | | | | | | | | * img2img pipeline for stable diffusion. * Rename the arguments + fix. * Fix for zero strength. * Another fix. * Another fix. * Revert. * Include the backtrace. * Noise scaling. * Fix the height/width.
* Fix clippy + save_image.Nicolas Patry2023-08-291-0/+37
|
* Cleanup:Nicolas Patry2023-08-281-231/+0
| | | | | - Moved around book from `examples` to `candle-book` proper (overlapping the book and the lib structures)
* Training:Nicolas Patry2023-08-281-6/+78
| | | | | | | - Removed a lot of surface (SerializedFileReader ownership is really painful). - Moved example + vision to hf.co version. - Removed feature gate.
* Better training+hubNicolas Patry2023-08-281-0/+23
|
* Move the yolo model bits in a separate file. (#602)Laurent Mazare2023-08-251-1/+8
| | | | | | | * Move the yolo model bits in a separate file. * Improve the drawing. * Bugfix.
* More support for pose estimation in yolo-v8. (#599)Laurent Mazare2023-08-251-1/+2
| | | | | * More support for pose estimation in yolo-v8. * Support both object detection and pose-estimation in the yolo-v8 example.
* Move the imagenet specific bits to a separate file. (#571)Laurent Mazare2023-08-232-1022/+1024
|
* Move the yolo shared bits to a common place. (#548)Laurent Mazare2023-08-223-0/+129
| | | | | | | * Move the yolo shared bits to a common place. * Share more code. * Configurable thresholds.
* Add a yolo-v3 example. (#528)Laurent Mazare2023-08-201-0/+18
| | | | | | | | | | | | | | | * Add a couple functions required for yolo. * Add the yolo-v3 example. * Add minimum and maximum. * Use the newly introduced maximum. * Cuda support for min/max + add some testing. * Allow for more tests to work with accelerate. * Fix a typo.
* Print the recognized categories in dino-v2. (#506)Laurent Mazare2023-08-181-1/+1006
|
* Add the permute op (similar to pytorch). (#504)Laurent Mazare2023-08-181-2/+2
| | | | | * Add the permute op (similar to pytorch). * Add the backprop for dimension permutation.
* dinov2 - read images from disk and compute the class probabilities (#503)Laurent Mazare2023-08-181-1/+37
| | | | | * Load the image from disk and convert it to a tensor. * Tweak the function name.
* Typos and format and CD only when PR lands.Nicolas Patry2023-08-021-4/+4
|
* Adding more details on how to load things.Nicolas Patry2023-08-021-0/+99
| | | | | | | | | | | - Loading with memmap - Loading a sharded tensor - Moved some snippets to `candle-examples/src/lib.rs` This is because managing book specific dependencies is a pain https://github.com/rust-lang/mdBook/issues/706 - This causes a non aligned inclusion https://github.com/rust-lang/mdBook/pull/1856 which we have to ignore fmt to remove. mdbook might need some more love :)
* Add some 'cuda-if-available' helper function. (#172)Laurent Mazare2023-07-151-0/+12
|
* Formatting.laurent2023-07-031-0/+1
|
* Move llama in a cargo-examples directory.laurent2023-07-031-0/+0