Skip to content

Commit

Permalink
Expose phi3v loader and remove unused deps (#408)
Browse files Browse the repository at this point in the history
  • Loading branch information
EricLBuehler committed Jun 10, 2024
1 parent 46ecfac commit 146f751
Show file tree
Hide file tree
Showing 6 changed files with 13 additions and 15 deletions.
12 changes: 5 additions & 7 deletions mistralrs-core/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,6 @@ candle-core.workspace = true
candle-nn.workspace = true
serde.workspace = true
serde_json.workspace = true
candle-transformers = { git = "https://github.com/EricLBuehler/candle.git", version = "0.5.0" }
candle-flash-attn = { git = "https://github.com/EricLBuehler/candle.git", version = "0.5.0", optional = true }
dirs = "5.0.1"
hf-hub = "0.3.2"
Expand Down Expand Up @@ -60,18 +59,17 @@ akin = "0.4.0"
variantly = "0.4.0"
buildstructor = "0.5.4"
tracing-subscriber.workspace = true
reqwest.workspace = true
derive-new = "0.6.0"
itertools = "0.13.0"
mistralrs-vision = { version = "0.1.13", path = "../mistralrs-vision" }

[features]
pyo3_macros = ["pyo3"]
cuda = ["candle-core/cuda", "candle-nn/cuda", "candle-transformers/cuda"]
cuda = ["candle-core/cuda", "candle-nn/cuda"]
cudnn = ["candle-core/cudnn"]
metal = ["candle-core/metal", "candle-nn/metal", "candle-transformers/metal"]
flash-attn = ["cuda", "candle-transformers/flash-attn", "dep:candle-flash-attn"]
accelerate = ["candle-core/accelerate", "candle-nn/accelerate", "candle-transformers/accelerate"]
mkl = ["candle-core/mkl", "candle-nn/mkl", "candle-transformers/mkl"]
metal = ["candle-core/metal", "candle-nn/metal"]
flash-attn = ["cuda", "dep:candle-flash-attn"]
accelerate = ["candle-core/accelerate", "candle-nn/accelerate"]
mkl = ["candle-core/mkl", "candle-nn/mkl"]
profile = []

5 changes: 3 additions & 2 deletions mistralrs-core/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -50,8 +50,9 @@ pub use pipeline::{
GGUFArchitecture, GGUFLoader, GGUFLoaderBuilder, GGUFSpecificConfig, GemmaLoader, LlamaLoader,
Loader, LocalModelPaths, MistralLoader, MixtralLoader, ModelKind, ModelPaths, NormalLoader,
NormalLoaderBuilder, NormalLoaderType, NormalSpecificConfig, Phi2Loader, Phi3Loader,
Qwen2Loader, SpeculativeConfig, SpeculativeLoader, SpeculativePipeline, TokenSource,
VisionLoader, VisionLoaderBuilder, VisionLoaderType, VisionModelLoader, VisionSpecificConfig,
Phi3VLoader, Qwen2Loader, SpeculativeConfig, SpeculativeLoader, SpeculativePipeline,
TokenSource, VisionLoader, VisionLoaderBuilder, VisionLoaderType, VisionModelLoader,
VisionSpecificConfig,
};
pub use request::{Constraint, MessageContent, NormalRequest, Request, RequestMessage};
pub use response::Response;
Expand Down
2 changes: 1 addition & 1 deletion mistralrs-core/src/pipeline/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ use std::{collections::HashMap, path::PathBuf, str::FromStr};
use tokenizers::Tokenizer;
use tokio::sync::Mutex;
pub use vision::{VisionLoader, VisionLoaderBuilder, VisionSpecificConfig};
pub use vision_loaders::{VisionLoaderType, VisionModelLoader};
pub use vision_loaders::{Phi3VLoader, VisionLoaderType, VisionModelLoader};

use anyhow::Result;
use candle_core::{DType, Device, Tensor};
Expand Down
4 changes: 2 additions & 2 deletions mistralrs-core/src/pipeline/vision.rs
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
use super::cache_manager::DefaultCacheManager;
use super::vision_loaders::{Phi3Loader, VisionLoaderType};
use super::vision_loaders::{Phi3VLoader, VisionLoaderType};
use super::{
get_model_paths, get_xlora_paths, AdapterActivationMixin, Cache, CacheManager,
CacheManagerMixin, GeneralMetadata, IsqPipelineMixin, Loader, MetadataMixin, ModelCategory,
Expand Down Expand Up @@ -95,7 +95,7 @@ impl VisionLoaderBuilder {
setup_logger_and_debug();

let loader: Box<dyn VisionModelLoader> = match loader {
VisionLoaderType::Phi3V => Box::new(Phi3Loader),
VisionLoaderType::Phi3V => Box::new(Phi3VLoader),
};
Box::new(VisionLoader {
inner: loader,
Expand Down
4 changes: 2 additions & 2 deletions mistralrs-core/src/pipeline/vision_loaders.rs
Original file line number Diff line number Diff line change
Expand Up @@ -59,9 +59,9 @@ impl FromStr for VisionLoaderType {
/// [`VisionLoader`] for a Phi 3 Vision model.
///
/// [`VisionLoader`]: https://ericlbuehler.github.io/mistral.rs/mistralrs/struct.VisionLoader.html
pub struct Phi3Loader;
pub struct Phi3VLoader;

impl VisionModelLoader for Phi3Loader {
impl VisionModelLoader for Phi3VLoader {
fn load(
&self,
config: &str,
Expand Down
1 change: 0 additions & 1 deletion mistralrs-server/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,6 @@ tower-http = { version = "0.5.1", features = ["cors"]}
utoipa = { version = "4.2", features = ["axum_extras"] }
utoipa-swagger-ui = { version = "7.1.0", features = ["axum"]}
mistralrs-core = { version = "0.1.16", path = "../mistralrs-core" }
dyn-fmt = "0.4.0"
indexmap.workspace = true
accelerate-src = { workspace = true, optional = true }
intel-mkl-src = { workspace = true, optional = true }
Expand Down

0 comments on commit 146f751

Please sign in to comment.