Skip to content

Commit

Permalink
Fix edge case on Intel where max_length > context_length due to the +…
Browse files Browse the repository at this point in the history
…1 adjustment
  • Loading branch information
PatriceVignola committed Apr 23, 2024
1 parent c97566e commit b1691d7
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion src/generators.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,11 @@ Generator::Generator(const Model& model, const GeneratorParams& params) : model_
#if USE_DML
// Temporary fix to work around overflows for caches that are multiples of 4 on Intel hardware in DirectML
if (model.device_type_ == DeviceType::DML && model.IsIntelDevice() && params.search.max_length % 4 == 0) {
++const_cast<GeneratorParams&>(params).search.max_length;
if (params.search.max_length == model.config_->model.context_length) {
--const_cast<GeneratorParams&>(params).search.max_length;
} else {
++const_cast<GeneratorParams&>(params).search.max_length;
}
}
#endif

Expand Down

0 comments on commit b1691d7

Please sign in to comment.