From e47431ed808290aa391f76fb5de83ae2856f72ad Mon Sep 17 00:00:00 2001 From: Martin Evans Date: Fri, 17 Nov 2023 23:18:27 +0000 Subject: [PATCH] Modified `TensorSplitsCollection` so it accepts any number of splits, as long as it doesn't exceed the number of supported devices --- LLama/Abstractions/IModelParams.cs | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/LLama/Abstractions/IModelParams.cs b/LLama/Abstractions/IModelParams.cs index d25b3cf0..2ecfe49c 100644 --- a/LLama/Abstractions/IModelParams.cs +++ b/LLama/Abstractions/IModelParams.cs @@ -134,9 +134,10 @@ namespace LLama.Abstractions /// public TensorSplitsCollection(float[] splits) { - if (splits.Length != Splits.Length) - throw new ArgumentException($"tensor splits length must equal {Splits.Length}"); - Splits = splits; + if (splits.Length > Splits.Length) + throw new ArgumentException($"Must supply at most {Splits.Length} tensor splits", nameof(splits)); + + splits.CopyTo(Splits.AsSpan()); } ///