-
Notifications
You must be signed in to change notification settings - Fork 9
Expand file tree
/
Copy pathtutorial-ai.html
More file actions
427 lines (358 loc) · 21.3 KB
/
Copy pathtutorial-ai.html
File metadata and controls
427 lines (358 loc) · 21.3 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
<!DOCTYPE html>
<html lang="en" data-theme="dark">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Tutorial: AI Integration - HarbourBuilder Documentation</title>
<link rel="stylesheet" href="../assets/css/docs.css">
<script src="https://cdn.jsdelivr.net/npm/mermaid@10/dist/mermaid.min.js"></script>
<script>mermaid.initialize({startOnLoad:true, theme:'dark'});</script>
</head>
<body>
<!-- Header -->
<div class="header">
<a class="logo" href="index.html">
<span>HB</span> HarbourBuilder Docs
</a>
<nav>
<input class="search-box" type="text" placeholder="Search docs..." oninput="doSearch(this.value)">
<button class="lang-btn active">EN</button>
<a class="lang-btn" href="../es/index.html">ES</a>
<a class="lang-btn" href="../pt/index.html">PT</a>
<button class="theme-toggle" onclick="toggleTheme()">☼</button>
</nav>
</div>
<!-- Sidebar -->
<div class="sidebar">
<div class="nav-section">
<h3 id="getting-started">Getting Started</h3>
<a href="index.html">Overview</a>
<a href="quickstart.html">Quick Start</a>
<a href="installation.html">Installation</a>
<a href="architecture.html">Architecture</a>
</div>
<div class="nav-section">
<h3 id="component-palette">Component Palette</h3>
<a href="controls-standard.html">Standard (11)</a>
<a href="controls-additional.html">Additional (10)</a>
<a href="controls-native.html">Win32 / Cocoa / GTK3 (9)</a>
<a href="controls-system.html">System (2)</a>
<a href="controls-dialogs.html">Dialogs (6)</a>
<a href="controls-database.html">Data Access (9)</a>
<a href="controls-internet.html">Internet (9)</a>
<a href="controls-threading.html">Threading (8)</a>
<a href="controls-ai.html">AI (7)</a>
<a href="controls-erp.html">ERP / Business (12)</a>
</div>
<div class="nav-section">
<h3 id="ide-features">IDE Features</h3>
<a href="form-designer.html">Form Designer</a>
<a href="object-inspector.html">Object Inspector</a>
<a href="code-editor.html">Code Editor</a>
<a href="two-way-tools.html">Two-Way Tools</a>
<a href="debugger.html">Debugger</a>
<a href="ai-assistant.html">AI Assistant</a>
<a href="build-run.html">Build & Run</a>
</div>
<div class="nav-section">
<h3 id="tutorials">Tutorials</h3>
<a href="tutorial-hello.html">Hello World</a>
<a href="tutorial-forms.html">Working with Forms</a>
<a href="tutorial-events.html">Event Handling</a>
<a href="tutorial-database.html">Database CRUD</a>
<a href="tutorial-webserver.html">Web Server</a>
<a href="tutorial-ai.html" class="active">AI Integration</a>
<a href="tutorial-transformer.html">Transformer</a>
</div>
<div class="nav-section">
<h3 id="reference">Reference</h3>
<a href="ref-properties.html">Properties A-Z</a>
<a href="ref-events.html">Events A-Z</a>
<a href="ref-methods.html">Methods A-Z</a>
<a href="ref-commands.html">xBase Commands</a>
<a href="ref-functions.html">HB_FUNC Bridge</a>
</div>
<div class="nav-section">
<h3 id="platforms">Platforms</h3>
<a href="platform-windows.html">Windows</a>
<a href="platform-macos.html">macOS</a>
<a href="platform-linux.html">Linux</a>
<a href="platform-android.html">Android <span class="badge new">New</span></a>
<a href="platform-ios.html">iOS <span class="badge planned">Planned</span></a>
</div>
</div>
<!-- Content -->
<div class="content">
<div class="breadcrumbs">
<a href="index.html">Docs</a> <span>/</span> Tutorials <span>/</span> AI Integration
</div>
<h1>Tutorial: AI Integration</h1>
<p>HarbourBuilder provides two complementary AI components: <strong>TOllama</strong> for connecting to local
large language models via the Ollama service, and <strong>TTransformer</strong> for loading and running
transformer model weights directly in-process. This tutorial covers both approaches with
complete working examples.</p>
<h2 id="part-1-tollama-chat-with-a-local-llm">Part 1: TOllama — Chat with a Local LLM</h2>
<h3 id="step-1-prerequisites">Step 1: Prerequisites</h3>
<ol>
<li>Install <a href="https://ollama.ai" target="_blank">Ollama</a> on your machine.</li>
<li>Pull a model: run <code>ollama pull llama3</code> in your terminal.</li>
<li>Ensure Ollama is running (it listens on <code>http://localhost:11434</code> by default).</li>
</ol>
<div class="info-box tip">
<strong>No API keys required</strong>
<p>TOllama connects to a locally running Ollama instance. All inference happens on your machine
— no cloud services, no API keys, no data leaves your computer.</p>
</div>
<h3 id="step-2-create-the-chat-ui">Step 2: Create the Chat UI</h3>
<p>Build a form with a Memo for the conversation history, a TextBox for user input, and a Send button.</p>
<pre><span class="pp">#include</span> <span class="st">"hbbuilder.ch"</span>
<span class="kw">function</span> <span class="fn">Main</span>()
<span class="kw">local</span> oForm, oMemo, oGetPrompt, oBtnSend, oOllama
<span class="kw">local</span> cPrompt := <span class="st">""</span>
<span class="cm">// --- Connect to Ollama ---</span>
<span class="cmd">DEFINE OLLAMA</span> oOllama ;
<span class="cmd">URL</span> <span class="st">"http://localhost:11434"</span> ;
<span class="cmd">MODEL</span> <span class="st">"llama3"</span>
<span class="cm">// --- Build the UI ---</span>
<span class="cmd">DEFINE FORM</span> oForm <span class="cmd">TITLE</span> <span class="st">"AI Chat"</span> ;
<span class="cmd">SIZE</span> <span class="nb">700</span>, <span class="nb">550</span> <span class="cmd">FONT</span> <span class="st">"Segoe UI"</span>, <span class="nb">10</span>
@ <span class="nb">10</span>, <span class="nb">10</span> <span class="cmd">MEMO</span> oMemo ;
<span class="cmd">OF</span> oForm <span class="cmd">SIZE</span> <span class="nb">660</span>, <span class="nb">420</span> ;
<span class="cmd">READONLY</span>
@ <span class="nb">440</span>, <span class="nb">10</span> <span class="cmd">GET</span> oGetPrompt <span class="cmd">VAR</span> cPrompt ;
<span class="cmd">OF</span> oForm <span class="cmd">SIZE</span> <span class="nb">540</span>, <span class="nb">28</span>
@ <span class="nb">440</span>, <span class="nb">560</span> <span class="cmd">BUTTON</span> oBtnSend <span class="cmd">PROMPT</span> <span class="st">"Send"</span> ;
<span class="cmd">OF</span> oForm <span class="cmd">SIZE</span> <span class="nb">110</span>, <span class="nb">32</span> ;
<span class="cmd">ACTION</span> <span class="fn">SendMessage</span>( oOllama, oMemo, oGetPrompt )
<span class="cmd">ACTIVATE FORM</span> oForm <span class="cmd">CENTERED</span>
<span class="kw">return</span> <span class="kw">nil</span></pre>
<h3 id="step-3-send-a-message-and-get-a-response">Step 3: Send a Message and Get a Response</h3>
<p>Use <code>oOllama:Chat()</code> for a simple request/response, or <code>oOllama:ChatStream()</code>
to receive the response token by token as it is generated.</p>
<p><strong>Simple (blocking) chat completion:</strong></p>
<pre><span class="kw">static function</span> <span class="fn">SendMessage</span>( oOllama, oMemo, oGetPrompt )
<span class="kw">local</span> cPrompt := oGetPrompt:<span class="fn">GetValue</span>()
<span class="kw">local</span> cResponse
<span class="kw">if</span> Empty( cPrompt )
<span class="kw">return</span> <span class="kw">nil</span>
<span class="kw">endif</span>
<span class="cm">// Show user message</span>
oMemo:<span class="fn">Append</span>( <span class="st">"You: "</span> + cPrompt + Chr( <span class="nb">13</span> ) + Chr( <span class="nb">10</span> ) )
oGetPrompt:<span class="fn">SetValue</span>( <span class="st">""</span> )
<span class="cm">// Get AI response</span>
cResponse := oOllama:<span class="fn">Chat</span>( cPrompt )
oMemo:<span class="fn">Append</span>( <span class="st">"AI: "</span> + cResponse + Chr( <span class="nb">13</span> ) + Chr( <span class="nb">10</span> ) + Chr( <span class="nb">13</span> ) + Chr( <span class="nb">10</span> ) )
<span class="kw">return</span> <span class="kw">nil</span></pre>
<h3 id="step-4-streaming-response-to-a-memo">Step 4: Streaming Response to a Memo</h3>
<p>For a better user experience, stream the response so tokens appear in the Memo as they are
generated — just like a real chat interface.</p>
<pre><span class="kw">static function</span> <span class="fn">SendMessageStream</span>( oOllama, oMemo, oGetPrompt )
<span class="kw">local</span> cPrompt := oGetPrompt:<span class="fn">GetValue</span>()
<span class="kw">if</span> Empty( cPrompt )
<span class="kw">return</span> <span class="kw">nil</span>
<span class="kw">endif</span>
oMemo:<span class="fn">Append</span>( <span class="st">"You: "</span> + cPrompt + Chr( <span class="nb">13</span> ) + Chr( <span class="nb">10</span> ) )
oMemo:<span class="fn">Append</span>( <span class="st">"AI: "</span> )
oGetPrompt:<span class="fn">SetValue</span>( <span class="st">""</span> )
<span class="cm">// Stream tokens one by one into the Memo</span>
oOllama:<span class="fn">ChatStream</span>( cPrompt, { |cToken| oMemo:<span class="fn">Append</span>( cToken ) } )
oMemo:<span class="fn">Append</span>( Chr( <span class="nb">13</span> ) + Chr( <span class="nb">10</span> ) + Chr( <span class="nb">13</span> ) + Chr( <span class="nb">10</span> ) )
<span class="kw">return</span> <span class="kw">nil</span></pre>
<div class="info-box tip">
<strong>Conversation history</strong>
<p>TOllama maintains a conversation history internally. Each call to <code>Chat()</code> or
<code>ChatStream()</code> includes previous messages as context. Call <code>oOllama:ClearHistory()</code>
to start a fresh conversation.</p>
</div>
<h3 id="step-5-tollama-properties-and-methods">Step 5: TOllama Properties and Methods</h3>
<table style="width:100%; border-collapse:collapse; margin:1em 0;">
<tr style="border-bottom:1px solid #444;">
<th style="text-align:left; padding:8px;">Member</th>
<th style="text-align:left; padding:8px;">Type</th>
<th style="text-align:left; padding:8px;">Description</th>
</tr>
<tr style="border-bottom:1px solid #333;">
<td style="padding:8px;"><code>cUrl</code></td>
<td style="padding:8px;">Property</td>
<td style="padding:8px;">Ollama server URL (default <code>"http://localhost:11434"</code>).</td>
</tr>
<tr style="border-bottom:1px solid #333;">
<td style="padding:8px;"><code>cModel</code></td>
<td style="padding:8px;">Property</td>
<td style="padding:8px;">Model name (e.g. <code>"llama3"</code>, <code>"mistral"</code>, <code>"codellama"</code>).</td>
</tr>
<tr style="border-bottom:1px solid #333;">
<td style="padding:8px;"><code>nTemperature</code></td>
<td style="padding:8px;">Property</td>
<td style="padding:8px;">Sampling temperature (0.0 – 2.0, default <code>0.7</code>).</td>
</tr>
<tr style="border-bottom:1px solid #333;">
<td style="padding:8px;"><code>Chat( cPrompt )</code></td>
<td style="padding:8px;">Method</td>
<td style="padding:8px;">Send a prompt and return the full response as a string.</td>
</tr>
<tr style="border-bottom:1px solid #333;">
<td style="padding:8px;"><code>ChatStream( cPrompt, bCallback )</code></td>
<td style="padding:8px;">Method</td>
<td style="padding:8px;">Stream the response, calling <code>bCallback</code> with each token.</td>
</tr>
<tr style="border-bottom:1px solid #333;">
<td style="padding:8px;"><code>SetSystem( cText )</code></td>
<td style="padding:8px;">Method</td>
<td style="padding:8px;">Set the system prompt that guides the model's behavior.</td>
</tr>
<tr>
<td style="padding:8px;"><code>ClearHistory()</code></td>
<td style="padding:8px;">Method</td>
<td style="padding:8px;">Reset the conversation history.</td>
</tr>
</table>
<hr style="border-color:#333; margin:2em 0;">
<h2 id="part-2-ttransformer-in-process-inference">Part 2: TTransformer — In-Process Inference</h2>
<p>For scenarios where you need to run a model without an external service, HarbourBuilder provides
<strong>TTransformer</strong>. This component loads model weights (GGUF format) directly into your application's
memory and runs inference using the CPU (or GPU if available).</p>
<h3 id="step-1-obtain-a-model-file">Step 1: Obtain a Model File</h3>
<ol>
<li>Download a GGUF model file (e.g. <code>tinyllama-1.1b-chat.Q4_K_M.gguf</code> from Hugging Face).</li>
<li>Place it in your project folder or a known path.</li>
</ol>
<div class="info-box tip">
<strong>Model size matters</strong>
<p>Smaller quantized models (Q4_K_M, Q5_K_M) run well on most hardware. A 1B–3B parameter model
with Q4 quantization needs only 1–2 GB of RAM. Larger models require more memory and a GPU.</p>
</div>
<h3 id="step-2-load-the-model">Step 2: Load the Model</h3>
<pre><span class="pp">#include</span> <span class="st">"hbbuilder.ch"</span>
<span class="kw">function</span> <span class="fn">Main</span>()
<span class="kw">local</span> oForm, oMemo, oGetPrompt, oBtnRun, oTransformer
<span class="cm">// --- Load the transformer model ---</span>
<span class="cmd">DEFINE TRANSFORMER</span> oTransformer ;
<span class="cmd">MODEL</span> <span class="st">"models/tinyllama-1.1b-chat.Q4_K_M.gguf"</span> ;
<span class="cmd">CONTEXT</span> <span class="nb">2048</span> ;
<span class="cmd">GPU_LAYERS</span> <span class="nb">0</span> <span class="cm">// Set > 0 to offload layers to GPU</span>
<span class="kw">if</span> .not. oTransformer:<span class="fn">lLoaded</span>
MsgAlert( <span class="st">"Failed to load model: "</span> + oTransformer:<span class="fn">cError</span> )
<span class="kw">return</span> <span class="kw">nil</span>
<span class="kw">endif</span>
<span class="cm">// --- Build the UI ---</span>
<span class="cmd">DEFINE FORM</span> oForm <span class="cmd">TITLE</span> <span class="st">"TTransformer Demo"</span> ;
<span class="cmd">SIZE</span> <span class="nb">700</span>, <span class="nb">550</span> <span class="cmd">FONT</span> <span class="st">"Segoe UI"</span>, <span class="nb">10</span>
@ <span class="nb">10</span>, <span class="nb">10</span> <span class="cmd">MEMO</span> oMemo ;
<span class="cmd">OF</span> oForm <span class="cmd">SIZE</span> <span class="nb">660</span>, <span class="nb">420</span> ;
<span class="cmd">READONLY</span>
@ <span class="nb">440</span>, <span class="nb">10</span> <span class="cmd">GET</span> oGetPrompt <span class="cmd">VAR</span> cPrompt ;
<span class="cmd">OF</span> oForm <span class="cmd">SIZE</span> <span class="nb">540</span>, <span class="nb">28</span>
@ <span class="nb">440</span>, <span class="nb">560</span> <span class="cmd">BUTTON</span> oBtnRun <span class="cmd">PROMPT</span> <span class="st">"Run"</span> ;
<span class="cmd">OF</span> oForm <span class="cmd">SIZE</span> <span class="nb">110</span>, <span class="nb">32</span> ;
<span class="cmd">ACTION</span> <span class="fn">RunInference</span>( oTransformer, oMemo, oGetPrompt )
<span class="cmd">ACTIVATE FORM</span> oForm <span class="cmd">CENTERED</span>
<span class="kw">return</span> <span class="kw">nil</span></pre>
<h3 id="step-3-run-inference">Step 3: Run Inference</h3>
<p>Use <code>Generate()</code> for a full response or <code>GenerateStream()</code> to stream tokens
into a Memo control as they are produced.</p>
<pre><span class="kw">static function</span> <span class="fn">RunInference</span>( oTransformer, oMemo, oGetPrompt )
<span class="kw">local</span> cPrompt := oGetPrompt:<span class="fn">GetValue</span>()
<span class="kw">if</span> Empty( cPrompt )
<span class="kw">return</span> <span class="kw">nil</span>
<span class="kw">endif</span>
oMemo:<span class="fn">Append</span>( <span class="st">"Prompt: "</span> + cPrompt + Chr( <span class="nb">13</span> ) + Chr( <span class="nb">10</span> ) )
oMemo:<span class="fn">Append</span>( <span class="st">"Response: "</span> )
oGetPrompt:<span class="fn">SetValue</span>( <span class="st">""</span> )
<span class="cm">// Stream output token by token</span>
oTransformer:<span class="fn">GenerateStream</span>( cPrompt, ;
{ |cToken| oMemo:<span class="fn">Append</span>( cToken ) }, ; <span class="cm">// on each token</span>
<span class="nb">256</span> ) <span class="cm">// max tokens</span>
oMemo:<span class="fn">Append</span>( Chr( <span class="nb">13</span> ) + Chr( <span class="nb">10</span> ) + Chr( <span class="nb">13</span> ) + Chr( <span class="nb">10</span> ) )
<span class="kw">return</span> <span class="kw">nil</span></pre>
<h3 id="step-4-ttransformer-properties-and-methods">Step 4: TTransformer Properties and Methods</h3>
<table style="width:100%; border-collapse:collapse; margin:1em 0;">
<tr style="border-bottom:1px solid #444;">
<th style="text-align:left; padding:8px;">Member</th>
<th style="text-align:left; padding:8px;">Type</th>
<th style="text-align:left; padding:8px;">Description</th>
</tr>
<tr style="border-bottom:1px solid #333;">
<td style="padding:8px;"><code>cModel</code></td>
<td style="padding:8px;">Property</td>
<td style="padding:8px;">Path to the GGUF model file.</td>
</tr>
<tr style="border-bottom:1px solid #333;">
<td style="padding:8px;"><code>nContext</code></td>
<td style="padding:8px;">Property</td>
<td style="padding:8px;">Context window size in tokens (default <code>2048</code>).</td>
</tr>
<tr style="border-bottom:1px solid #333;">
<td style="padding:8px;"><code>nGpuLayers</code></td>
<td style="padding:8px;">Property</td>
<td style="padding:8px;">Number of layers to offload to GPU (0 = CPU only).</td>
</tr>
<tr style="border-bottom:1px solid #333;">
<td style="padding:8px;"><code>lLoaded</code></td>
<td style="padding:8px;">Property</td>
<td style="padding:8px;"><code>.T.</code> if the model loaded successfully.</td>
</tr>
<tr style="border-bottom:1px solid #333;">
<td style="padding:8px;"><code>Generate( cPrompt, nMaxTokens )</code></td>
<td style="padding:8px;">Method</td>
<td style="padding:8px;">Run inference and return the full output string.</td>
</tr>
<tr style="border-bottom:1px solid #333;">
<td style="padding:8px;"><code>GenerateStream( cPrompt, bCallback, nMaxTokens )</code></td>
<td style="padding:8px;">Method</td>
<td style="padding:8px;">Stream output tokens via callback.</td>
</tr>
<tr>
<td style="padding:8px;"><code>Tokenize( cText )</code></td>
<td style="padding:8px;">Method</td>
<td style="padding:8px;">Return an array of token IDs for the given text.</td>
</tr>
</table>
<h2 id="when-to-use-which">When to Use Which</h2>
<div class="mermaid">
graph LR
A{"Need AI?"} -->|"Full LLM chat<br/>conversation history"| B["TOllama<br/>Ollama service"]
A -->|"Embedded inference<br/>no external deps"| C["TTransformer<br/>GGUF in-process"]
B --> D["Pros: easy setup<br/>many models<br/>hot-swap models"]
C --> E["Pros: no server needed<br/>single executable<br/>offline capable"]
style A fill:#d2a8ff,stroke:#bc8cff,color:#0d1117
style B fill:#58a6ff,stroke:#388bfd,color:#0d1117
style C fill:#3fb950,stroke:#2ea043,color:#0d1117
style D fill:#58a6ff,stroke:#388bfd,color:#0d1117
style E fill:#3fb950,stroke:#2ea043,color:#0d1117
</div>
<div class="info-box tip">
<strong>Combine both approaches</strong>
<p>You can use TOllama for heavyweight chat tasks and TTransformer for lightweight, fast
classification or embedding tasks — both in the same application.</p>
</div>
<div class="info-box tip">
<strong>Explore more</strong>
<p>See the <a href="controls-ai.html">AI Component Palette</a> reference for the full list of AI
components including TEmbedding, TRAGEngine, and TSpeechToText.</p>
</div>
<!-- Table of Contents Rail -->
<div class="toc-rail">
<h4>On This Page</h4>
<a href="#getting-started" class="toc-h3 active">Getting Started</a>
<a href="#component-palette" class="toc-h3">Component Palette</a>
<a href="#ide-features" class="toc-h3">IDE Features</a>
<a href="#tutorials" class="toc-h3">Tutorials</a>
<a href="#reference" class="toc-h3">Reference</a>
<a href="#platforms" class="toc-h3">Platforms</a>
<a href="#part-1-tollama-chat-with-a-local-llm" class="toc-h2">Part 1: TOllama &mdash; Chat with a Local LLM</a>
<a href="#step-1-prerequisites" class="toc-h3">Step 1: Prerequisites</a>
<a href="#step-2-create-the-chat-ui" class="toc-h3">Step 2: Create the Chat UI</a>
<a href="#step-3-send-a-message-and-get-a-response" class="toc-h3">Step 3: Send a Message and Get a Response</a>
<a href="#step-4-streaming-response-to-a-memo" class="toc-h3">Step 4: Streaming Response to a Memo</a>
<a href="#step-5-tollama-properties-and-methods" class="toc-h3">Step 5: TOllama Properties and Methods</a>
<a href="#part-2-ttransformer-in-process-inference" class="toc-h2">Part 2: TTransformer &mdash; In-Process Inference</a>
<a href="#step-1-obtain-a-model-file" class="toc-h3">Step 1: Obtain a Model File</a>
<a href="#step-2-load-the-model" class="toc-h3">Step 2: Load the Model</a>
<a href="#step-3-run-inference" class="toc-h3">Step 3: Run Inference</a>
<a href="#step-4-ttransformer-properties-and-methods" class="toc-h3">Step 4: TTransformer Properties and Methods</a>
<a href="#when-to-use-which" class="toc-h2">When to Use Which</a>
</div>
<script src="../assets/js/docs.js"></script>
</body>
</html>