Skip to content

Commit

Permalink
Revert "fix janus model"
Browse files Browse the repository at this point in the history
This reverts commit ab2bd3e.
  • Loading branch information
prathikr committed Nov 27, 2024
1 parent ab2bd3e commit ea2dab1
Showing 1 changed file with 23 additions and 18 deletions.
41 changes: 23 additions & 18 deletions src/models.js
Original file line number Diff line number Diff line change
Expand Up @@ -44,10 +44,10 @@ import {
} from './configs.js';

import {
createInferenceSession,
deviceToExecutionProviders,
isONNXProxy,
createInferenceSession,
isONNXTensor,
isONNXProxy,
} from './backends/onnx.js';
import {
DATA_TYPES,
Expand Down Expand Up @@ -75,48 +75,49 @@ import {
} from './utils/constants.js';

import {
ClassifierFreeGuidanceLogitsProcessor,
LogitsProcessorList,
ForcedBOSTokenLogitsProcessor,
ForcedEOSTokenLogitsProcessor,
LogitsProcessorList,
MinLengthLogitsProcessor,
MinNewTokensLengthLogitsProcessor,
NoBadWordsLogitsProcessor,
SuppressTokensAtBeginLogitsProcessor,
WhisperTimeStampLogitsProcessor,
NoRepeatNGramLogitsProcessor,
RepetitionPenaltyLogitsProcessor,
SuppressTokensAtBeginLogitsProcessor,
NoBadWordsLogitsProcessor,
MinLengthLogitsProcessor,
MinNewTokensLengthLogitsProcessor,

TemperatureLogitsWarper,
TopKLogitsWarper,
TopPLogitsWarper,
WhisperTimeStampLogitsProcessor,
ClassifierFreeGuidanceLogitsProcessor,
} from './generation/logits_process.js';

import {
GenerationConfig,
} from './generation/configuration_utils.js';

import { RawImage } from './utils/image.js';
import {
cat,
full,
full_like,
mean,
zeros,
zeros_like,
ones,
ones_like,
full,
full_like,
stack,
std_mean,
Tensor,
zeros,
zeros_like,
} from './utils/tensor.js';
import { RawImage } from './utils/image.js';

import { apis } from './env.js';
import { LogitsSampler } from './generation/logits_sampler.js';
import { EosTokenCriteria, MaxLengthCriteria, StoppingCriteriaList } from './generation/stopping_criteria.js';
import { dynamic_time_warping, max, medianFilter } from './utils/maths.js';
import { EosTokenCriteria, MaxLengthCriteria, StoppingCriteriaList } from './generation/stopping_criteria.js';
import { LogitsSampler } from './generation/logits_sampler.js';
import { apis } from './env.js';

import { whisper_language_to_code } from './models/whisper/common_whisper.js';
import { WhisperGenerationConfig } from './models/whisper/generation_whisper.js';
import { whisper_language_to_code } from './models/whisper/common_whisper.js';

//////////////////////////////////////////////////
// Model types: used internally
Expand Down Expand Up @@ -770,6 +771,10 @@ function multimodality_prepare_inputs_for_generation(self, input_ids, model_inpu
}
}

if (has_past_key_values || !model_inputs.pixel_values) {
model_inputs.pixel_values = full([0, 0, 3, 384, 384], 1.0);
}

if (has_past_key_values) {
const num_img_tokens = 0;
const num_text_tokens = 1;
Expand Down

0 comments on commit ea2dab1

Please sign in to comment.