Skip to content

Commit

Permalink
refactor: remove unused tensorloader tensors
Browse files Browse the repository at this point in the history
  • Loading branch information
philpax committed Jul 15, 2023
1 parent 3e404d2 commit 67bbaf9
Show file tree
Hide file tree
Showing 8 changed files with 11 additions and 11 deletions.
8 changes: 4 additions & 4 deletions crates/llm-base/src/loader.rs
Original file line number Diff line number Diff line change
Expand Up @@ -396,8 +396,8 @@ impl LoadError {
pub trait TensorLoader<E: std::error::Error> {
/// Gets a tensor from the loader.
fn load(&mut self, name: &str) -> Result<ggml::Tensor, E>;
/// Finish loading the model, and extract all of the state from the loader.
fn finish(self) -> (Context, HashMap<String, ggml::Tensor>);
/// Finish loading the model, returning the context.
fn finish(self) -> Context;
}

/// Load a GGML model from the `path` and configure it per the `params`. The status
Expand Down Expand Up @@ -670,8 +670,8 @@ impl TensorLoader<LoadError> for MmapCompatibleLoader<'_> {
Ok(tensor)
}

fn finish(self) -> (Context, HashMap<String, ggml::Tensor>) {
(self.context, self.loaded_tensors)
fn finish(self) -> Context {
self.context
}
}

Expand Down
2 changes: 1 addition & 1 deletion crates/models/bloom/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -89,7 +89,7 @@ impl KnownModel for Bloom {
layers.push(layer);
}

let (context, _) = tl.finish();
let context = tl.finish();

let ModelParameters { context_size, .. } = params;

Expand Down
2 changes: 1 addition & 1 deletion crates/models/falcon/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,7 @@ impl KnownModel for Falcon {
layers.push(layer);
}

let (context, _) = tl.finish();
let context = tl.finish();

let ModelParameters { context_size, .. } = params;

Expand Down
2 changes: 1 addition & 1 deletion crates/models/gpt2/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,7 @@ impl KnownModel for Gpt2 {
layers.push(layer);
}

let (context, _) = tl.finish();
let context = tl.finish();

let ModelParameters { context_size, .. } = params;

Expand Down
2 changes: 1 addition & 1 deletion crates/models/gptj/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,7 @@ impl KnownModel for GptJ {
layers.push(layer);
}

let (context, _) = tl.finish();
let context = tl.finish();

let ModelParameters { context_size, .. } = params;

Expand Down
2 changes: 1 addition & 1 deletion crates/models/gptneox/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -95,7 +95,7 @@ impl KnownModel for GptNeoX {
layers.push(layer);
}

let (context, _) = tl.finish();
let context = tl.finish();

let ModelParameters { context_size, .. } = params;

Expand Down
2 changes: 1 addition & 1 deletion crates/models/llama/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -95,7 +95,7 @@ impl KnownModel for Llama {
};
layers.push(layer);
}
let (context, _) = tl.finish();
let context = tl.finish();

let ModelParameters { context_size, .. } = params;

Expand Down
2 changes: 1 addition & 1 deletion crates/models/mpt/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,7 @@ impl KnownModel for Mpt {
layers.push(layer);
}

let (context, _) = tl.finish();
let context = tl.finish();

let ModelParameters { context_size, .. } = params;

Expand Down

0 comments on commit 67bbaf9

Please sign in to comment.