@@ -640,7 +640,17 @@ class LlamaData {
640
640
return 1 ;
641
641
}
642
642
643
- model_ = model_.substr (pos + 3 ); // Skip past "://"
643
+ model_ = model_.substr (pos + sizeof (" ://" ) - 1 ); // Skip past "://"
644
+ return 0 ;
645
+ }
646
+
647
+ int remove_hf_co (std::string & model_) {
648
+ const std::string::size_type pos = model_.find (" hf.co/" );
649
+ if (pos == std::string::npos) {
650
+ return 1 ;
651
+ }
652
+
653
+ model_ = model_.substr (pos + sizeof (" hf.co/" ) - 1 ); // Skip past "hf.co/"
644
654
return 0 ;
645
655
}
646
656
@@ -658,11 +668,14 @@ class LlamaData {
658
668
if (string_starts_with (model_, " hf://" ) || string_starts_with (model_, " huggingface://" )) {
659
669
remove_proto (model_);
660
670
ret = huggingface_dl (model_, headers, bn);
671
+ } else if (string_starts_with (model_, " hf.co/" )) {
672
+ remove_hf_co (model_);
673
+ ret = huggingface_dl (model_, headers, bn);
661
674
} else if (string_starts_with (model_, " ollama://" )) {
662
675
remove_proto (model_);
663
676
ret = ollama_dl (model_, headers, bn);
664
677
} else if (string_starts_with (model_, " https://" )) {
665
- download (model_, headers, bn, true );
678
+ ret = download (model_, headers, bn, true );
666
679
} else {
667
680
ret = ollama_dl (model_, headers, bn);
668
681
}
0 commit comments