CISCai commited on
Commit
e54c92d
1 Parent(s): 6716ce3
Files changed (1) hide show
  1. app.py +14 -15
app.py CHANGED
@@ -1018,21 +1018,19 @@ Any framework based on `llama-cpp-python` will let you select which chat templat
1018
  for k, v in meta.key.items():
1019
  m.append([*human_readable_metadata(meta, k, v[0], v[1])])
1020
 
1021
- link = str(request.request.url_for('download', repo_file = meta.var['repo_file']).include_query_params(branch = meta.var['branch']))
1022
  if link.startswith('http:'):
1023
  link = 'https' + link[4:]
1024
 
1025
- if meta.rem or meta.add:
1026
- link += '&' + urlencode(
1027
- {
1028
- 'session': request.session_hash,
1029
- 'state': str(meta_state._id),
1030
- # 'rem': meta.rem,
1031
- # 'add': [json.dumps([k, *v], ensure_ascii = False, separators = (',', ':')) for k, v in meta.add.items()],
1032
- },
1033
- doseq = True,
1034
- safe = '[]{}:"\',',
1035
- )
1036
 
1037
  return {
1038
  meta_state: meta,
@@ -1354,7 +1352,7 @@ Any framework based on `llama-cpp-python` will let you select which chat templat
1354
  def stream_repo_file(
1355
  repo_file: str,
1356
  branch: str,
1357
- add_meta: list[str] | None,
1358
  rem_meta: list[str] | None,
1359
  token: str | None = None,
1360
  ):
@@ -1384,7 +1382,6 @@ def stream_repo_file(
1384
 
1385
  tokens = gguf.metadata.get('tokenizer.ggml.tokens')
1386
  for k in add_meta:
1387
- k = json.loads(k)
1388
  if isinstance(k, list) and len(k) == 3:
1389
  if isinstance(k[2], dict):
1390
  if tokens:
@@ -1451,7 +1448,9 @@ if __name__ == "__main__":
1451
  rem = list(meta.rem)
1452
 
1453
  if meta.add:
1454
- add = [json.dumps([k, *v], ensure_ascii = False, separators = (',', ':')) for k, v in meta.add.items()]
 
 
1455
 
1456
  stream = stream_repo_file(
1457
  repo_file,
 
1018
  for k, v in meta.key.items():
1019
  m.append([*human_readable_metadata(meta, k, v[0], v[1])])
1020
 
1021
+ link = str(request.request.url_for('download', repo_file = meta.var['repo_file']).include_query_params(branch = meta.var['branch'], session = request.session_hash, state = str(meta_state._id)))
1022
  if link.startswith('http:'):
1023
  link = 'https' + link[4:]
1024
 
1025
+ # if meta.rem or meta.add:
1026
+ # link += '&' + urlencode(
1027
+ # {
1028
+ # 'rem': meta.rem,
1029
+ # 'add': [json.dumps([k, *v], ensure_ascii = False, separators = (',', ':')) for k, v in meta.add.items()],
1030
+ # },
1031
+ # doseq = True,
1032
+ # safe = '[]{}:"\',',
1033
+ # )
 
 
1034
 
1035
  return {
1036
  meta_state: meta,
 
1352
  def stream_repo_file(
1353
  repo_file: str,
1354
  branch: str,
1355
+ add_meta: list[Any] | None,
1356
  rem_meta: list[str] | None,
1357
  token: str | None = None,
1358
  ):
 
1382
 
1383
  tokens = gguf.metadata.get('tokenizer.ggml.tokens')
1384
  for k in add_meta:
 
1385
  if isinstance(k, list) and len(k) == 3:
1386
  if isinstance(k[2], dict):
1387
  if tokens:
 
1448
  rem = list(meta.rem)
1449
 
1450
  if meta.add:
1451
+ add = [[k, *v] for k, v in meta.add.items()]
1452
+ elif add:
1453
+ add = [json.loads(a) for a in add]
1454
 
1455
  stream = stream_repo_file(
1456
  repo_file,