Feature Extraction
Transformers
Safetensors
lemondecider_decision
decision-model
typed-decisions
multimodal
custom_code
Instructions to use inclusionAI/LemonDecider with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Transformers
How to use inclusionAI/LemonDecider with Transformers:
# Use a pipeline as a high-level helper from transformers import pipeline pipe = pipeline("feature-extraction", model="inclusionAI/LemonDecider", trust_remote_code=True)# pip install -U transformers accelerate # Load model directly from transformers import AutoModel model = AutoModel.from_pretrained("inclusionAI/LemonDecider", trust_remote_code=True, device_map="auto") - Notebooks
- Google Colab
- Kaggle
Update code/smoke_test.py
Browse files- smoke_test.py +24 -0
smoke_test.py
ADDED
|
@@ -0,0 +1,24 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
#!/usr/bin/env python3
|
| 2 |
+
import argparse,json,urllib.request,urllib.error,math
|
| 3 |
+
from pathlib import Path
|
| 4 |
+
p=argparse.ArgumentParser();p.add_argument('--url',default='http://127.0.0.1:8000');a=p.parse_args()
|
| 5 |
+
body=json.loads((Path(__file__).resolve().parents[1]/'examples/request.json').read_text())
|
| 6 |
+
with urllib.request.urlopen(a.url+'/health',timeout=30) as r:assert json.load(r)['status']=='ready'
|
| 7 |
+
def post(b):
|
| 8 |
+
q=urllib.request.Request(a.url+'/v1/systemone',data=json.dumps(b).encode(),headers={'Content-Type':'application/json'})
|
| 9 |
+
with urllib.request.urlopen(q,timeout=180) as r:return json.load(r)
|
| 10 |
+
for b in [dict(body,questions={'intent':body['questions']['intent']}),body]:
|
| 11 |
+
result=post(b);assert set(result['answers'])==set(b['questions'])
|
| 12 |
+
for k,q in b['questions'].items():
|
| 13 |
+
ans=result['answers'][k];assert ans['type']==q['type']
|
| 14 |
+
if q['type']=='choice':
|
| 15 |
+
probs=ans['probabilities'];assert set(probs)==set(q['criteria'])
|
| 16 |
+
assert all(math.isfinite(x) and 0<=x<=1 for x in probs.values()) and abs(sum(probs.values())-1)<0.01
|
| 17 |
+
assert ans['choice'] in probs
|
| 18 |
+
else:assert math.isfinite(ans['noul']) and 0<=ans['noul']<=1
|
| 19 |
+
print(json.dumps(result))
|
| 20 |
+
try:post(dict(body,state='hello '*20000))
|
| 21 |
+
except urllib.error.HTTPError as e:
|
| 22 |
+
detail=e.read().decode();assert e.code==422 and 'exceeds maximum context length' in detail,detail
|
| 23 |
+
else:raise AssertionError('Expected explicit capacity rejection, not truncation')
|
| 24 |
+
print('HTTP_SMOKE_OK; not a full evaluation or numerical parity certification')
|