cklxx commited on
Commit
e02e201
·
verified ·
1 Parent(s): 4307208

laya_browser.py: no ModernBERT auto-compile (works without a Triton toolchain); README uses `hf download`

Browse files
code/apps/laya_browser.py CHANGED
@@ -193,6 +193,10 @@ class LayaBrowser:
193
  kw["fast"] = True # laya >= 0.3.7
194
  agent = laya.load(repo, device=device, **kw)
195
  agent.cfg["max_len"], agent.cfg["head_max_len"] = 1024, agent.cfg.get("head_max_len_train", 768)
 
 
 
 
196
  return cls(agent)
197
 
198
  def decide(self, page, goal, history=()):
 
193
  kw["fast"] = True # laya >= 0.3.7
194
  agent = laya.load(repo, device=device, **kw)
195
  agent.cfg["max_len"], agent.cfg["head_max_len"] = 1024, agent.cfg.get("head_max_len_train", 768)
196
+ try: # ModernBERT would torch.compile its embeddings on first use (needs a working Triton/C toolchain)
197
+ agent.model.encoder.config.reference_compile = False
198
+ except AttributeError:
199
+ pass
200
  return cls(agent)
201
 
202
  def decide(self, page, goal, history=()):
encoder/config.json CHANGED
@@ -75,5 +75,6 @@
75
  "sparse_prediction": false,
76
  "tie_word_embeddings": true,
77
  "transformers_version": "5.17.0",
78
- "vocab_size": 256000
79
- }
 
 
75
  "sparse_prediction": false,
76
  "tie_word_embeddings": true,
77
  "transformers_version": "5.17.0",
78
+ "vocab_size": 256000,
79
+ "reference_compile": false
80
+ }
laya_browser.py CHANGED
@@ -193,6 +193,10 @@ class LayaBrowser:
193
  kw["fast"] = True # laya >= 0.3.7
194
  agent = laya.load(repo, device=device, **kw)
195
  agent.cfg["max_len"], agent.cfg["head_max_len"] = 1024, agent.cfg.get("head_max_len_train", 768)
 
 
 
 
196
  return cls(agent)
197
 
198
  def decide(self, page, goal, history=()):
 
193
  kw["fast"] = True # laya >= 0.3.7
194
  agent = laya.load(repo, device=device, **kw)
195
  agent.cfg["max_len"], agent.cfg["head_max_len"] = 1024, agent.cfg.get("head_max_len_train", 768)
196
+ try: # ModernBERT would torch.compile its embeddings on first use (needs a working Triton/C toolchain)
197
+ agent.model.encoder.config.reference_compile = False
198
+ except AttributeError:
199
+ pass
200
  return cls(agent)
201
 
202
  def decide(self, page, goal, history=()):