Fix Access for Gated Models

#5
by ankity09 - opened
Files changed (1) hide show
  1. src/app.py +5 -0
src/app.py CHANGED
@@ -5,6 +5,7 @@ from utils import extract_from_url, get_model, calculate_memory
5
  import plotly.express as px
6
  import numpy as np
7
  import gc
 
8
 
9
  st.set_page_config(page_title='Can you run it? LLM version', layout="wide", initial_sidebar_state="expanded")
10
 
@@ -105,6 +106,10 @@ with col.expander("Information", expanded=True):
105
  st.latex(r"\text{Memory}_\text{LoRa} \approx \text{Model Size} + \left(\text{ \# trainable Params}_\text{Billions}\times\frac{16}{8} \times 4\right) \times 1.2")
106
 
107
  access_token = st.sidebar.text_input("Access token")
 
 
 
 
108
  #model_name = st.sidebar.text_input("Model name", value="mistralai/Mistral-7B-v0.1")
109
  with st.sidebar.container():
110
  model_name = stDatalist("Model name (Press Enter to apply)", model_list, index=0)
 
5
  import plotly.express as px
6
  import numpy as np
7
  import gc
8
+ from huggingface_hub import login
9
 
10
  st.set_page_config(page_title='Can you run it? LLM version', layout="wide", initial_sidebar_state="expanded")
11
 
 
106
  st.latex(r"\text{Memory}_\text{LoRa} \approx \text{Model Size} + \left(\text{ \# trainable Params}_\text{Billions}\times\frac{16}{8} \times 4\right) \times 1.2")
107
 
108
  access_token = st.sidebar.text_input("Access token")
109
+
110
+ if access_token:
111
+ login(token=access_token)
112
+
113
  #model_name = st.sidebar.text_input("Model name", value="mistralai/Mistral-7B-v0.1")
114
  with st.sidebar.container():
115
  model_name = stDatalist("Model name (Press Enter to apply)", model_list, index=0)