Remove hardcoded API tokens - use environment variables
Browse files- .gitattributes +0 -2
- .gitignore +2 -1
- 11 Indobert-base-p1_without_law.py +6 -5
- 12 Indobert-base-p1_with_law.py +6 -5
- 21 Indobert-IndoLegalBERT_without_law.py +6 -5
- 22 Indobert-IndoLegalBERT_with_law.py +6 -5
- 31 Indobert-base-p1_without_law_with_svr.py +6 -5
- 32 Indobert-base-p1_with_law_with_svr.py +6 -5
- 41 Indobert-base-p1_without_law_mlp.py +6 -5
- 42 Indobert-base-p1_with_law_mlp.py +6 -5
- 51 Indobert-base-p1_without_law_with_xgboost.py +1 -1
- 52 Indobert-base-p1_with_law_with_xgboost.py +1 -1
- Indobert-base-p1_with_law_log1p.py +6 -5
- Indobert-base-p1_with_law_nozero.py +6 -5
- README.md +3 -2
.gitattributes
CHANGED
|
@@ -4,5 +4,3 @@
|
|
| 4 |
*.pkl filter=lfs diff=lfs merge=lfs -text
|
| 5 |
checkpoint-* filter=lfs diff=lfs merge=lfs -text
|
| 6 |
indo-legalbert-with-law-finetuned/* filter=lfs diff=lfs merge=lfs -text
|
| 7 |
-
*.wandb filter=xet -text
|
| 8 |
-
wandb/** filter=xet -text
|
|
|
|
| 4 |
*.pkl filter=lfs diff=lfs merge=lfs -text
|
| 5 |
checkpoint-* filter=lfs diff=lfs merge=lfs -text
|
| 6 |
indo-legalbert-with-law-finetuned/* filter=lfs diff=lfs merge=lfs -text
|
|
|
|
|
|
.gitignore
CHANGED
|
@@ -1,3 +1,4 @@
|
|
| 1 |
.venv
|
| 2 |
__pycache__
|
| 3 |
-
|
|
|
|
|
|
| 1 |
.venv
|
| 2 |
__pycache__
|
| 3 |
+
colloquial_data/
|
| 4 |
+
wandb/
|
11 Indobert-base-p1_without_law.py
CHANGED
|
@@ -114,13 +114,13 @@ def set_seed(seed: int):
|
|
| 114 |
set_seed(SEED)
|
| 115 |
|
| 116 |
# Hugging Face token (optional) - prefer setting this in your environment
|
| 117 |
-
HF_TOKEN = os.environ.get('HF_TOKEN')
|
| 118 |
|
| 119 |
# Optional: You can paste a Weights & Biases API key here to avoid interactive prompts.
|
| 120 |
# Warning: embedding secrets in source code is not recommended for security reasons.
|
| 121 |
# Prefer setting the WANDB_API_KEY environment variable. If you still want to hardcode
|
| 122 |
# the key for convenience, paste it below as a string.
|
| 123 |
-
WANDB_API_KEY_INLINE =
|
| 124 |
|
| 125 |
# W&B project configuration — change if you want a different project/entity
|
| 126 |
WANDB_ENTITY = os.environ.get('WANDB_ENTITY') or 'evansteam'
|
|
@@ -476,11 +476,12 @@ print(f" Max length: {MAX_LENGTH}")
|
|
| 476 |
# is present we still proceed without W&B; setting the API key here avoids
|
| 477 |
# interactive prompts that can block execution.
|
| 478 |
try:
|
| 479 |
-
# prefer inline key, then env
|
| 480 |
-
wandb_api = WANDB_API_KEY_INLINE or os.environ.get("WANDB_API_KEY")
|
| 481 |
|
| 482 |
# Export env vars so Trainer/wandb integrations pick them up non-interactively
|
| 483 |
-
|
|
|
|
| 484 |
os.environ['WANDB_ENTITY'] = WANDB_ENTITY
|
| 485 |
os.environ['WANDB_PROJECT'] = WANDB_PROJECT
|
| 486 |
|
|
|
|
| 114 |
set_seed(SEED)
|
| 115 |
|
| 116 |
# Hugging Face token (optional) - prefer setting this in your environment
|
| 117 |
+
HF_TOKEN = os.environ.get('HF_TOKEN') # Set HF_TOKEN environment variable
|
| 118 |
|
| 119 |
# Optional: You can paste a Weights & Biases API key here to avoid interactive prompts.
|
| 120 |
# Warning: embedding secrets in source code is not recommended for security reasons.
|
| 121 |
# Prefer setting the WANDB_API_KEY environment variable. If you still want to hardcode
|
| 122 |
# the key for convenience, paste it below as a string.
|
| 123 |
+
WANDB_API_KEY_INLINE = None # Set WANDB_API_KEY environment variable instead
|
| 124 |
|
| 125 |
# W&B project configuration — change if you want a different project/entity
|
| 126 |
WANDB_ENTITY = os.environ.get('WANDB_ENTITY') or 'evansteam'
|
|
|
|
| 476 |
# is present we still proceed without W&B; setting the API key here avoids
|
| 477 |
# interactive prompts that can block execution.
|
| 478 |
try:
|
| 479 |
+
# prefer inline key, then env
|
| 480 |
+
wandb_api = WANDB_API_KEY_INLINE or os.environ.get("WANDB_API_KEY")
|
| 481 |
|
| 482 |
# Export env vars so Trainer/wandb integrations pick them up non-interactively
|
| 483 |
+
if wandb_api:
|
| 484 |
+
os.environ['WANDB_API_KEY'] = wandb_api
|
| 485 |
os.environ['WANDB_ENTITY'] = WANDB_ENTITY
|
| 486 |
os.environ['WANDB_PROJECT'] = WANDB_PROJECT
|
| 487 |
|
12 Indobert-base-p1_with_law.py
CHANGED
|
@@ -114,13 +114,13 @@ def set_seed(seed: int):
|
|
| 114 |
set_seed(SEED)
|
| 115 |
|
| 116 |
# Hugging Face token (optional) - prefer setting this in your environment
|
| 117 |
-
HF_TOKEN = os.environ.get('HF_TOKEN')
|
| 118 |
|
| 119 |
# Optional: You can paste a Weights & Biases API key here to avoid interactive prompts.
|
| 120 |
# Warning: embedding secrets in source code is not recommended for security reasons.
|
| 121 |
# Prefer setting the WANDB_API_KEY environment variable. If you still want to hardcode
|
| 122 |
# the key for convenience, paste it below as a string.
|
| 123 |
-
WANDB_API_KEY_INLINE =
|
| 124 |
|
| 125 |
# W&B project configuration — change if you want a different project/entity
|
| 126 |
WANDB_ENTITY = os.environ.get('WANDB_ENTITY') or 'evansteam'
|
|
@@ -476,11 +476,12 @@ print(f" Max length: {MAX_LENGTH}")
|
|
| 476 |
# is present we still proceed without W&B; setting the API key here avoids
|
| 477 |
# interactive prompts that can block execution.
|
| 478 |
try:
|
| 479 |
-
# prefer inline key, then env
|
| 480 |
-
wandb_api = WANDB_API_KEY_INLINE or os.environ.get("WANDB_API_KEY")
|
| 481 |
|
| 482 |
# Export env vars so Trainer/wandb integrations pick them up non-interactively
|
| 483 |
-
|
|
|
|
| 484 |
os.environ['WANDB_ENTITY'] = WANDB_ENTITY
|
| 485 |
os.environ['WANDB_PROJECT'] = WANDB_PROJECT
|
| 486 |
|
|
|
|
| 114 |
set_seed(SEED)
|
| 115 |
|
| 116 |
# Hugging Face token (optional) - prefer setting this in your environment
|
| 117 |
+
HF_TOKEN = os.environ.get('HF_TOKEN') # Set HF_TOKEN environment variable
|
| 118 |
|
| 119 |
# Optional: You can paste a Weights & Biases API key here to avoid interactive prompts.
|
| 120 |
# Warning: embedding secrets in source code is not recommended for security reasons.
|
| 121 |
# Prefer setting the WANDB_API_KEY environment variable. If you still want to hardcode
|
| 122 |
# the key for convenience, paste it below as a string.
|
| 123 |
+
WANDB_API_KEY_INLINE = None # Set WANDB_API_KEY environment variable instead
|
| 124 |
|
| 125 |
# W&B project configuration — change if you want a different project/entity
|
| 126 |
WANDB_ENTITY = os.environ.get('WANDB_ENTITY') or 'evansteam'
|
|
|
|
| 476 |
# is present we still proceed without W&B; setting the API key here avoids
|
| 477 |
# interactive prompts that can block execution.
|
| 478 |
try:
|
| 479 |
+
# prefer inline key, then env
|
| 480 |
+
wandb_api = WANDB_API_KEY_INLINE or os.environ.get("WANDB_API_KEY")
|
| 481 |
|
| 482 |
# Export env vars so Trainer/wandb integrations pick them up non-interactively
|
| 483 |
+
if wandb_api:
|
| 484 |
+
os.environ['WANDB_API_KEY'] = wandb_api
|
| 485 |
os.environ['WANDB_ENTITY'] = WANDB_ENTITY
|
| 486 |
os.environ['WANDB_PROJECT'] = WANDB_PROJECT
|
| 487 |
|
21 Indobert-IndoLegalBERT_without_law.py
CHANGED
|
@@ -114,13 +114,13 @@ def set_seed(seed: int):
|
|
| 114 |
set_seed(SEED)
|
| 115 |
|
| 116 |
# Hugging Face token (optional) - prefer setting this in your environment
|
| 117 |
-
HF_TOKEN = os.environ.get('HF_TOKEN')
|
| 118 |
|
| 119 |
# Optional: You can paste a Weights & Biases API key here to avoid interactive prompts.
|
| 120 |
# Warning: embedding secrets in source code is not recommended for security reasons.
|
| 121 |
# Prefer setting the WANDB_API_KEY environment variable. If you still want to hardcode
|
| 122 |
# the key for convenience, paste it below as a string.
|
| 123 |
-
WANDB_API_KEY_INLINE =
|
| 124 |
|
| 125 |
# W&B project configuration — change if you want a different project/entity
|
| 126 |
WANDB_ENTITY = os.environ.get('WANDB_ENTITY') or 'evansteam'
|
|
@@ -580,11 +580,12 @@ print(f" Max length: {MAX_LENGTH}")
|
|
| 580 |
# is present we still proceed without W&B; setting the API key here avoids
|
| 581 |
# interactive prompts that can block execution.
|
| 582 |
try:
|
| 583 |
-
# prefer inline key, then env
|
| 584 |
-
wandb_api = WANDB_API_KEY_INLINE or os.environ.get("WANDB_API_KEY")
|
| 585 |
|
| 586 |
# Export env vars so Trainer/wandb integrations pick them up non-interactively
|
| 587 |
-
|
|
|
|
| 588 |
os.environ['WANDB_ENTITY'] = WANDB_ENTITY
|
| 589 |
os.environ['WANDB_PROJECT'] = WANDB_PROJECT
|
| 590 |
|
|
|
|
| 114 |
set_seed(SEED)
|
| 115 |
|
| 116 |
# Hugging Face token (optional) - prefer setting this in your environment
|
| 117 |
+
HF_TOKEN = os.environ.get('HF_TOKEN') # Set HF_TOKEN environment variable
|
| 118 |
|
| 119 |
# Optional: You can paste a Weights & Biases API key here to avoid interactive prompts.
|
| 120 |
# Warning: embedding secrets in source code is not recommended for security reasons.
|
| 121 |
# Prefer setting the WANDB_API_KEY environment variable. If you still want to hardcode
|
| 122 |
# the key for convenience, paste it below as a string.
|
| 123 |
+
WANDB_API_KEY_INLINE = None # Set WANDB_API_KEY environment variable instead
|
| 124 |
|
| 125 |
# W&B project configuration — change if you want a different project/entity
|
| 126 |
WANDB_ENTITY = os.environ.get('WANDB_ENTITY') or 'evansteam'
|
|
|
|
| 580 |
# is present we still proceed without W&B; setting the API key here avoids
|
| 581 |
# interactive prompts that can block execution.
|
| 582 |
try:
|
| 583 |
+
# prefer inline key, then env
|
| 584 |
+
wandb_api = WANDB_API_KEY_INLINE or os.environ.get("WANDB_API_KEY")
|
| 585 |
|
| 586 |
# Export env vars so Trainer/wandb integrations pick them up non-interactively
|
| 587 |
+
if wandb_api:
|
| 588 |
+
os.environ['WANDB_API_KEY'] = wandb_api
|
| 589 |
os.environ['WANDB_ENTITY'] = WANDB_ENTITY
|
| 590 |
os.environ['WANDB_PROJECT'] = WANDB_PROJECT
|
| 591 |
|
22 Indobert-IndoLegalBERT_with_law.py
CHANGED
|
@@ -114,13 +114,13 @@ def set_seed(seed: int):
|
|
| 114 |
set_seed(SEED)
|
| 115 |
|
| 116 |
# Hugging Face token (optional) - prefer setting this in your environment
|
| 117 |
-
HF_TOKEN = os.environ.get('HF_TOKEN')
|
| 118 |
|
| 119 |
# Optional: You can paste a Weights & Biases API key here to avoid interactive prompts.
|
| 120 |
# Warning: embedding secrets in source code is not recommended for security reasons.
|
| 121 |
# Prefer setting the WANDB_API_KEY environment variable. If you still want to hardcode
|
| 122 |
# the key for convenience, paste it below as a string.
|
| 123 |
-
WANDB_API_KEY_INLINE =
|
| 124 |
|
| 125 |
# W&B project configuration — change if you want a different project/entity
|
| 126 |
WANDB_ENTITY = os.environ.get('WANDB_ENTITY') or 'evansteam'
|
|
@@ -580,11 +580,12 @@ print(f" Max length: {MAX_LENGTH}")
|
|
| 580 |
# is present we still proceed without W&B; setting the API key here avoids
|
| 581 |
# interactive prompts that can block execution.
|
| 582 |
try:
|
| 583 |
-
# prefer inline key, then env
|
| 584 |
-
wandb_api = WANDB_API_KEY_INLINE or os.environ.get("WANDB_API_KEY")
|
| 585 |
|
| 586 |
# Export env vars so Trainer/wandb integrations pick them up non-interactively
|
| 587 |
-
|
|
|
|
| 588 |
os.environ['WANDB_ENTITY'] = WANDB_ENTITY
|
| 589 |
os.environ['WANDB_PROJECT'] = WANDB_PROJECT
|
| 590 |
|
|
|
|
| 114 |
set_seed(SEED)
|
| 115 |
|
| 116 |
# Hugging Face token (optional) - prefer setting this in your environment
|
| 117 |
+
HF_TOKEN = os.environ.get('HF_TOKEN') # Set HF_TOKEN environment variable
|
| 118 |
|
| 119 |
# Optional: You can paste a Weights & Biases API key here to avoid interactive prompts.
|
| 120 |
# Warning: embedding secrets in source code is not recommended for security reasons.
|
| 121 |
# Prefer setting the WANDB_API_KEY environment variable. If you still want to hardcode
|
| 122 |
# the key for convenience, paste it below as a string.
|
| 123 |
+
WANDB_API_KEY_INLINE = None # Set WANDB_API_KEY environment variable instead
|
| 124 |
|
| 125 |
# W&B project configuration — change if you want a different project/entity
|
| 126 |
WANDB_ENTITY = os.environ.get('WANDB_ENTITY') or 'evansteam'
|
|
|
|
| 580 |
# is present we still proceed without W&B; setting the API key here avoids
|
| 581 |
# interactive prompts that can block execution.
|
| 582 |
try:
|
| 583 |
+
# prefer inline key, then env
|
| 584 |
+
wandb_api = WANDB_API_KEY_INLINE or os.environ.get("WANDB_API_KEY")
|
| 585 |
|
| 586 |
# Export env vars so Trainer/wandb integrations pick them up non-interactively
|
| 587 |
+
if wandb_api:
|
| 588 |
+
os.environ['WANDB_API_KEY'] = wandb_api
|
| 589 |
os.environ['WANDB_ENTITY'] = WANDB_ENTITY
|
| 590 |
os.environ['WANDB_PROJECT'] = WANDB_PROJECT
|
| 591 |
|
31 Indobert-base-p1_without_law_with_svr.py
CHANGED
|
@@ -114,13 +114,13 @@ def set_seed(seed: int):
|
|
| 114 |
set_seed(SEED)
|
| 115 |
|
| 116 |
# Hugging Face token (optional) - prefer setting this in your environment
|
| 117 |
-
HF_TOKEN = os.environ.get('HF_TOKEN')
|
| 118 |
|
| 119 |
# Optional: You can paste a Weights & Biases API key here to avoid interactive prompts.
|
| 120 |
# Warning: embedding secrets in source code is not recommended for security reasons.
|
| 121 |
# Prefer setting the WANDB_API_KEY environment variable. If you still want to hardcode
|
| 122 |
# the key for convenience, paste it below as a string.
|
| 123 |
-
WANDB_API_KEY_INLINE =
|
| 124 |
|
| 125 |
# W&B project configuration — change if you want a different project/entity
|
| 126 |
WANDB_ENTITY = os.environ.get('WANDB_ENTITY') or 'evansteam'
|
|
@@ -476,11 +476,12 @@ print(f" Max length: {MAX_LENGTH}")
|
|
| 476 |
# is present we still proceed without W&B; setting the API key here avoids
|
| 477 |
# interactive prompts that can block execution.
|
| 478 |
try:
|
| 479 |
-
# prefer inline key, then env
|
| 480 |
-
wandb_api = WANDB_API_KEY_INLINE or os.environ.get("WANDB_API_KEY")
|
| 481 |
|
| 482 |
# Export env vars so Trainer/wandb integrations pick them up non-interactively
|
| 483 |
-
|
|
|
|
| 484 |
os.environ['WANDB_ENTITY'] = WANDB_ENTITY
|
| 485 |
os.environ['WANDB_PROJECT'] = WANDB_PROJECT
|
| 486 |
|
|
|
|
| 114 |
set_seed(SEED)
|
| 115 |
|
| 116 |
# Hugging Face token (optional) - prefer setting this in your environment
|
| 117 |
+
HF_TOKEN = os.environ.get('HF_TOKEN') # Set HF_TOKEN environment variable
|
| 118 |
|
| 119 |
# Optional: You can paste a Weights & Biases API key here to avoid interactive prompts.
|
| 120 |
# Warning: embedding secrets in source code is not recommended for security reasons.
|
| 121 |
# Prefer setting the WANDB_API_KEY environment variable. If you still want to hardcode
|
| 122 |
# the key for convenience, paste it below as a string.
|
| 123 |
+
WANDB_API_KEY_INLINE = None # Set WANDB_API_KEY environment variable instead
|
| 124 |
|
| 125 |
# W&B project configuration — change if you want a different project/entity
|
| 126 |
WANDB_ENTITY = os.environ.get('WANDB_ENTITY') or 'evansteam'
|
|
|
|
| 476 |
# is present we still proceed without W&B; setting the API key here avoids
|
| 477 |
# interactive prompts that can block execution.
|
| 478 |
try:
|
| 479 |
+
# prefer inline key, then env
|
| 480 |
+
wandb_api = WANDB_API_KEY_INLINE or os.environ.get("WANDB_API_KEY")
|
| 481 |
|
| 482 |
# Export env vars so Trainer/wandb integrations pick them up non-interactively
|
| 483 |
+
if wandb_api:
|
| 484 |
+
os.environ['WANDB_API_KEY'] = wandb_api
|
| 485 |
os.environ['WANDB_ENTITY'] = WANDB_ENTITY
|
| 486 |
os.environ['WANDB_PROJECT'] = WANDB_PROJECT
|
| 487 |
|
32 Indobert-base-p1_with_law_with_svr.py
CHANGED
|
@@ -114,13 +114,13 @@ def set_seed(seed: int):
|
|
| 114 |
set_seed(SEED)
|
| 115 |
|
| 116 |
# Hugging Face token (optional) - prefer setting this in your environment
|
| 117 |
-
HF_TOKEN = os.environ.get('HF_TOKEN')
|
| 118 |
|
| 119 |
# Optional: You can paste a Weights & Biases API key here to avoid interactive prompts.
|
| 120 |
# Warning: embedding secrets in source code is not recommended for security reasons.
|
| 121 |
# Prefer setting the WANDB_API_KEY environment variable. If you still want to hardcode
|
| 122 |
# the key for convenience, paste it below as a string.
|
| 123 |
-
WANDB_API_KEY_INLINE =
|
| 124 |
|
| 125 |
# W&B project configuration — change if you want a different project/entity
|
| 126 |
WANDB_ENTITY = os.environ.get('WANDB_ENTITY') or 'evansteam'
|
|
@@ -476,11 +476,12 @@ print(f" Max length: {MAX_LENGTH}")
|
|
| 476 |
# is present we still proceed without W&B; setting the API key here avoids
|
| 477 |
# interactive prompts that can block execution.
|
| 478 |
try:
|
| 479 |
-
# prefer inline key, then env
|
| 480 |
-
wandb_api = WANDB_API_KEY_INLINE or os.environ.get("WANDB_API_KEY")
|
| 481 |
|
| 482 |
# Export env vars so Trainer/wandb integrations pick them up non-interactively
|
| 483 |
-
|
|
|
|
| 484 |
os.environ['WANDB_ENTITY'] = WANDB_ENTITY
|
| 485 |
os.environ['WANDB_PROJECT'] = WANDB_PROJECT
|
| 486 |
|
|
|
|
| 114 |
set_seed(SEED)
|
| 115 |
|
| 116 |
# Hugging Face token (optional) - prefer setting this in your environment
|
| 117 |
+
HF_TOKEN = os.environ.get('HF_TOKEN') # Set HF_TOKEN environment variable
|
| 118 |
|
| 119 |
# Optional: You can paste a Weights & Biases API key here to avoid interactive prompts.
|
| 120 |
# Warning: embedding secrets in source code is not recommended for security reasons.
|
| 121 |
# Prefer setting the WANDB_API_KEY environment variable. If you still want to hardcode
|
| 122 |
# the key for convenience, paste it below as a string.
|
| 123 |
+
WANDB_API_KEY_INLINE = None # Set WANDB_API_KEY environment variable instead
|
| 124 |
|
| 125 |
# W&B project configuration — change if you want a different project/entity
|
| 126 |
WANDB_ENTITY = os.environ.get('WANDB_ENTITY') or 'evansteam'
|
|
|
|
| 476 |
# is present we still proceed without W&B; setting the API key here avoids
|
| 477 |
# interactive prompts that can block execution.
|
| 478 |
try:
|
| 479 |
+
# prefer inline key, then env
|
| 480 |
+
wandb_api = WANDB_API_KEY_INLINE or os.environ.get("WANDB_API_KEY")
|
| 481 |
|
| 482 |
# Export env vars so Trainer/wandb integrations pick them up non-interactively
|
| 483 |
+
if wandb_api:
|
| 484 |
+
os.environ['WANDB_API_KEY'] = wandb_api
|
| 485 |
os.environ['WANDB_ENTITY'] = WANDB_ENTITY
|
| 486 |
os.environ['WANDB_PROJECT'] = WANDB_PROJECT
|
| 487 |
|
41 Indobert-base-p1_without_law_mlp.py
CHANGED
|
@@ -115,13 +115,13 @@ def set_seed(seed: int):
|
|
| 115 |
set_seed(SEED)
|
| 116 |
|
| 117 |
# Hugging Face token (optional) - prefer setting this in your environment
|
| 118 |
-
HF_TOKEN = os.environ.get('HF_TOKEN')
|
| 119 |
|
| 120 |
# Optional: You can paste a Weights & Biases API key here to avoid interactive prompts.
|
| 121 |
# Warning: embedding secrets in source code is not recommended for security reasons.
|
| 122 |
# Prefer setting the WANDB_API_KEY environment variable. If you still want to hardcode
|
| 123 |
# the key for convenience, paste it below as a string.
|
| 124 |
-
WANDB_API_KEY_INLINE =
|
| 125 |
|
| 126 |
# W&B project configuration — change if you want a different project/entity
|
| 127 |
WANDB_ENTITY = os.environ.get('WANDB_ENTITY') or 'evansteam'
|
|
@@ -549,11 +549,12 @@ print(f" Max length: {MAX_LENGTH}")
|
|
| 549 |
# is present we still proceed without W&B; setting the API key here avoids
|
| 550 |
# interactive prompts that can block execution.
|
| 551 |
try:
|
| 552 |
-
# prefer inline key, then env
|
| 553 |
-
wandb_api = WANDB_API_KEY_INLINE or os.environ.get("WANDB_API_KEY")
|
| 554 |
|
| 555 |
# Export env vars so Trainer/wandb integrations pick them up non-interactively
|
| 556 |
-
|
|
|
|
| 557 |
os.environ['WANDB_ENTITY'] = WANDB_ENTITY
|
| 558 |
os.environ['WANDB_PROJECT'] = WANDB_PROJECT
|
| 559 |
|
|
|
|
| 115 |
set_seed(SEED)
|
| 116 |
|
| 117 |
# Hugging Face token (optional) - prefer setting this in your environment
|
| 118 |
+
HF_TOKEN = os.environ.get('HF_TOKEN') # Set HF_TOKEN environment variable
|
| 119 |
|
| 120 |
# Optional: You can paste a Weights & Biases API key here to avoid interactive prompts.
|
| 121 |
# Warning: embedding secrets in source code is not recommended for security reasons.
|
| 122 |
# Prefer setting the WANDB_API_KEY environment variable. If you still want to hardcode
|
| 123 |
# the key for convenience, paste it below as a string.
|
| 124 |
+
WANDB_API_KEY_INLINE = None # Set WANDB_API_KEY environment variable instead
|
| 125 |
|
| 126 |
# W&B project configuration — change if you want a different project/entity
|
| 127 |
WANDB_ENTITY = os.environ.get('WANDB_ENTITY') or 'evansteam'
|
|
|
|
| 549 |
# is present we still proceed without W&B; setting the API key here avoids
|
| 550 |
# interactive prompts that can block execution.
|
| 551 |
try:
|
| 552 |
+
# prefer inline key, then env
|
| 553 |
+
wandb_api = WANDB_API_KEY_INLINE or os.environ.get("WANDB_API_KEY")
|
| 554 |
|
| 555 |
# Export env vars so Trainer/wandb integrations pick them up non-interactively
|
| 556 |
+
if wandb_api:
|
| 557 |
+
os.environ['WANDB_API_KEY'] = wandb_api
|
| 558 |
os.environ['WANDB_ENTITY'] = WANDB_ENTITY
|
| 559 |
os.environ['WANDB_PROJECT'] = WANDB_PROJECT
|
| 560 |
|
42 Indobert-base-p1_with_law_mlp.py
CHANGED
|
@@ -116,13 +116,13 @@ def set_seed(seed: int):
|
|
| 116 |
set_seed(SEED)
|
| 117 |
|
| 118 |
# Hugging Face token (optional) - prefer setting this in your environment
|
| 119 |
-
HF_TOKEN = os.environ.get('HF_TOKEN')
|
| 120 |
|
| 121 |
# Optional: You can paste a Weights & Biases API key here to avoid interactive prompts.
|
| 122 |
# Warning: embedding secrets in source code is not recommended for security reasons.
|
| 123 |
# Prefer setting the WANDB_API_KEY environment variable. If you still want to hardcode
|
| 124 |
# the key for convenience, paste it below as a string.
|
| 125 |
-
WANDB_API_KEY_INLINE =
|
| 126 |
|
| 127 |
# W&B project configuration — change if you want a different project/entity
|
| 128 |
WANDB_ENTITY = os.environ.get('WANDB_ENTITY') or 'evansteam'
|
|
@@ -550,11 +550,12 @@ print(f" Max length: {MAX_LENGTH}")
|
|
| 550 |
# is present we still proceed without W&B; setting the API key here avoids
|
| 551 |
# interactive prompts that can block execution.
|
| 552 |
try:
|
| 553 |
-
# prefer inline key, then env
|
| 554 |
-
wandb_api = WANDB_API_KEY_INLINE or os.environ.get("WANDB_API_KEY")
|
| 555 |
|
| 556 |
# Export env vars so Trainer/wandb integrations pick them up non-interactively
|
| 557 |
-
|
|
|
|
| 558 |
os.environ['WANDB_ENTITY'] = WANDB_ENTITY
|
| 559 |
os.environ['WANDB_PROJECT'] = WANDB_PROJECT
|
| 560 |
|
|
|
|
| 116 |
set_seed(SEED)
|
| 117 |
|
| 118 |
# Hugging Face token (optional) - prefer setting this in your environment
|
| 119 |
+
HF_TOKEN = os.environ.get('HF_TOKEN') # Set HF_TOKEN environment variable
|
| 120 |
|
| 121 |
# Optional: You can paste a Weights & Biases API key here to avoid interactive prompts.
|
| 122 |
# Warning: embedding secrets in source code is not recommended for security reasons.
|
| 123 |
# Prefer setting the WANDB_API_KEY environment variable. If you still want to hardcode
|
| 124 |
# the key for convenience, paste it below as a string.
|
| 125 |
+
WANDB_API_KEY_INLINE = None # Set WANDB_API_KEY environment variable instead
|
| 126 |
|
| 127 |
# W&B project configuration — change if you want a different project/entity
|
| 128 |
WANDB_ENTITY = os.environ.get('WANDB_ENTITY') or 'evansteam'
|
|
|
|
| 550 |
# is present we still proceed without W&B; setting the API key here avoids
|
| 551 |
# interactive prompts that can block execution.
|
| 552 |
try:
|
| 553 |
+
# prefer inline key, then env
|
| 554 |
+
wandb_api = WANDB_API_KEY_INLINE or os.environ.get("WANDB_API_KEY")
|
| 555 |
|
| 556 |
# Export env vars so Trainer/wandb integrations pick them up non-interactively
|
| 557 |
+
if wandb_api:
|
| 558 |
+
os.environ['WANDB_API_KEY'] = wandb_api
|
| 559 |
os.environ['WANDB_ENTITY'] = WANDB_ENTITY
|
| 560 |
os.environ['WANDB_PROJECT'] = WANDB_PROJECT
|
| 561 |
|
51 Indobert-base-p1_without_law_with_xgboost.py
CHANGED
|
@@ -48,7 +48,7 @@ def set_seed(seed: int):
|
|
| 48 |
|
| 49 |
set_seed(SEED)
|
| 50 |
|
| 51 |
-
HF_TOKEN = os.environ.get('HF_TOKEN')
|
| 52 |
device = torch.device("cuda" if torch.cuda.is_available() else "cpu")
|
| 53 |
print(f"Device detected: {device}")
|
| 54 |
|
|
|
|
| 48 |
|
| 49 |
set_seed(SEED)
|
| 50 |
|
| 51 |
+
HF_TOKEN = os.environ.get('HF_TOKEN') # Set HF_TOKEN environment variable
|
| 52 |
device = torch.device("cuda" if torch.cuda.is_available() else "cpu")
|
| 53 |
print(f"Device detected: {device}")
|
| 54 |
|
52 Indobert-base-p1_with_law_with_xgboost.py
CHANGED
|
@@ -48,7 +48,7 @@ def set_seed(seed: int):
|
|
| 48 |
|
| 49 |
set_seed(SEED)
|
| 50 |
|
| 51 |
-
HF_TOKEN = os.environ.get('HF_TOKEN')
|
| 52 |
device = torch.device("cuda" if torch.cuda.is_available() else "cpu")
|
| 53 |
print(f"Device detected: {device}")
|
| 54 |
|
|
|
|
| 48 |
|
| 49 |
set_seed(SEED)
|
| 50 |
|
| 51 |
+
HF_TOKEN = os.environ.get('HF_TOKEN') # Set HF_TOKEN environment variable
|
| 52 |
device = torch.device("cuda" if torch.cuda.is_available() else "cpu")
|
| 53 |
print(f"Device detected: {device}")
|
| 54 |
|
Indobert-base-p1_with_law_log1p.py
CHANGED
|
@@ -114,13 +114,13 @@ def set_seed(seed: int):
|
|
| 114 |
set_seed(SEED)
|
| 115 |
|
| 116 |
# Hugging Face token (optional) - prefer setting this in your environment
|
| 117 |
-
HF_TOKEN = os.environ.get('HF_TOKEN')
|
| 118 |
|
| 119 |
# Optional: You can paste a Weights & Biases API key here to avoid interactive prompts.
|
| 120 |
# Warning: embedding secrets in source code is not recommended for security reasons.
|
| 121 |
# Prefer setting the WANDB_API_KEY environment variable. If you still want to hardcode
|
| 122 |
# the key for convenience, paste it below as a string.
|
| 123 |
-
WANDB_API_KEY_INLINE =
|
| 124 |
|
| 125 |
# W&B project configuration — change if you want a different project/entity
|
| 126 |
WANDB_ENTITY = os.environ.get('WANDB_ENTITY') or 'evansteam'
|
|
@@ -507,11 +507,12 @@ print(f" Max length: {MAX_LENGTH}")
|
|
| 507 |
# is present we still proceed without W&B; setting the API key here avoids
|
| 508 |
# interactive prompts that can block execution.
|
| 509 |
try:
|
| 510 |
-
# prefer inline key, then env
|
| 511 |
-
wandb_api = WANDB_API_KEY_INLINE or os.environ.get("WANDB_API_KEY")
|
| 512 |
|
| 513 |
# Export env vars so Trainer/wandb integrations pick them up non-interactively
|
| 514 |
-
|
|
|
|
| 515 |
os.environ['WANDB_ENTITY'] = WANDB_ENTITY
|
| 516 |
os.environ['WANDB_PROJECT'] = WANDB_PROJECT
|
| 517 |
|
|
|
|
| 114 |
set_seed(SEED)
|
| 115 |
|
| 116 |
# Hugging Face token (optional) - prefer setting this in your environment
|
| 117 |
+
HF_TOKEN = os.environ.get('HF_TOKEN') # Set HF_TOKEN environment variable
|
| 118 |
|
| 119 |
# Optional: You can paste a Weights & Biases API key here to avoid interactive prompts.
|
| 120 |
# Warning: embedding secrets in source code is not recommended for security reasons.
|
| 121 |
# Prefer setting the WANDB_API_KEY environment variable. If you still want to hardcode
|
| 122 |
# the key for convenience, paste it below as a string.
|
| 123 |
+
WANDB_API_KEY_INLINE = None # Set WANDB_API_KEY environment variable instead
|
| 124 |
|
| 125 |
# W&B project configuration — change if you want a different project/entity
|
| 126 |
WANDB_ENTITY = os.environ.get('WANDB_ENTITY') or 'evansteam'
|
|
|
|
| 507 |
# is present we still proceed without W&B; setting the API key here avoids
|
| 508 |
# interactive prompts that can block execution.
|
| 509 |
try:
|
| 510 |
+
# prefer inline key, then env
|
| 511 |
+
wandb_api = WANDB_API_KEY_INLINE or os.environ.get("WANDB_API_KEY")
|
| 512 |
|
| 513 |
# Export env vars so Trainer/wandb integrations pick them up non-interactively
|
| 514 |
+
if wandb_api:
|
| 515 |
+
os.environ['WANDB_API_KEY'] = wandb_api
|
| 516 |
os.environ['WANDB_ENTITY'] = WANDB_ENTITY
|
| 517 |
os.environ['WANDB_PROJECT'] = WANDB_PROJECT
|
| 518 |
|
Indobert-base-p1_with_law_nozero.py
CHANGED
|
@@ -114,13 +114,13 @@ def set_seed(seed: int):
|
|
| 114 |
set_seed(SEED)
|
| 115 |
|
| 116 |
# Hugging Face token (optional) - prefer setting this in your environment
|
| 117 |
-
HF_TOKEN = os.environ.get('HF_TOKEN')
|
| 118 |
|
| 119 |
# Optional: You can paste a Weights & Biases API key here to avoid interactive prompts.
|
| 120 |
# Warning: embedding secrets in source code is not recommended for security reasons.
|
| 121 |
# Prefer setting the WANDB_API_KEY environment variable. If you still want to hardcode
|
| 122 |
# the key for convenience, paste it below as a string.
|
| 123 |
-
WANDB_API_KEY_INLINE =
|
| 124 |
|
| 125 |
# W&B project configuration — change if you want a different project/entity
|
| 126 |
WANDB_ENTITY = os.environ.get('WANDB_ENTITY') or 'evansteam'
|
|
@@ -507,11 +507,12 @@ print(f" Max length: {MAX_LENGTH}")
|
|
| 507 |
# is present we still proceed without W&B; setting the API key here avoids
|
| 508 |
# interactive prompts that can block execution.
|
| 509 |
try:
|
| 510 |
-
# prefer inline key, then env
|
| 511 |
-
wandb_api = WANDB_API_KEY_INLINE or os.environ.get("WANDB_API_KEY")
|
| 512 |
|
| 513 |
# Export env vars so Trainer/wandb integrations pick them up non-interactively
|
| 514 |
-
|
|
|
|
| 515 |
os.environ['WANDB_ENTITY'] = WANDB_ENTITY
|
| 516 |
os.environ['WANDB_PROJECT'] = WANDB_PROJECT
|
| 517 |
|
|
|
|
| 114 |
set_seed(SEED)
|
| 115 |
|
| 116 |
# Hugging Face token (optional) - prefer setting this in your environment
|
| 117 |
+
HF_TOKEN = os.environ.get('HF_TOKEN') # Set HF_TOKEN environment variable
|
| 118 |
|
| 119 |
# Optional: You can paste a Weights & Biases API key here to avoid interactive prompts.
|
| 120 |
# Warning: embedding secrets in source code is not recommended for security reasons.
|
| 121 |
# Prefer setting the WANDB_API_KEY environment variable. If you still want to hardcode
|
| 122 |
# the key for convenience, paste it below as a string.
|
| 123 |
+
WANDB_API_KEY_INLINE = None # Set WANDB_API_KEY environment variable instead
|
| 124 |
|
| 125 |
# W&B project configuration — change if you want a different project/entity
|
| 126 |
WANDB_ENTITY = os.environ.get('WANDB_ENTITY') or 'evansteam'
|
|
|
|
| 507 |
# is present we still proceed without W&B; setting the API key here avoids
|
| 508 |
# interactive prompts that can block execution.
|
| 509 |
try:
|
| 510 |
+
# prefer inline key, then env
|
| 511 |
+
wandb_api = WANDB_API_KEY_INLINE or os.environ.get("WANDB_API_KEY")
|
| 512 |
|
| 513 |
# Export env vars so Trainer/wandb integrations pick them up non-interactively
|
| 514 |
+
if wandb_api:
|
| 515 |
+
os.environ['WANDB_API_KEY'] = wandb_api
|
| 516 |
os.environ['WANDB_ENTITY'] = WANDB_ENTITY
|
| 517 |
os.environ['WANDB_PROJECT'] = WANDB_PROJECT
|
| 518 |
|
README.md
CHANGED
|
@@ -10,9 +10,10 @@ curl --proto '=https' --tlsv1.2 -sSf https://raw.githubusercontent.com/huggingfa
|
|
| 10 |
Untuk menyalin repository ini menggunakan token GitHub (cara ini sudah sesuai permintaan):
|
| 11 |
|
| 12 |
```bash
|
| 13 |
-
git clone https://
|
| 14 |
|
| 15 |
-
|
|
|
|
| 16 |
```
|
| 17 |
|
| 18 |
---
|
|
|
|
| 10 |
Untuk menyalin repository ini menggunakan token GitHub (cara ini sudah sesuai permintaan):
|
| 11 |
|
| 12 |
```bash
|
| 13 |
+
git clone https://github.com/patrickSevans123/skripsi-regression.git
|
| 14 |
|
| 15 |
+
# Set remote with your HF token from environment variable
|
| 16 |
+
git remote set-url origin https://evanslur:$HF_TOKEN@huggingface.co/datasets/evanslur/regression-skripsi
|
| 17 |
```
|
| 18 |
|
| 19 |
---
|