seochan99 commited on
Commit
0c545c9
·
verified ·
1 Parent(s): bbfb2b8

Upload folder using huggingface_hub

Browse files
Files changed (3) hide show
  1. README.md +16 -0
  2. setup_instructions.md +4 -6
  3. upload_dataset.py +28 -28
README.md CHANGED
@@ -83,6 +83,22 @@ This dataset is designed for:
83
  - Human-AI agreement studies
84
  - Cultural representation research
85
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
86
  ## Authors
87
 
88
  **Equal Contribution:** Huichan Seo, Sieun Choi, Minki Hong
 
83
  - Human-AI agreement studies
84
  - Cultural representation research
85
 
86
+ ### Loading the Dataset
87
+
88
+ ```python
89
+ from datasets import load_dataset
90
+
91
+ # Load specific dataset configurations
92
+ add_attribution = load_dataset("seochan99/ecb-datasets", "add_attribution")
93
+ country_swap = load_dataset("seochan99/ecb-datasets", "country_swap")
94
+ multi_loop_edits = load_dataset("seochan99/ecb-datasets", "multi_loop_edits")
95
+
96
+ # Access data
97
+ print(add_attribution["train"][0]) # First example from add_attribution
98
+ print(country_swap["train"][0]) # First example from country_swap
99
+ print(multi_loop_edits["train"][0]) # First example from multi_loop_edits
100
+ ```
101
+
102
  ## Authors
103
 
104
  **Equal Contribution:** Huichan Seo, Sieun Choi, Minki Hong
setup_instructions.md CHANGED
@@ -52,12 +52,10 @@ The uploaded dataset can be used as follows:
52
  ```python
53
  from datasets import load_dataset
54
 
55
- # Load dataset
56
- dataset = load_dataset("seochan99/ecb-datasets")
57
-
58
- # Access specific files
59
- add_attribution = dataset["add_attribution"]
60
- country_swap = dataset["country_swap"]
61
  ```
62
 
63
  ## 5. Troubleshooting
 
52
  ```python
53
  from datasets import load_dataset
54
 
55
+ # Load specific dataset configurations
56
+ add_attribution = load_dataset("seochan99/ecb-datasets", "add_attribution")
57
+ country_swap = load_dataset("seochan99/ecb-datasets", "country_swap")
58
+ multi_loop_edits = load_dataset("seochan99/ecb-datasets", "multi_loop_edits")
 
 
59
  ```
60
 
61
  ## 5. Troubleshooting
upload_dataset.py CHANGED
@@ -1,6 +1,6 @@
1
  #!/usr/bin/env python3
2
  """
3
- 허깅페이스 데이터셋 업로드 스크립트
4
  """
5
 
6
  import os
@@ -11,83 +11,83 @@ from huggingface_hub.utils import RepositoryNotFoundError
11
 
12
  def upload_dataset(username, dataset_name, dataset_path):
13
  """
14
- 허깅페이스에 데이터셋을 업로드합니다.
15
 
16
  Args:
17
- username (str): 허깅페이스 사용자명
18
- dataset_name (str): 데이터셋 이름
19
- dataset_path (str): 로컬 데이터셋 경로
20
  """
21
 
22
  repo_id = f"{username}/{dataset_name}"
23
  api = HfApi()
24
 
25
  try:
26
- # 리포지토리 생성
27
- print(f"리포지토리 생성 중: {repo_id}")
28
  create_repo(
29
  repo_id=repo_id,
30
  repo_type="dataset",
31
  exist_ok=True
32
  )
33
- print("✅ 리포지토리 생성 완료")
34
 
35
  except Exception as e:
36
- print(f"❌ 리포지토리 생성 실패: {e}")
37
  return False
38
 
39
  try:
40
- # 데이터셋 업로드
41
- print(f"데이터셋 업로드 중: {dataset_path}")
42
  api.upload_folder(
43
  folder_path=dataset_path,
44
  repo_id=repo_id,
45
  repo_type="dataset"
46
  )
47
- print("✅ 데이터셋 업로드 완료")
48
- print(f"🌐 데이터셋 URL: https://huggingface.co/datasets/{repo_id}")
49
  return True
50
 
51
  except Exception as e:
52
- print(f"❌ 데이터셋 업로드 실패: {e}")
53
  return False
54
 
55
  def main():
56
  if len(sys.argv) != 3:
