MCPcopy
hub / github.com/mudler/LocalAI / sanitizeQuantModelName

Function sanitizeQuantModelName

core/services/quantization/service.go:450–456  ·  view source on GitHub ↗

sanitizeQuantModelName replaces non-alphanumeric characters with hyphens and lowercases.

(s string)

Source from the content-addressed store, hash-verified

448
449// sanitizeQuantModelName replaces non-alphanumeric characters with hyphens and lowercases.
450func sanitizeQuantModelName(s string) string {
451 re := regexp.MustCompile(`[^a-zA-Z0-9\-]`)
452 s = re.ReplaceAllString(s, "-")
453 s = regexp.MustCompile(`-+`).ReplaceAllString(s, "-")
454 s = strings.Trim(s, "-")
455 return strings.ToLower(s)
456}
457
458// ImportModel imports a quantized model into LocalAI asynchronously.
459func (s *QuantizationService) ImportModel(ctx context.Context, userID, jobID string, req schema.QuantizationImportRequest) (string, error) {

Callers 1

ImportModelMethod · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected