Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
|
@@ -103,9 +103,11 @@ model_id2 = st.text_input("Enter the second HuggingFace Model ID")
|
|
| 103 |
if st.button("Compare Models"):
|
| 104 |
with st.spinner('Comparing models and loading tokenizers...'):
|
| 105 |
if model_id1 and model_id2:
|
|
|
|
| 106 |
struct1 = get_model_structure(model_id1)
|
| 107 |
struct2 = get_model_structure(model_id2)
|
| 108 |
|
|
|
|
| 109 |
diff = compare_structures(struct1, struct2)
|
| 110 |
left_html, right_html, diff_found = display_diff(diff)
|
| 111 |
|
|
@@ -116,19 +118,26 @@ if st.button("Compare Models"):
|
|
| 116 |
col1, col2 = st.columns([1.5, 1.5]) # Adjust the ratio to make columns wider
|
| 117 |
|
| 118 |
with col1:
|
| 119 |
-
st.write("### Model 1")
|
| 120 |
st.markdown(left_html, unsafe_allow_html=True)
|
| 121 |
|
| 122 |
with col2:
|
| 123 |
-
st.write("### Model 2")
|
| 124 |
st.markdown(right_html, unsafe_allow_html=True)
|
| 125 |
|
| 126 |
# Tokenizer verification
|
| 127 |
try:
|
| 128 |
vocab_size1 = get_tokenizer_vocab_size(model_id1)
|
| 129 |
vocab_size2 = get_tokenizer_vocab_size(model_id2)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 130 |
st.write(f"**{model_id1} Tokenizer Vocab Size**: {vocab_size1}")
|
| 131 |
st.write(f"**{model_id2} Tokenizer Vocab Size**: {vocab_size2}")
|
|
|
|
| 132 |
except Exception as e:
|
| 133 |
st.error(f"Error loading tokenizers: {e}")
|
| 134 |
else:
|
|
|
|
| 103 |
if st.button("Compare Models"):
|
| 104 |
with st.spinner('Comparing models and loading tokenizers...'):
|
| 105 |
if model_id1 and model_id2:
|
| 106 |
+
# Get model structures
|
| 107 |
struct1 = get_model_structure(model_id1)
|
| 108 |
struct2 = get_model_structure(model_id2)
|
| 109 |
|
| 110 |
+
# Compare model structures
|
| 111 |
diff = compare_structures(struct1, struct2)
|
| 112 |
left_html, right_html, diff_found = display_diff(diff)
|
| 113 |
|
|
|
|
| 118 |
col1, col2 = st.columns([1.5, 1.5]) # Adjust the ratio to make columns wider
|
| 119 |
|
| 120 |
with col1:
|
| 121 |
+
st.write(f"### Model 1: {model_id1}")
|
| 122 |
st.markdown(left_html, unsafe_allow_html=True)
|
| 123 |
|
| 124 |
with col2:
|
| 125 |
+
st.write(f"### Model 2: {model_id2}")
|
| 126 |
st.markdown(right_html, unsafe_allow_html=True)
|
| 127 |
|
| 128 |
# Tokenizer verification
|
| 129 |
try:
|
| 130 |
vocab_size1 = get_tokenizer_vocab_size(model_id1)
|
| 131 |
vocab_size2 = get_tokenizer_vocab_size(model_id2)
|
| 132 |
+
|
| 133 |
+
if vocab_size1 == vocab_size2:
|
| 134 |
+
st.success("The tokenizer vocab sizes are identical.")
|
| 135 |
+
else:
|
| 136 |
+
st.warning("The tokenizer vocab sizes are different.")
|
| 137 |
+
|
| 138 |
st.write(f"**{model_id1} Tokenizer Vocab Size**: {vocab_size1}")
|
| 139 |
st.write(f"**{model_id2} Tokenizer Vocab Size**: {vocab_size2}")
|
| 140 |
+
|
| 141 |
except Exception as e:
|
| 142 |
st.error(f"Error loading tokenizers: {e}")
|
| 143 |
else:
|