Spaces:
Runtime error
Runtime error
Upload 4 files
Browse filesFiles changed (3)
4 unmodified lines56789101112131415304 unmodified lines3203213223233243253264 unmodified linesfrom typing import Dict, Optional, Unionimport torchimport torch.nn.functional as Ffrom .modules.layers import LstmSeq2SeqEncoderfrom .modules.base import InstructBasefrom .modules.evaluator import Evaluator, greedy_searchfrom .modules.span_rep import SpanRepLayerfrom .modules.token_rep import TokenRepLayerfrom torch import nnfrom torch.nn.utils.rnn import pad_sequencefrom huggingface_hub import PyTorchModelHubMixin, hf_hub_download304 unmodified linesreturn model# 2. Newer format: Use "pytorch_model.bin" and "gliner_config.json"from .train import load_config_as_namespacemodel_file = Path(model_id) / "pytorch_model.bin"if not model_file.exists():4 unmodified lines56789101112131415304 unmodified lines3203213223233243253264 unmodified linesfrom typing import Dict, Optional, Unionimport torchimport torch.nn.functional as Ffrom modules.layers import LstmSeq2SeqEncoderfrom modules.base import InstructBasefrom modules.evaluator import Evaluator, greedy_searchfrom modules.span_rep import SpanRepLayerfrom modules.token_rep import TokenRepLayerfrom torch import nnfrom torch.nn.utils.rnn import pad_sequencefrom huggingface_hub import PyTorchModelHubMixin, hf_hub_download304 unmodified linesreturn model# 2. Newer format: Use "pytorch_model.bin" and "gliner_config.json"from train import load_config_as_namespacemodel_file = Path(model_id) / "pytorch_model.bin"if not model_file.exists():
12345import torchfrom .model import GLiNERdef save_model(current_model, path):12345import torchfrom model import GLiNERdef save_model(current_model, path):
6 unmodified lines7891011121314156 unmodified linesfrom transformers import get_cosine_schedule_with_warmup# from model_nested import NerFilteredSemiCRFfrom .model import GLiNERfrom .modules.run_evaluation import get_for_all_path, sample_train_datafrom .save_load import save_model, load_modelimport json6 unmodified lines7891011121314156 unmodified linesfrom transformers import get_cosine_schedule_with_warmup# from model_nested import NerFilteredSemiCRFfrom model import GLiNERfrom modules.run_evaluation import get_for_all_path, sample_train_datafrom save_load import save_model, load_modelimport json
backup/model.py+6-6
backup/save_load.py+1-1
backup/train.py+3-3