Spaces:
Paused
Paused
Upload folder using huggingface_hub
Browse files- requirements.txt +1 -1
- update_space.py +8 -3
requirements.txt
CHANGED
|
@@ -1,3 +1,4 @@
|
|
|
|
|
| 1 |
accelerate>=0.27.0
|
| 2 |
bitsandbytes>=0.41.0
|
| 3 |
datasets>=2.15.0
|
|
@@ -18,7 +19,6 @@ requests>=2.31.0
|
|
| 18 |
safetensors>=0.4.1
|
| 19 |
sentencepiece>=0.1.99
|
| 20 |
tensorboard>=2.15.0
|
| 21 |
-
torch>=2.0.0
|
| 22 |
tqdm>=4.65.0
|
| 23 |
transformers>=4.36.0
|
| 24 |
typing-extensions>=4.8.0
|
|
|
|
| 1 |
+
torch>=2.0.0
|
| 2 |
accelerate>=0.27.0
|
| 3 |
bitsandbytes>=0.41.0
|
| 4 |
datasets>=2.15.0
|
|
|
|
| 19 |
safetensors>=0.4.1
|
| 20 |
sentencepiece>=0.1.99
|
| 21 |
tensorboard>=2.15.0
|
|
|
|
| 22 |
tqdm>=4.65.0
|
| 23 |
transformers>=4.36.0
|
| 24 |
typing-extensions>=4.8.0
|
update_space.py
CHANGED
|
@@ -121,12 +121,17 @@ def update_requirements():
|
|
| 121 |
# Add new requirements
|
| 122 |
updated_requirements = existing_requirements.union(required_packages)
|
| 123 |
|
| 124 |
-
# Write updated requirements
|
| 125 |
with open(req_path, 'w') as f:
|
| 126 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 127 |
f.write(f"{req}\n")
|
| 128 |
|
| 129 |
-
logger.info("Updated requirements.txt with necessary packages")
|
| 130 |
|
| 131 |
def create_space(username, space_name):
|
| 132 |
"""Create or get a Hugging Face Space."""
|
|
|
|
| 121 |
# Add new requirements
|
| 122 |
updated_requirements = existing_requirements.union(required_packages)
|
| 123 |
|
| 124 |
+
# Write updated requirements with torch first
|
| 125 |
with open(req_path, 'w') as f:
|
| 126 |
+
# Ensure torch is first
|
| 127 |
+
torch_req = next((req for req in updated_requirements if req.startswith("torch")), "torch>=2.0.0")
|
| 128 |
+
f.write(f"{torch_req}\n")
|
| 129 |
+
|
| 130 |
+
# Write remaining requirements
|
| 131 |
+
for req in sorted(r for r in updated_requirements if not r.startswith("torch")):
|
| 132 |
f.write(f"{req}\n")
|
| 133 |
|
| 134 |
+
logger.info("Updated requirements.txt with necessary packages (torch listed first)")
|
| 135 |
|
| 136 |
def create_space(username, space_name):
|
| 137 |
"""Create or get a Hugging Face Space."""
|