Skip to content

Commit

Permalink
remove fetch method from ModelTrait
Browse files Browse the repository at this point in the history
  • Loading branch information
jorgeantonio21 committed Mar 31, 2024
1 parent cddb534 commit f673dea
Show file tree
Hide file tree
Showing 3 changed files with 2 additions and 10 deletions.
2 changes: 1 addition & 1 deletion atoma-inference/src/model_thread.rs
Original file line number Diff line number Diff line change
Expand Up @@ -113,7 +113,7 @@ where
) -> Result<(Self, Vec<ModelThreadHandle<T, U>>), ModelThreadError>
where
F: ApiTrait,
M: ModelTrait<FetchApi = F, Input = T::ModelInput, Output = U::ModelOutput>
M: ModelTrait<Input = T::ModelInput, Output = U::ModelOutput>
+ Send
+ 'static,
{
Expand Down
3 changes: 0 additions & 3 deletions atoma-inference/src/models/mod.rs
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
use std::path::PathBuf;

use crate::{apis::ApiTrait, models::config::ModelConfig};
use ed25519_consensus::VerificationKey as PublicKey;
use thiserror::Error;

Expand All @@ -16,11 +15,9 @@ pub trait ModelBuilder {

pub trait ModelTrait {
type Builder: Send + Sync + 'static;
type FetchApi: ApiTrait + Send + Sync + 'static;
type Input;
type Output;

fn fetch(api: &Self::FetchApi, config: ModelConfig) -> Result<(), ModelError>;
fn load(filenames: Vec<PathBuf>) -> Result<Self, ModelError>
where
Self: Sized;
Expand Down
7 changes: 1 addition & 6 deletions atoma-inference/src/service.rs
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ where
request_receiver: Receiver<T>,
) -> Result<Self, ModelServiceError>
where
M: ModelTrait<FetchApi = F, Input = T::ModelInput, Output = U::ModelOutput>
M: ModelTrait<Input = T::ModelInput, Output = U::ModelOutput>
+ Send
+ 'static,
F: ApiTrait,
Expand Down Expand Up @@ -200,14 +200,9 @@ mod tests {

impl ModelTrait for TestModelInstance {
type Builder = ();
type FetchApi = MockApi;
type Input = ();
type Output = ();

fn fetch(_: &Self::FetchApi, _: ModelConfig) -> Result<(), crate::models::ModelError> {
Ok(())
}

fn load(_: Vec<PathBuf>) -> Result<Self, crate::models::ModelError> {
Ok(Self {})
}
Expand Down

0 comments on commit f673dea

Please sign in to comment.