Sheikh / FINAL_UPLOAD.py
megharudushi's picture
Upload folder using huggingface_hub
7d3d63c verified
#!/usr/bin/env python3
"""
FINAL UPLOAD SCRIPT - Run this after authentication
Repository: megharudushi/Sheikh
"""
import os
from huggingface_hub import HfApi, create_repo, upload_folder
def final_upload():
"""Upload the complete Bengali AI model"""
print("🇧🇩 FINAL BANGLI AI UPLOAD")
print("=" * 35)
# Initialize API
api = HfApi()
try:
# Check authentication
user = api.whoami()
print(f"✅ Authenticated as: {user['name']}")
# Repository details
repo_id = "megharudushi/Sheikh"
local_dir = "./ready_bengali_ai"
# Verify files
files = os.listdir(local_dir)
print(f"📁 Found {len(files)} files to upload:")
for file in sorted(files):
size = os.path.getsize(f"{local_dir}/{file}") / (1024*1024)
print(f" 📄 {file} ({size:.1f}MB)")
# Create repository
print(f"\n🔗 Creating/Accessing repository: {repo_id}")
repo_url = create_repo(
repo_id=repo_id,
exist_ok=True,
repo_type="model"
)
print(f"✅ Repository ready!")
# Upload everything
print(f"\n📤 Uploading model to Hugging Face...")
upload_folder(
folder_path=local_dir,
repo_id=repo_id,
commit_message="Complete Bengali AI model - 355M parameters with full tokenizer"
)
print("\n🎉 SUCCESS! Model uploaded!")
print(f"🌐 View at: https://huggingface.co/{repo_id}")
print(f"📦 Model ready for use by anyone!")
return True
except Exception as e:
print(f"❌ Upload failed: {e}")
return False
if __name__ == "__main__":
# Run upload
success = final_upload()
if success:
print("\n" + "="*50)
print("🎊 CONGRATULATIONS!")
print("Your Bengali AI model is now live on Hugging Face!")
print("Repository: https://huggingface.co/megharudushi/Sheikh")
print("Anyone can now use your model with:")
print("```python")
print("from transformers import AutoTokenizer, AutoModelForCausalLM")
print('tokenizer = AutoTokenizer.from_pretrained("megharudushi/Sheikh")')
print('model = AutoModelForCausalLM.from_pretrained("megharudushi/Sheikh")')
print("```")
print("="*50)
else:
print("\n🔧 Please check authentication and try again.")