asd
Browse files
app.py
CHANGED
@@ -4,6 +4,7 @@ from transformers import AutoModelForCausalLM, AutoTokenizer
|
|
4 |
from peft import PeftModel
|
5 |
from huggingface_hub import HfApi
|
6 |
import gradio as gr
|
|
|
7 |
|
8 |
# Global variables to store the model and tokenizer
|
9 |
merged_model = None
|
@@ -66,11 +67,14 @@ def run_merge_and_push():
|
|
66 |
# Merge models
|
67 |
merged_model, tokenizer = merge_models()
|
68 |
|
|
|
|
|
|
|
|
|
69 |
# Push to Hugging Face Hub
|
70 |
-
hub_repo_name = "NoaiGPT/mergedbatch1"
|
71 |
push_to_hub(hub_repo_name)
|
72 |
|
73 |
-
return "Model merged and pushed to Hugging Face Hub successfully!"
|
74 |
|
75 |
# Gradio interface
|
76 |
with gr.Blocks() as demo:
|
|
|
4 |
from peft import PeftModel
|
5 |
from huggingface_hub import HfApi
|
6 |
import gradio as gr
|
7 |
+
import time
|
8 |
|
9 |
# Global variables to store the model and tokenizer
|
10 |
merged_model = None
|
|
|
67 |
# Merge models
|
68 |
merged_model, tokenizer = merge_models()
|
69 |
|
70 |
+
# Generate a unique repository name
|
71 |
+
timestamp = int(time.time())
|
72 |
+
hub_repo_name = f"your-username/merged-llama3-8b-instruct-{timestamp}"
|
73 |
+
|
74 |
# Push to Hugging Face Hub
|
|
|
75 |
push_to_hub(hub_repo_name)
|
76 |
|
77 |
+
return f"Model merged and pushed to Hugging Face Hub successfully! Repository: {hub_repo_name}"
|
78 |
|
79 |
# Gradio interface
|
80 |
with gr.Blocks() as demo:
|