Skip to content

Commit

Permalink
rebase on peft
Browse files Browse the repository at this point in the history
  • Loading branch information
april-yyt committed Mar 31, 2024
1 parent 0074b8f commit 44f43f5
Showing 1 changed file with 10 additions and 0 deletions.
10 changes: 10 additions & 0 deletions python/flexflow/serve/serve.py
Original file line number Diff line number Diff line change
Expand Up @@ -406,14 +406,21 @@ def __load_hf_weights(self):

def upload_hf_model(self, new_model_id: str, model_path:str, private: bool = False):
"""
<<<<<<< HEAD
Uploads the model to the Hugging Face Hub, with reverse conversion of weights.
=======
Uploads the model weights to the Hugging Face Hub, with reverse conversion of weights.
>>>>>>> cdf24eb0 (modify upload logic and add reconvert functions for opt models)
:param new_model_id: The new model ID for the Hugging Face Hub.
:param model_path: The path where the FlexFlow weights are stored.
:param private: Whether to upload the model as a private model.
"""
print(f"Preparing model for upload to Hugging Face Hub: {new_model_id}")
<<<<<<< HEAD
print("tokenizer path is: ", self.tokenizer_path)
=======
>>>>>>> cdf24eb0 (modify upload logic and add reconvert functions for opt models)

# Initialize a new Hugging Face model instance
hf_model = AutoModelForCausalLM.from_config(self.hf_config)
Expand All @@ -430,6 +437,7 @@ def upload_hf_model(self, new_model_id: str, model_path:str, private: bool = Fal
temp_dir = tempfile.mkdtemp()
hf_model.save_pretrained(temp_dir)

<<<<<<< HEAD
# Copy the tokenizer files to the temporary directory
tokenizer_files = [f for f in os.listdir(self.tokenizer_path)]
for file_name in tokenizer_files:
Expand All @@ -440,6 +448,8 @@ def upload_hf_model(self, new_model_id: str, model_path:str, private: bool = Fal
if os.path.exists(rev_sha_path):
os.remove(rev_sha_path)

=======
>>>>>>> cdf24eb0 (modify upload logic and add reconvert functions for opt models)
# Ensure Hugging Face CLI is logged in
if not HfFolder.get_token():
print("Hugging Face token not found. Please login using `huggingface-cli login`.")
Expand Down

0 comments on commit 44f43f5

Please sign in to comment.