sanitizeQuantModelName replaces non-alphanumeric characters with hyphens and lowercases.
(s string)
| 448 | |
| 449 | // sanitizeQuantModelName replaces non-alphanumeric characters with hyphens and lowercases. |
| 450 | func 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. |
| 459 | func (s *QuantizationService) ImportModel(ctx context.Context, userID, jobID string, req schema.QuantizationImportRequest) (string, error) { |