Update RMS LayerNorm implementation, and list compr. change in chat templates (#1974)

* Update RMS LayerNorm implementation with optimizations and testing suite

* perf: optimize list comprehension in get_ollama_eos_tokens
This commit is contained in:
Nino Risteski 2025-03-14 10:53:21 +01:00 committed by GitHub
commit f4d97caf5e
2 changed files with 1 additions and 5 deletions

View file

@ -1512,10 +1512,7 @@ def get_ollama_eos_tokens(tokenizer, extra_eos_tokens = []):
# Remove duplicates
splitted = joined_text.split("\x01\x00")
final_eos_tokens = []
for old, new in zip(added_tokens_decoder, splitted):
if old == new: final_eos_tokens.append(old)
pass
final_eos_tokens = [old for old, new in zip(added_tokens_decoder, splitted) if old == new]
final_eos_tokens += extra_eos_tokens
final_eos_tokens += repeatted_tokens

View file

@ -256,7 +256,6 @@ def unpatch_rms_layernorm():
except:
pass
return
return
pass