File size: 1,069 Bytes
cb9e677
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
{
 "cells": [
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {},
   "outputs": [],
   "source": [
    "from huggingface_hub import HfApi, HfFolder, Repository\n",
    "\n",
    "repo_id = \"your_username/your_model_name\"\n",
    "repo_local_path = \"./path_to_your_model\"\n",
    "\n",
    "# Create the repository object and clone the repo\n",
    "repo = Repository(local_dir=repo_local_path, clone_from=repo_id)\n",
    "\n",
    "# Copy your model files to the repository\n",
    "model_files = [\"config.json\", \"pytorch_model.bin\", \"tokenizer_config.json\", \"vocab.json\"]\n",
    "for file in model_files:\n",
    "    shutil.copy(file, repo_local_path)\n",
    "\n",
    "# Push the model files to the repository\n",
    "repo.push_to_hub(commit_message=\"Initial model upload\")\n"
   ]
  }
 ],
 "metadata": {
  "kernelspec": {
   "display_name": "chemistralpy310",
   "language": "python",
   "name": "python3"
  },
  "language_info": {
   "name": "python",
   "version": "3.10.14"
  }
 },
 "nbformat": 4,
 "nbformat_minor": 2
}