{ "cells": [ { "cell_type": "code", "execution_count": 4, "metadata": {}, "outputs": [ { "ename": "AttributeError", "evalue": "'BGEM3FlagModel' object has no attribute 'push_to_hub'", "output_type": "error", "traceback": [ "\u001b[0;31m---------------------------------------------------------------------------\u001b[0m", "\u001b[0;31mAttributeError\u001b[0m Traceback (most recent call last)", "Cell \u001b[0;32mIn[4], line 8\u001b[0m\n\u001b[1;32m 2\u001b[0m \u001b[38;5;28;01mfrom\u001b[39;00m \u001b[38;5;21;01mFlagEmbedding\u001b[39;00m \u001b[38;5;28;01mimport\u001b[39;00m BGEM3FlagModel\n\u001b[1;32m 4\u001b[0m model \u001b[38;5;241m=\u001b[39m BGEM3FlagModel(\u001b[38;5;124m'\u001b[39m\u001b[38;5;124m/data/models/bge-m3_finetuned\u001b[39m\u001b[38;5;124m'\u001b[39m, \n\u001b[1;32m 5\u001b[0m use_fp16\u001b[38;5;241m=\u001b[39m\u001b[38;5;28;01mTrue\u001b[39;00m) \u001b[38;5;66;03m# Setting use_fp16 to True speeds up computation with a slight performance degradation\u001b[39;00m\n\u001b[0;32m----> 8\u001b[0m \u001b[43mmodel\u001b[49m\u001b[38;5;241;43m.\u001b[39;49m\u001b[43mpush_to_hub\u001b[49m(\u001b[38;5;124m\"\u001b[39m\u001b[38;5;124mdophys/bge-m3_finetuned\u001b[39m\u001b[38;5;124m\"\u001b[39m)\n", "\u001b[0;31mAttributeError\u001b[0m: 'BGEM3FlagModel' object has no attribute 'push_to_hub'" ] } ], "source": [ "from transformers import BertConfig, BertModel\n", "from FlagEmbedding import BGEM3FlagModel\n", "\n", "model = BGEM3FlagModel('/data/models/bge-m3_finetuned', \n", " use_fp16=True) # Setting use_fp16 to True speeds up computation with a slight performance degradation\n", "\n", "\n", "model.push_to_hub(\"dophys/bge-m3_finetuned\")" ] } ], "metadata": { "kernelspec": { "display_name": "base", "language": "python", "name": "python3" }, "language_info": { "codemirror_mode": { "name": "ipython", "version": 3 }, "file_extension": ".py", "mimetype": "text/x-python", "name": "python", "nbconvert_exporter": "python", "pygments_lexer": "ipython3", "version": "3.11.5" } }, "nbformat": 4, "nbformat_minor": 2 }