KeivanR commited on
Commit
3515613
·
1 Parent(s): 4e11d81

json file handling

Browse files
Files changed (2) hide show
  1. qwen_classifier/evaluate.py +7 -1
  2. setup.py +4 -0
qwen_classifier/evaluate.py CHANGED
@@ -10,14 +10,20 @@ import torch
10
  from datasets import Dataset
11
  from torch.utils.data import DataLoader
12
  import requests
 
13
 
14
  from .config import TAG_NAMES, DEVICE, SPACE_URL, EVAL_LIMIT
15
  from .globals import global_model, global_tokenizer
16
 
 
17
  def _load_data(test_data_path):
 
18
  # Check file existence
19
  if not os.path.exists(test_data_path):
20
- raise FileNotFoundError(f"Zip file not found at: {test_data_path}")
 
 
 
21
 
22
  if not zipfile.is_zipfile(test_data_path):
23
  raise zipfile.BadZipFile(f"File is not a valid zip archive: {test_data_path}")
 
10
  from datasets import Dataset
11
  from torch.utils.data import DataLoader
12
  import requests
13
+ from pathlib import Path
14
 
15
  from .config import TAG_NAMES, DEVICE, SPACE_URL, EVAL_LIMIT
16
  from .globals import global_model, global_tokenizer
17
 
18
+
19
  def _load_data(test_data_path):
20
+ test_data_path = Path(__file__).parent / test_data_path
21
  # Check file existence
22
  if not os.path.exists(test_data_path):
23
+ raise FileNotFoundError(
24
+ f"ZIP file not found at {test_data_path}. "
25
+ f"Current directory: {os.listdir(Path(__file__).parent)}"
26
+ )
27
 
28
  if not zipfile.is_zipfile(test_data_path):
29
  raise zipfile.BadZipFile(f"File is not a valid zip archive: {test_data_path}")
setup.py CHANGED
@@ -4,6 +4,10 @@ setup(
4
  name="qwen_classifier",
5
  version="0.1",
6
  packages=find_packages(),
 
 
 
 
7
  install_requires=[
8
  'torch',
9
  'transformers',
 
4
  name="qwen_classifier",
5
  version="0.1",
6
  packages=find_packages(),
7
+ package_data={
8
+ 'qwen_classifier': ['test_jsons.zip'],
9
+ },
10
+ include_package_data=True,
11
  install_requires=[
12
  'torch',
13
  'transformers',