Skip to content

Fix Python GPU offload config example #70

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
May 27, 2025
Merged
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
20 changes: 14 additions & 6 deletions 1_python/1_llm-prediction/parameters.md
Original file line number Diff line number Diff line change
Expand Up @@ -40,13 +40,13 @@ definition.

# Load Parameters

Set load-time parameters such as `contextLength`, `gpuOffload`, and more.
Set load-time parameters such as the context length, GPU offload ratio, and more.

### Set Load Parameters with `.model()`

The `.model()` retrieves a handle to a model that has already been loaded, or loads a new one on demand (JIT loading).

**Note**: if the model is already loaded, the configuration will be **ignored**.
**Note**: if the model is already loaded, the given configuration will be **ignored**.

```lms_code_snippet
variants:
Expand All @@ -56,7 +56,9 @@ The `.model()` retrieves a handle to a model that has already been loaded, or lo
import lmstudio as lms
model = lms.llm("qwen2.5-7b-instruct", config={
"contextLength": 8192,
"gpuOffload": 0.5,
"gpu": {
"ratio": 0.5,
}
})

"Python (scoped resource API)":
Expand All @@ -68,7 +70,9 @@ The `.model()` retrieves a handle to a model that has already been loaded, or lo
"qwen2.5-7b-instruct",
config={
"contextLength": 8192,
"gpuOffload": 0.5,
"gpu": {
"ratio": 0.5,
}
}
)

Expand All @@ -89,7 +93,9 @@ The `.load_new_instance()` method creates a new model instance and loads it with
client = lms.get_default_client()
model = client.llm.load_new_instance("qwen2.5-7b-instruct", config={
"contextLength": 8192,
"gpuOffload": 0.5,
"gpu": {
"ratio": 0.5,
}
})

"Python (scoped resource API)":
Expand All @@ -101,7 +107,9 @@ The `.load_new_instance()` method creates a new model instance and loads it with
"qwen2.5-7b-instruct",
config={
"contextLength": 8192,
"gpuOffload": 0.5,
"gpu": {
"ratio": 0.5,
}
}
)

Expand Down
2 changes: 1 addition & 1 deletion 2_typescript/2_llm-prediction/parameters.md
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ Another useful inference-time configuration parameter is [`structured`](<(./stru

# Load Parameters

Set load-time parameters such as `contextLength`, `gpuOffload`, and more.
Set load-time parameters such as the context length, GPU offload ratio, and more.

### Set Load Parameters with `.model()`

Expand Down