fix: remove pipeline as any cast; type progress callback with ProgressInfo; remove unused HF_DOWNLOAD_TIMEOUT_MS import

Agent-Logs-Url: https://github.com/abhigyanpatwari/GitNexus/sessions/43e60ccd-6f01-4cec-8ee3-c22e8b000efe

Co-authored-by: magyargergo <11230420+magyargergo@users.noreply.github.com>
This commit is contained in:
copilot-swe-agent[bot] 2026-05-08 07:08:10 +00:00 • committed by GitHub
parent e6de518777
commit f5b62e4e23
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
3 changed files with 14 additions and 10 deletions

View file

@ -14,7 +14,12 @@ if (!process.env.ORT_LOG_LEVEL) {
process.env.ORT_LOG_LEVEL = '3';
}
import { pipeline, env, type FeatureExtractionPipeline } from '@huggingface/transformers';
import {
pipeline,
env,
type FeatureExtractionPipeline,
type ProgressInfo,
} from '@huggingface/transformers';
import { existsSync } from 'fs';
import { execFileSync } from 'child_process';
import { join, dirname } from 'path';
@ -171,13 +176,13 @@ export const initEmbedder = async (
}
const progressCallback = onProgress
? (data: any) => {
? (data: ProgressInfo) => {
const progress: ModelProgress = {
status: data.status || 'progress',
file: data.file,
progress: data.progress,
loaded: data.loaded,
total: data.total,
status: data.status === 'progress_total' ? 'progress' : data.status,
file: 'file' in data ? data.file : undefined,
progress: 'progress' in data ? data.progress : undefined,
loaded: 'loaded' in data ? data.loaded : undefined,
total: 'total' in data ? data.total : undefined,
};
onProgress(progress);
}
@ -204,7 +209,7 @@ export const initEmbedder = async (
embedderInstance = await withHfDownloadRetry(
() =>
(pipeline as any)('feature-extraction', finalConfig.modelId, {
pipeline('feature-extraction', finalConfig.modelId, {
device: device,
dtype: 'fp32',
progress_callback: progressCallback,

View file

@ -74,7 +74,7 @@ export const initEmbedder = async (): Promise<FeatureExtractionPipeline> => {
process.stderr.write = (() => true) as any;
try {
embedderInstance = await withHfDownloadRetry(() =>
(pipeline as any)('feature-extraction', MODEL_ID, {
pipeline('feature-extraction', MODEL_ID, {
device: device,
dtype: 'fp32',
session_options: {

View file

@ -10,7 +10,6 @@ import {
withDownloadTimeout,
withHfDownloadRetry,
CIRCUIT_OPEN_TAG,
HF_DOWNLOAD_TIMEOUT_MS,
HF_MAX_ATTEMPTS,
HF_MAX_TIMEOUT_MS,
HF_MAX_ATTEMPTS_CAP,