Skip to content

Commit b7299a1

Browse files
committed
remove unnecessary field and helper
1 parent bc78095 commit b7299a1

File tree

4 files changed

+3
-75
lines changed

4 files changed

+3
-75
lines changed

cmd/cli/desktop/desktop.go

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -105,7 +105,7 @@ func (c *Client) Status() Status {
105105
}
106106
}
107107

108-
func (c *Client) Pull(model string, ignoreRuntimeMemoryCheck bool, printer standalone.StatusPrinter) (string, bool, error) {
108+
func (c *Client) Pull(model string, printer standalone.StatusPrinter) (string, bool, error) {
109109
model = normalizeHuggingFaceModelName(model)
110110

111111
// Check if this is a Hugging Face model and if HF_TOKEN is set
@@ -116,9 +116,8 @@ func (c *Client) Pull(model string, ignoreRuntimeMemoryCheck bool, printer stand
116116

117117
return c.withRetries("download", 3, printer, func(attempt int) (string, bool, error, bool) {
118118
jsonData, err := json.Marshal(dmrm.ModelCreateRequest{
119-
From: model,
120-
IgnoreRuntimeMemoryCheck: ignoreRuntimeMemoryCheck,
121-
BearerToken: hfToken,
119+
From: model,
120+
BearerToken: hfToken,
122121
})
123122
if err != nil {
124123
// Marshaling errors are not retryable

pkg/inference/models/api.go

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -14,9 +14,6 @@ import (
1414
type ModelCreateRequest struct {
1515
// From is the name of the model to pull.
1616
From string `json:"from"`
17-
// IgnoreRuntimeMemoryCheck indicates whether the server should check if it has sufficient
18-
// memory to run the given model (assuming default configuration).
19-
IgnoreRuntimeMemoryCheck bool `json:"ignore-runtime-memory-check,omitempty"`
2017
// BearerToken is an optional bearer token for authentication.
2118
BearerToken string `json:"bearer-token,omitempty"`
2219
}

pkg/inference/scheduling/loader.go

Lines changed: 0 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -194,15 +194,6 @@ func (l *loader) broadcast() {
194194
}
195195
}
196196

197-
// formatMemorySize formats a memory size in bytes as a string.
198-
// Values of 0 or 1 are treated as sentinel values for "unknown" memory size.
199-
func formatMemorySize(bytes uint64) string {
200-
if bytes <= 1 {
201-
return "unknown"
202-
}
203-
return fmt.Sprintf("%d MB", bytes/1024/1024)
204-
}
205-
206197
// freeRunnerSlot frees a runner slot.
207198
// The caller must hold the loader lock.
208199
func (l *loader) freeRunnerSlot(slot int, key runnerKey) {

pkg/inference/scheduling/loader_test.go

Lines changed: 0 additions & 59 deletions
Original file line numberDiff line numberDiff line change
@@ -125,65 +125,6 @@ func createAliveTerminableMockRunner(log *logrus.Entry, backend inference.Backen
125125
}
126126
}
127127

128-
// TestFormatMemorySize tests the formatMemorySize helper function
129-
func TestFormatMemorySize(t *testing.T) {
130-
tests := []struct {
131-
name string
132-
bytes uint64
133-
expected string
134-
}{
135-
{
136-
name: "sentinel value 0 is unknown",
137-
bytes: 0,
138-
expected: "unknown",
139-
},
140-
{
141-
name: "sentinel value 1 is unknown",
142-
bytes: 1,
143-
expected: "unknown",
144-
},
145-
{
146-
name: "2 bytes is still unknown (edge case)",
147-
bytes: 2,
148-
expected: "0 MB",
149-
},
150-
{
151-
name: "1 MB",
152-
bytes: 1024 * 1024,
153-
expected: "1 MB",
154-
},
155-
{
156-
name: "512 MB",
157-
bytes: 512 * 1024 * 1024,
158-
expected: "512 MB",
159-
},
160-
{
161-
name: "1 GB",
162-
bytes: 1024 * 1024 * 1024,
163-
expected: "1024 MB",
164-
},
165-
{
166-
name: "8 GB",
167-
bytes: 8 * 1024 * 1024 * 1024,
168-
expected: "8192 MB",
169-
},
170-
{
171-
name: "fractional MB rounds down",
172-
bytes: 1024*1024 + 512*1024, // 1.5 MB
173-
expected: "1 MB",
174-
},
175-
}
176-
177-
for _, tt := range tests {
178-
t.Run(tt.name, func(t *testing.T) {
179-
result := formatMemorySize(tt.bytes)
180-
if result != tt.expected {
181-
t.Errorf("formatMemorySize(%d) = %q, want %q", tt.bytes, result, tt.expected)
182-
}
183-
})
184-
}
185-
}
186-
187128
// TestMakeRunnerKey tests that runner keys are created correctly
188129
func TestMakeRunnerKey(t *testing.T) {
189130
tests := []struct {

0 commit comments

Comments
 (0)