File tree Expand file tree Collapse file tree 1 file changed +9
-7
lines changed Expand file tree Collapse file tree 1 file changed +9
-7
lines changed Original file line number Diff line number Diff line change @@ -701,23 +701,30 @@ private static unsafe void Free(ref LLamaSamplerNative smpl)
701701
702702 sampler . _gcHandle . Free ( ) ;
703703
704- sampler . _sampler . Free ( ) ;
704+ sampler . _sampler . Dispose ( ) ;
705705 }
706706}
707707
708708/// <summary>
709709/// A custom sampler stage for modifying logits or selecting a token
710710/// </summary>
711711public interface ICustomSampler
712+ : IDisposable
712713{
713714 /// <summary>
714715 /// The human readable name of this stage
715716 /// </summary>
716717 string Name { get ; }
717718
718719 /// <summary>
719- /// Apply this stage to a set of logits. This can modify logits or select a token (or both). If logits are modified, the Sorted flag must be cleared.
720+ /// Apply this stage to a set of logits.
721+ /// This can modify logits or select a token (or both).
722+ /// If logits are modified the Sorted flag <b>must</b> be set to false.
720723 /// </summary>
724+ /// <remarks>
725+ /// If the logits are no longer sorted after the custom sampler has run it is <b>critically</b> important to
726+ /// set <i>Sorted=false</i>. If unsure, always set it to false, this is a safe default.
727+ /// </remarks>
721728 /// <param name="tokenData"></param>
722729 void Apply ( ref LLamaTokenDataArrayNative tokenData ) ;
723730
@@ -736,9 +743,4 @@ public interface ICustomSampler
736743 /// Create a clone of this sampler
737744 /// </summary>
738745 ICustomSampler Clone ( ) ;
739-
740- /// <summary>
741- /// Free all unmanaged resources held by this sampler
742- /// </summary>
743- void Free ( ) ;
744746}
You can’t perform that action at this time.
0 commit comments