Skip to content

Commit

Permalink
Merge branch 'bump-version' of https://github.com/MinishLab/model2vec
Browse files Browse the repository at this point in the history
…into bump-version
  • Loading branch information
Pringled committed Oct 10, 2024
2 parents 231f3a2 + 965025c commit 474d249
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 2 deletions.
9 changes: 8 additions & 1 deletion model2vec/distill/distillation.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@

import numpy as np
from huggingface_hub import model_info
from huggingface_hub.utils._errors import RepositoryNotFoundError
from sklearn.decomposition import PCA
from tokenizers.models import BPE, Unigram
from transformers import AutoModel, AutoTokenizer, PreTrainedModel, PreTrainedTokenizerFast
Expand All @@ -16,6 +15,14 @@
from model2vec.distill.utils import select_optimal_device
from model2vec.model import StaticModel

try:
# For huggingface_hub>=0.25.0
from huggingface_hub.errors import RepositoryNotFoundError
except ImportError:
# For huggingface_hub<0.25.0
from huggingface_hub.utils._errors import RepositoryNotFoundError


logger = logging.getLogger(__name__)


Expand Down
8 changes: 7 additions & 1 deletion tests/test_distillation.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,13 +4,19 @@

import numpy as np
import pytest
from huggingface_hub.utils._errors import RepositoryNotFoundError
from pytest import LogCaptureFixture
from transformers import AutoModel, BertTokenizerFast

from model2vec.distill.distillation import _clean_vocabulary, _post_process_embeddings, distill, distill_from_model
from model2vec.model import StaticModel

try:
# For huggingface_hub>=0.25.0
from huggingface_hub.errors import RepositoryNotFoundError
except ImportError:
# For huggingface_hub<0.25.0
from huggingface_hub.utils._errors import RepositoryNotFoundError

rng = np.random.default_rng()


Expand Down

0 comments on commit 474d249

Please sign in to comment.