Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 4 additions & 4 deletions src/BuiltinExtensions/ComfyUIBackend/ComfyUIWebAPI.cs
Original file line number Diff line number Diff line change
Expand Up @@ -266,7 +266,7 @@ public static async Task<JObject> ComfyInstallFeatures(Session session, string f
};

/// <summary>API route to create a TensorRT model.</summary>
public static async Task<JObject> DoTensorRTCreateWS(Session session, WebSocket ws, string model, string aspect, string aspectRange, int optBatch, int maxBatch)
public static async Task<JObject> DoTensorRTCreateWS(Session session, WebSocket ws, string model, string aspect, string aspectRange, int optBatch, int maxBatch, int contextLen = 75)
{
if (ModelsAPI.TryGetRefusalForModel(session, model, out JObject refusal))
{
Expand Down Expand Up @@ -336,7 +336,7 @@ public static async Task<JObject> DoTensorRTCreateWS(Session session, WebSocket
["batch_size_opt"] = optBatch,
["height_opt"] = prefY,
["width_opt"] = prefX,
["context_opt"] = 1,
["context_opt"] = contextLen / 75,
["num_video_frames"] = 25
}
};
Expand All @@ -360,8 +360,8 @@ public static async Task<JObject> DoTensorRTCreateWS(Session session, WebSocket
["width_opt"] = prefX,
["width_max"] = Math.Clamp(maxX, 256, 4096),
["context_min"] = 1,
["context_opt"] = 1,
["context_max"] = 128,
["context_opt"] = contextLen / 75,
["context_max"] = Math.Max(contextLen / 75, 128),
["num_video_frames"] = 25
}
};
Expand Down
1 change: 1 addition & 0 deletions src/Pages/_Generate/GenTabModals.cshtml
Original file line number Diff line number Diff line change
Expand Up @@ -247,6 +247,7 @@
</select>
<br>Preferred Batch Size: <input type="number" class="auto-number" id="tensorrt_batch_size" value="1" min="1" max="64" />
<br>Max Batch Size: <input type="number" class="auto-number" id="tensorrt_max_batch_size" value="4" min="1" max="64" />
<br>CLIP Context Length (tokens): <input type="number" class="auto-number" id="tensorrt_context" value="75" min="75" max="300" />
<div id="tensorrt_create_result_box">
</div>
</div>
Expand Down
4 changes: 3 additions & 1 deletion src/wwwroot/js/genpage/gentab/models.js
Original file line number Diff line number Diff line change
Expand Up @@ -1036,14 +1036,16 @@ function trt_modal_create() {
let rangeSelect = getRequiredElementById('tensorrt_aspect_range');
let batchSize = getRequiredElementById('tensorrt_batch_size');
let maxBatch = getRequiredElementById('tensorrt_max_batch_size');
let contextLen = getRequiredElementById('tensorrt_context');
let createButton = getRequiredElementById('trt_create_button');
let resultBox = getRequiredElementById('tensorrt_create_result_box');
let data = {
'model': modelSelect.value,
'aspect': aspectSelect.value,
'aspectRange': rangeSelect.value,
'optBatch': batchSize.value,
'maxBatch': maxBatch.value
'maxBatch': maxBatch.value,
'contextLen': contextLen.value
};
createButton.disabled = true;
resultBox.innerText = 'Creating TensorRT engine, please wait...';
Expand Down
Loading