YAML Metadata Warning:empty or missing yaml metadata in repo card
Check out the documentation for more information.
B2 -- Moment Type Classification Model
Local VS Code version (not Colab) -- plain Python scripts, pushes to Hugging Face directly from your machine.
Setup
python3 -m venv venv
source venv/bin/activate # Windows: venv\Scripts\activate
pip install -r requirements.txt
huggingface-cli login # paste a write token when prompted
Run
export MYVILLAGE_API_KEY=your_moments_read_key # NOT the one from the MCP debugging saga -- a fresh key with moments:read scope
python pull_moments.py # produces b2_moments.jsonl, prints real momentType values found
python train.py # trains, evaluates, asks before publishing
Before running train.py for real, open train.py and change HF_REPO to
your actual Hugging Face username/repo.
Why this looks different from A2
- Label set is discovered from data, not hardcoded. The roadmap and API
docs both describe
momentTypeas open-ended ("such as ... and others"), unlike A2's fixed 7-class list.train.pyreads whatever labels actually appear inb2_moments.jsonland builds the classifier around those. - No realistic-sounding synthetic fallback data. Moments cover personal
and emotional content (wellness checks, support, mentorship) -- fabricating
"realistic" examples for that risks looking like real personal disclosures
that never happened. The fallback in
train.pyis deliberately generic placeholder text, only there to prove the pipeline runs, never to be mistaken for a real training result. - Uses the plain REST API, not the MCP server.
pull_moments.pyhitsportal.myvillageproject.aiwith a normal API key as a Bearer token -- a different, so far untested-but-promising path compared to themcp.myvillageproject.aiauth issues hit on A2.
Known uncertainties (untested from outside this environment)
- Response shape from
GET /api/network/momentsisn't fully confirmed --pull_moments.pyprints the raw first-page response so you can check/fix the extraction logic if it doesn't match. - Field name for the moment's main text -- the playbook calls it
originalText, the API reference's POST example calls itdescription. The script tries both. - Once you know the real
momentTypevalues frompull_moments.py's output, go back intotrain.py'sedge_caseslist and replace the two generic placeholders with real ambiguous cases (e.g. two semantically similar types that might get confused) -- the current list is intentionally minimal since we don't know the real label set yet.
Privacy reminder (per the playbook)
Before pushing anything to Hugging Face -- model or dataset -- manually
check that no villager names, contact info, or other unnecessary
identifiers ended up in the text field. This can't be fully automated;
it needs a human read-through of a sample.
Inference Providers NEW
This model isn't deployed by any Inference Provider. 🙋 Ask for provider support