alfraser commited on
Commit
57b94ca
·
1 Parent(s): 79f35e2

Added ability to select which models to compare side by side, allowing for more flexibility in testing my fine-tuned llamas

Browse files
Files changed (1) hide show
  1. pages/010_LLM_Architectures.py +40 -31
pages/010_LLM_Architectures.py CHANGED
@@ -17,43 +17,52 @@ def show_side_by_side() -> None:
17
  st.divider()
18
  header_container = st.container()
19
  arch_outer_container = st.container()
20
- with arch_outer_container:
21
- arch_cols = st.columns(len(Architecture.architectures))
22
 
23
  # Build header
24
  with header_container:
25
  st.write("### Side by side comparison of architectures")
26
- st.write('Enter a question below to have it sent to all available architectures to compare timing and response.')
27
- prompt = st.chat_input("Ask a question")
28
- if prompt:
29
- st.write(f"**Question:** {prompt}")
30
 
31
- # Now build the columns
32
- with arch_outer_container:
33
- if prompt:
34
- # Build columns per architecture
35
- for i, a in enumerate(Architecture.architectures):
36
- with arch_cols[i]:
37
- st.write(f'#### {a.name}')
38
-
39
- # Now dispatch the messages per architecture
40
- group_tag = generate_group_tag()
41
- for i, a in enumerate(Architecture.architectures):
42
- request = ArchitectureRequest(query=prompt)
43
- with arch_cols[i]:
44
- with st.spinner('Architecture processing request'):
45
- start = time()
46
- a(request, trace_tags=["UI", "SideBySideCompare", group_tag])
47
- elapsed_in_s = (int((time() - start) * 10))/10 # round to 1dp in seconds
48
- st.write('##### Timing')
49
- st.write(f'Request took **{elapsed_in_s}s**')
50
- st.write('##### Response')
51
- st.write(request.response)
52
  else:
53
- # Build columns per architecture for display only
54
- for i, a in enumerate(Architecture.architectures):
55
- with arch_cols[i]:
56
- st.write(f'#### {a.name}')
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
57
 
58
 
59
  def show_architecture(architecture: str) -> None:
 
17
  st.divider()
18
  header_container = st.container()
19
  arch_outer_container = st.container()
20
+
 
21
 
22
  # Build header
23
  with header_container:
24
  st.write("### Side by side comparison of architectures")
25
+ st.write('Enter a question below to have it sent to the selected architectures to compare timing and response.')
 
 
 
26
 
27
+ options = [a.name for a in Architecture.architectures]
28
+ selected_archs = st.multiselect("Select architectures to use", options=options, default=options)
29
+
30
+ if len(selected_archs) == 0:
31
+ st.write("To get started select some architectures to compare")
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
32
  else:
33
+ prompt = st.chat_input("Ask a question")
34
+ if prompt:
35
+ st.write(f"**Question:** {prompt}")
36
+
37
+ # Now build the columns
38
+ if len(selected_archs) > 0:
39
+ with arch_outer_container:
40
+ arch_cols = st.columns(len(selected_archs))
41
+ if prompt:
42
+ # Build columns per architecture
43
+ for i, a in enumerate(selected_archs):
44
+ with arch_cols[i]:
45
+ st.write(f'#### {a}')
46
+
47
+ # Now dispatch the messages per architecture
48
+ group_tag = generate_group_tag()
49
+ for i, a in enumerate(selected_archs):
50
+ request = ArchitectureRequest(query=prompt)
51
+ arch = Architecture.get_architecture(a)
52
+ with arch_cols[i]:
53
+ with st.spinner('Architecture processing request'):
54
+ start = time()
55
+ arch(request, trace_tags=["UI", "SideBySideCompare", group_tag])
56
+ elapsed_in_s = (int((time() - start) * 10))/10 # round to 1dp in seconds
57
+ st.write('##### Timing')
58
+ st.write(f'Request took **{elapsed_in_s}s**')
59
+ st.write('##### Response')
60
+ st.write(request.response)
61
+ else:
62
+ # Build columns per architecture for display only
63
+ for i, a in enumerate(selected_archs):
64
+ with arch_cols[i]:
65
+ st.write(f'#### {a}')
66
 
67
 
68
  def show_architecture(architecture: str) -> None: