@@ -87,22 +87,27 @@ @implementation LLaMATests
8787 for (NSUInteger index = 2 ; specialTokens.count < 256 ; ++index) {
8888 [specialTokens addObject: [NSString stringWithFormat: @" <|reserved_special_token_%zu |>" , index]];
8989 }
90- auto __block runner = [[ExecuTorchLLMTextRunner alloc ] initWithModelPath: modelPath
91- tokenizerPath: tokenizerPath
92- specialTokens: specialTokens];
90+ ExecuTorchLLMTextRunner *__block runner =
91+ [[ExecuTorchLLMTextRunner alloc ] initWithModelPath: modelPath
92+ tokenizerPath: tokenizerPath
93+ specialTokens: specialTokens];
9394 NSError *error;
9495 BOOL status = [runner loadWithError: &error];
9596 if (!status) {
9697 XCTFail (" Load failed with error %zi" , error.code );
9798 return ;
9899 }
100+ ExecuTorchLLMGenerationConfig *config =
101+ [[ExecuTorchLLMGenerationConfig alloc ] initWithConfigurationHandler: ^(ExecuTorchLLMGenerationConfig *config) {
102+ config.sequenceLength = 50 ;
103+ }];
99104 TokensPerSecondMetric *tokensPerSecondMetric = [TokensPerSecondMetric new ];
100105 [testCase measureWithMetrics: @[ tokensPerSecondMetric, [XCTClockMetric new ], [XCTMemoryMetric new ] ]
101106 block: ^{
102107 tokensPerSecondMetric.tokenCount = 0 ;
103- BOOL status = [runner generate :@" Once upon a time"
104- sequenceLength: 50
105- withTokenCallback: ^(NSString *token) {
108+ BOOL status = [runner generateWithPrompt :@" Once upon a time"
109+ config: config
110+ withTokenCallback: ^(NSString *token) {
106111 tokensPerSecondMetric.tokenCount ++;
107112 }
108113 error: NULL ];
0 commit comments