swap to sys exit
Browse files
HF Login Snippet Kaggle.py
CHANGED
|
@@ -1,5 +1,6 @@
|
|
| 1 |
#import required functions
|
| 2 |
import os
|
|
|
|
| 3 |
from huggingface_hub import login, get_token, whoami
|
| 4 |
|
| 5 |
#get token
|
|
@@ -31,13 +32,13 @@ while True:
|
|
| 31 |
Either set the environment variable to a 'WRITE' token or remove it.
|
| 32 |
''')
|
| 33 |
input("Press enter to continue.")
|
| 34 |
-
exit()
|
| 35 |
if os.environ.get('COLAB_BACKEND_VERSION', None) is not None:
|
| 36 |
print('''
|
| 37 |
Your Colab secret key is read-only
|
| 38 |
Please switch your key to 'write' or disable notebook access on the left.
|
| 39 |
-
For now, you are stuck in a loop
|
| 40 |
''')
|
|
|
|
| 41 |
elif os.environ.get('KAGGLE_KERNEL_RUN_TYPE', None) is not None:
|
| 42 |
print('''
|
| 43 |
Your Kaggle secret key is read-only
|
|
|
|
| 1 |
#import required functions
|
| 2 |
import os
|
| 3 |
+
import sys
|
| 4 |
from huggingface_hub import login, get_token, whoami
|
| 5 |
|
| 6 |
#get token
|
|
|
|
| 32 |
Either set the environment variable to a 'WRITE' token or remove it.
|
| 33 |
''')
|
| 34 |
input("Press enter to continue.")
|
| 35 |
+
sys.exit("Exiting...")
|
| 36 |
if os.environ.get('COLAB_BACKEND_VERSION', None) is not None:
|
| 37 |
print('''
|
| 38 |
Your Colab secret key is read-only
|
| 39 |
Please switch your key to 'write' or disable notebook access on the left.
|
|
|
|
| 40 |
''')
|
| 41 |
+
sys.exit("Stuck in a loop, exiting...")
|
| 42 |
elif os.environ.get('KAGGLE_KERNEL_RUN_TYPE', None) is not None:
|
| 43 |
print('''
|
| 44 |
Your Kaggle secret key is read-only
|