57
- print("사용법: python upload_dataset.py <username> <dataset-name>")
58
- print("예시: python upload_dataset.py yourusername ecb-human-survey")
59
  sys.exit(1)
60
 
61
  username = sys.argv[1]
62
  dataset_name = sys.argv[2]
63
- dataset_path = "." # 현재 디렉토리
64
 
65
  print("=" * 50)
66
- print("허깅페이스 데이터셋 업로드")
67
  print("=" * 50)
68
- print(f"사용자명: {username}")
69
- print(f"데이터셋명: {dataset_name}")
70
- print(f"로컬 경로: {os.path.abspath(dataset_path)}")
71
  print("=" * 50)
72
 
73
- # 토큰 확인
74
  try:
75
  api = HfApi()
76
  user_info = api.whoami()
77
- print(f"✅ 로그인됨: {user_info['name']}")
78
  except Exception as e:
79
- print("❌ 허깅페이스에 로그인되지 않았습니다.")
80
- print("다음 명령어로 로그인하세요:")
81
  print("python -c \"from huggingface_hub import login; login()\"")
82
  sys.exit(1)
83
 
84
- # 업로드 실행
85
  success = upload_dataset(username, dataset_name, dataset_path)
86
 
87
  if success:
88
- print("\n🎉 업로드가 성공적으로 완료되었습니다!")
89
  else:
90
- print("\n💥 업로드 중 오류가 발생했습니다.")
91
  sys.exit(1)
92
 
93
  if __name__ == "__main__":
 
1
  #!/usr/bin/env python3
2
  """
3
+ Hugging Face Dataset Upload Script
4
  """
5
 
6
  import os
 
11
 
12
  def upload_dataset(username, dataset_name, dataset_path):
13
  """
14
+ Upload dataset to Hugging Face.
15
 
16
  Args:
17
+ username (str): Hugging Face username
18
+ dataset_name (str): Dataset name
19
+ dataset_path (str): Local dataset path
20
  """
21
 
22
  repo_id = f"{username}/{dataset_name}"
23
  api = HfApi()
24
 
25
  try:
26
+ # Create repository
27
+ print(f"Creating repository: {repo_id}")
28
  create_repo(
29
  repo_id=repo_id,
30
  repo_type="dataset",
31
  exist_ok=True
32
  )
33
+ print("✅ Repository created successfully")
34
 
35
  except Exception as e:
36
+ print(f"❌ Repository creation failed: {e}")
37
  return False
38
 
39
  try:
40
+ # Upload dataset
41
+ print(f"Uploading dataset: {dataset_path}")
42
  api.upload_folder(
43
  folder_path=dataset_path,
44
  repo_id=repo_id,
45
  repo_type="dataset"
46
  )
47
+ print("✅ Dataset upload completed")
48
+ print(f"🌐 Dataset URL: https://huggingface.co/datasets/{repo_id}")
49
  return True
50
 
51
  except Exception as e:
52
+ print(f"❌ Dataset upload failed: {e}")
53
  return False
54
 
55
  def main():
56
  if len(sys.argv) != 3:
57
+ print("Usage: python upload_dataset.py <username> <dataset-name>")
58
+ print("Example: python upload_dataset.py seochan99 ecb-datasets")
59
  sys.exit(1)
60
 
61
  username = sys.argv[1]
62
  dataset_name = sys.argv[2]
63
+ dataset_path = "." # Current directory
64
 
65
  print("=" * 50)
66
+ print("Hugging Face Dataset Upload")
67
  print("=" * 50)
68
+ print(f"Username: {username}")
69
+ print(f"Dataset Name: {dataset_name}")
70
+ print(f"Local Path: {os.path.abspath(dataset_path)}")
71
  print("=" * 50)
72
 
73
+ # Check authentication
74
  try:
75
  api = HfApi()
76
  user_info = api.whoami()
77
+ print(f"✅ Logged in as: {user_info['name']}")
78
  except Exception as e:
79
+ print("❌ Not logged in to Hugging Face.")
80
+ print("Please login using:")
81
  print("python -c \"from huggingface_hub import login; login()\"")
82
  sys.exit(1)
83
 
84
+ # Execute upload
85
  success = upload_dataset(username, dataset_name, dataset_path)
86
 
87
  if success:
88
+ print("\n🎉 Upload completed successfully!")
89
  else:
90
+ print("\n💥 Error occurred during upload.")
91
  sys.exit(1)
92
 
93
  if __name__ == "__main__":