cllatMTK commited on
Commit
bd01cf4
1 Parent(s): c4939c7

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +4 -3
app.py CHANGED
@@ -12,7 +12,7 @@ if 'model_config' not in st.session_state:
12
  st.session_state['model_config'] = {}
13
 
14
 
15
- def load_model_config(model_id):
16
  if 'model_id' in st.session_state['model_config'] and st.session_state['model_config']['model_id'] == model_id:
17
  return st.session_state['model_config']
18
  if 'parameter_count' in st.session_state:
@@ -41,7 +41,7 @@ def load_model_config(model_id):
41
  model_config['layernorm_operation'] = 2
42
 
43
  try:
44
- model_config['model'] = get_model(model_id, None, None)
45
  module_tensors = get_module_tensors(model_config['model'])
46
  model_config['module_classes'] = classify_module(module_tensors)
47
  except Exception as e:
@@ -85,7 +85,8 @@ inference_info = {}
85
  with col1:
86
  header4("Model")
87
  model_id = st.text_input("huggingface model id", 'ArthurZ/opt-13b')
88
- model_config = load_model_config(model_id)
 
89
  model_config['hidden_size'] = st.number_input('hidden size', value=model_config['hidden_size'], format ="%d")
90
  model_config['num_attention_heads'] = st.number_input('num attention heads', value=model_config['num_attention_heads'], format ="%d")
91
  model_config['num_hidden_layers'] = st.number_input('num hidden layers', value=model_config['num_hidden_layers'], format ="%d")
 
12
  st.session_state['model_config'] = {}
13
 
14
 
15
+ def load_model_config(model_id, access_token):
16
  if 'model_id' in st.session_state['model_config'] and st.session_state['model_config']['model_id'] == model_id:
17
  return st.session_state['model_config']
18
  if 'parameter_count' in st.session_state:
 
41
  model_config['layernorm_operation'] = 2
42
 
43
  try:
44
+ model_config['model'] = get_model(model_id, None, access_token=access_token if len(access_token)>0 else None)
45
  module_tensors = get_module_tensors(model_config['model'])
46
  model_config['module_classes'] = classify_module(module_tensors)
47
  except Exception as e:
 
85
  with col1:
86
  header4("Model")
87
  model_id = st.text_input("huggingface model id", 'ArthurZ/opt-13b')
88
+ access_token = st.text_input("access token", '')
89
+ model_config = load_model_config(model_id, access_token)
90
  model_config['hidden_size'] = st.number_input('hidden size', value=model_config['hidden_size'], format ="%d")
91
  model_config['num_attention_heads'] = st.number_input('num attention heads', value=model_config['num_attention_heads'], format ="%d")
92
  model_config['num_hidden_layers'] = st.number_input('num hidden layers', value=model_config['num_hidden_layers'], format ="%d")