Spaces:
				
			
			
	
			
			
		Runtime error
		
	
	
	
			
			
	
	
	
	
		
		
		Runtime error
		
	Upload 4 files
Browse files- backup/model.py +6 -6
- backup/train.py +2 -2
    	
        backup/model.py
    CHANGED
    
    | @@ -5,11 +5,11 @@ import re | |
| 5 | 
             
            from typing import Dict, Optional, Union
         | 
| 6 | 
             
            import torch
         | 
| 7 | 
             
            import torch.nn.functional as F
         | 
| 8 | 
            -
            from modules.layers import LstmSeq2SeqEncoder
         | 
| 9 | 
            -
            from modules.base import InstructBase
         | 
| 10 | 
            -
            from modules.evaluator import Evaluator, greedy_search
         | 
| 11 | 
            -
            from modules.span_rep import SpanRepLayer
         | 
| 12 | 
            -
            from modules.token_rep import TokenRepLayer
         | 
| 13 | 
             
            from torch import nn
         | 
| 14 | 
             
            from torch.nn.utils.rnn import pad_sequence
         | 
| 15 | 
             
            from huggingface_hub import PyTorchModelHubMixin, hf_hub_download
         | 
| @@ -320,7 +320,7 @@ class GLiNER(InstructBase, PyTorchModelHubMixin): | |
| 320 | 
             
                        return model
         | 
| 321 |  | 
| 322 | 
             
                    # 2. Newer format: Use "pytorch_model.bin" and "gliner_config.json"
         | 
| 323 | 
            -
                    from train import load_config_as_namespace
         | 
| 324 |  | 
| 325 | 
             
                    model_file = Path(model_id) / "pytorch_model.bin"
         | 
| 326 | 
             
                    if not model_file.exists():
         | 
|  | |
| 5 | 
             
            from typing import Dict, Optional, Union
         | 
| 6 | 
             
            import torch
         | 
| 7 | 
             
            import torch.nn.functional as F
         | 
| 8 | 
            +
            from .modules.layers import LstmSeq2SeqEncoder
         | 
| 9 | 
            +
            from .modules.base import InstructBase
         | 
| 10 | 
            +
            from .modules.evaluator import Evaluator, greedy_search
         | 
| 11 | 
            +
            from .modules.span_rep import SpanRepLayer
         | 
| 12 | 
            +
            from .modules.token_rep import TokenRepLayer
         | 
| 13 | 
             
            from torch import nn
         | 
| 14 | 
             
            from torch.nn.utils.rnn import pad_sequence
         | 
| 15 | 
             
            from huggingface_hub import PyTorchModelHubMixin, hf_hub_download
         | 
|  | |
| 320 | 
             
                        return model
         | 
| 321 |  | 
| 322 | 
             
                    # 2. Newer format: Use "pytorch_model.bin" and "gliner_config.json"
         | 
| 323 | 
            +
                    from .train import load_config_as_namespace
         | 
| 324 |  | 
| 325 | 
             
                    model_file = Path(model_id) / "pytorch_model.bin"
         | 
| 326 | 
             
                    if not model_file.exists():
         | 
    	
        backup/train.py
    CHANGED
    
    | @@ -7,8 +7,8 @@ from tqdm import tqdm | |
| 7 | 
             
            from transformers import get_cosine_schedule_with_warmup
         | 
| 8 |  | 
| 9 | 
             
            # from model_nested import NerFilteredSemiCRF
         | 
| 10 | 
            -
            from model import GLiNER
         | 
| 11 | 
            -
            from modules.run_evaluation import get_for_all_path, sample_train_data
         | 
| 12 | 
             
            from save_load import save_model, load_model
         | 
| 13 | 
             
            import json
         | 
| 14 |  | 
|  | |
| 7 | 
             
            from transformers import get_cosine_schedule_with_warmup
         | 
| 8 |  | 
| 9 | 
             
            # from model_nested import NerFilteredSemiCRF
         | 
| 10 | 
            +
            from .model import GLiNER
         | 
| 11 | 
            +
            from .modules.run_evaluation import get_for_all_path, sample_train_data
         | 
| 12 | 
             
            from save_load import save_model, load_model
         | 
| 13 | 
             
            import json
         | 
| 14 |  |