from huggingface_hub import HfApi, HfFolder, Repository # Authenticate to the Hugging Face Hub hf_username = "jiahuimbzuai" # Replace with your Hugging Face username hf_token = HfFolder.get_token() # Make sure you've logged in using `huggingface-cli login` # Path to your model files model_directory = "/ukp-storage-1/geng/78076-llava-v1.5-13b-task-lora--textvqa-5k--vlguard" # Create a repository on the Hugging Face Hub api = HfApi() repo_url = api.create_repo(repo_id="llava-v1.5-vlguard-7b", token=hf_token, private=False) # Set `private=True` to create a private repository # Clone the repository and copy your model files repo = Repository(local_dir=model_directory, clone_from=repo_url, use_auth_token=hf_token) repo.git_add() # Add all files in the directory repo.git_commit("Initial commit with my model") repo.git_push() print(f"Model successfully uploaded to: {repo_url}")