সব ভাষাতেই command ও code ইংরেজিতে থাকবে। বড় হাতের অক্ষরে লেখা placeholder নিজের account ও paid job-এর মান দিয়ে বদলান; shared notebook বা log-এ আসল key দেবেন না।
এক project API, একই অন্তর্নিহিত engine
- from_file ওজন না বদলে লোড
- plan নির্ধারিত input পরীক্ষা
- run / controls নিজের worker ও recovery
- evaluate / export গৃহীত স্থানীয় output দেখা
from_file: ওজন না বদলে লোড. plan: নির্ধারিত input পরীক্ষা. run / controls: নিজের worker ও recovery. evaluate / export: গৃহীত স্থানীয় output দেখা
Python থেকে একই engine ব্যবহার করুন
TrainingProject, TrainingClient-কে প্রতিস্থাপন না করে তার পরিপূরক হিসেবে কাজ করে। Configuration ও সীমিত-পরিসরের API key লোড করুন, plan পরীক্ষা করে তারপর run শুরু করুন। Project object পরিদর্শন ও নিয়ন্ত্রণের জন্য নিজের run প্রকাশ করে; run বিদ্যমান run-এর ওপর লিখতে অস্বীকার করে, আর resume করতে বৈধ recovery state লাগে।
- Path string বা os.PathLike object হতে পারে। Method-এর option keyword-only।
- from_file চালালে স্থানীয় configuration যাচাই হয়; ওজন হালনাগাদ বা teacher request হয় না।
- Python ও CLI workflow একই setting, fingerprint, budget ও output ব্যবহার করে।
| ঘর বা ইন্টারফেস | ধরন বা ফল | ডিফল্ট বা exit code | আচরণ ও যাচাই |
|---|---|---|---|
TrainingProject.from_file(path, *, api_key) |
TrainingProject |
আবশ্যক / ডিফল্ট নেই | Configuration path ও nonempty secret string লোড ও যাচাই করে। Project object ফেরত দেয়; ওজন হালনাগাদ বা teacher call হয় না। |
plan(*, dry_run=True) |
dict |
true |
শুধু True। resolved_configuration, compatibility, data_sharing, budgets, topics, artifacts ও fingerprints ফেরত দেয়। |
run() |
dict |
আবশ্যক / ডিফল্ট নেই | চূড়ান্ত বা paused state পর্যন্ত অপেক্ষা করে; শুধু সফল operation-এ সাধারণ run result ফেরায়, অন্যথায় মিলে যাওয়া error তোলে। |
status() |
dict |
আবশ্যক / ডিফল্ট নেই | Worker না চালিয়ে run_id, status, stop_reason, report_path ও unmet_criteria পড়ে। |
pause() |
dict |
আবশ্যক / ডিফল্ট নেই | Worker acknowledgement ও বৈধ checkpoint-এর অপেক্ষা করে; সাধারণ run result ফেরায়। অবৈধ state-এ configuration error হয়। |
resume() |
dict |
আবশ্যক / ডিফল্ট নেই | সব fingerprint যাচাই করে নিজের worker resume করে; operation সফল হলে সাধারণ run result ফেরায়। |
cancel() |
dict |
আবশ্যক / ডিফল্ট নেই | নিজের worker থামা পর্যন্ত অপেক্ষা করে এবং cancelled state ফেরায়; নিরাপদে থামানো নিশ্চিত না হলে CancellationError তোলে। |
evaluate(*, split="test") |
dict |
"test" |
validation অথবা test গ্রহণ করে। run_id, split, accepted, criteria, regressions ও report_path ফেরায়; গ্রহণযোগ্যতা ব্যর্থ হলেও report সংরক্ষণের পর EvaluationFailedError তোলে। |
export(*, format="safetensors") |
dict |
"safetensors" |
গ্রহণযোগ্য সামঞ্জস্যপূর্ণ artifact-এর জন্য run_id, format, artifact_path, manifest_path ও sha256 ফেরায়। |
register_evaluator(name, scorer, *, version) |
None |
আবশ্যক / ডিফল্ট নেই | Plan বা evaluation-এর আগে বিশ্বস্ত scoring function নিবন্ধন করুন। স্থিতিশীল নাম ও স্পষ্ট version দিন; function prediction, target ও row পায় এবং ০–১-এর সসীম score ফেরত দেবে। Built-in metric প্রতিস্থাপন করা যায় না। |
import os
from fusionpointai_training import TrainingProject
project = TrainingProject.from_file(
"./german-project/training.json",
api_key=os.environ["FUSIONPOINTAI_API_KEY"],
)
plan = project.plan(dry_run=True)
print(plan["resolved_configuration"], plan["data_sharing"], plan["budgets"])
# Confirm the reviewed plan before starting real work.
result = project.run()
if result["status"] != "completed" or result["stop_reason"] != "accepted":
raise RuntimeError("Training was not accepted; inspect the retained report.")
evaluation = project.evaluate(split="test")
# A failed required criterion raises EvaluationFailedError after saving its report.
artifact = project.export(format="safetensors")
print(artifact["manifest_path"])
কাঠামোবদ্ধ ফল পর্যালোচনা করুন
নিচের return contract ফলের গঠন জানায়, নমুনা-পরিমাপ নয়। Deploy করার আগে status, stop_reason ও unmet_criteria পরীক্ষা করুন। Evaluation result-এ প্রতিটি criterion ও regression চিহ্নিত হয়। Export স্থানীয় path ও integrity metadata দেয়; নিজে থেকে model upload বা production inference প্রতিস্থাপন করে না।
- নতুন teacher request না করেই status ও manifest-এর তথ্য পড়া সম্ভব হতে হবে।
- Final test set-এর evaluation হলো উন্নতির সময় ব্যবহৃত validation থেকে আলাদা।
- Artifact manifest-এ প্রকৃত file, নিরাপদ relative path, byte size ও SHA-256 মিলতে হবে।
TrainingProject return contract (dictionary shapes)
from_file: validates configuration, attaches its owned run; no weight updates.
plan: {schema_version, resolved_configuration, compatibility, data_sharing,
budgets, topics, artifacts, fingerprints}; dry_run must be true.
run/resume: {run_id, status, stop_reason, report_path, unmet_criteria}.
status/pause/cancel: {run_id, status, stop_reason, report_path, unmet_criteria}.
stop_reason is null until terminal; run/resume block until terminal or paused.
pause blocks until owned workers acknowledge an atomic checkpoint.
cancel blocks until owned workers stop; a failed stop raises CancellationError.
evaluate: {run_id, split, accepted, criteria, regressions, report_path}.
export: {run_id, format, artifact_path, manifest_path, sha256}.
Returned paths are local, resolved paths; no model upload is implied.
Status output is redacted and may be read without opening an API connection.
from_file requires path: str | os.PathLike and a nonempty api_key: str.
plan accepts dry_run=True only; False is ConfigurationError, not execution.
evaluate accepts split="validation" or "test"; defaults to test.
export accepts safetensors or adapters when supported by the selected adapter.
All method keyword options are keyword-only. Unlisted arguments are rejected.
ব্যর্থতা আড়াল না করে সামলান
Project error class-গুলো TrainingError থেকে উত্তরাধিকার পায় এবং CLI exit code-এর সঙ্গে মেলে। Configuration ও compatibility ব্যর্থতা training শুরুর আগেই ঘটে। Budget ও evaluation ব্যর্থতায় report এবং অপূর্ণ criterion অক্ষুণ্ণ থাকে। Worker থামানো বা checkpoint-সংক্রান্ত ত্রুটি নিরাপদ cleanup নিশ্চিত না হওয়া পর্যন্ত ব্যর্থতাই থাকবে।
- সফল method নথিভুক্ত dictionary ফেরত দেয়। Criterion ব্যর্থ হলে evaluation report সংরক্ষণের পর EvaluationFailedError ওঠে।
- API key, authorization header, সম্পূর্ণ environment বা ব্যক্তিগত প্রশিক্ষণ-উদাহরণ কখনো log করবেন না।
- Exception-কে স্বয়ংক্রিয় retry-তে মুড়িয়ে ফেলবেন না। আগে run ও service-এর অবস্থা দেখুন।
| ঘর বা ইন্টারফেস | ধরন বা ফল | ডিফল্ট বা exit code | আচরণ ও যাচাই |
|---|---|---|---|
ConfigurationError |
TrainingError |
2 |
Schema, argument, path, state অবৈধ অথবা অসমর্থিত override। আবার চেষ্টার আগে input ঠিক করুন। |
CompatibilityError |
TrainingError |
3 |
অসমর্থিত adapter, model, hardware, precision, distribution বা format। |
AuthenticationError |
TrainingError |
4 |
Key নেই/মেয়াদোত্তীর্ণ, entitlement অস্বীকৃত অথবা teacher sharing নিষিদ্ধ; message-এ secret দেবেন না। |
BudgetExceededError |
TrainingError |
5 |
গ্রহণযোগ্যতা আসার আগে নির্ধারিত budget শেষ হয়েছে। বৈধ checkpoint ও অপূর্ণ criterion রাখুন। |
EvaluationFailedError |
TrainingError |
6 |
আবশ্যক criterion ব্যর্থ, উন্নতি থেমে গেছে অথবা regression রয়ে গেছে। Evaluation report রাখুন। |
CheckpointError |
TrainingError |
7 |
Recovery state অবৈধ, অসম্পূর্ণ বা অমিল। কখনো জোর করে resume করবেন না। |
CancellationError |
TrainingError |
7 |
নিজের worker নিরাপদে থামানো নিশ্চিত হয়নি; cleanup সম্পন্ন না হওয়া পর্যন্ত খোলা রাখুন। |
ExportError |
TrainingError |
7 |
Artifact অসমর্থিত বা অবৈধ, path অনিরাপদ অথবা checksum ব্যর্থ; সরবরাহ করবেন না। |
TrainingError |
Exception |
7 |
মূল training failure। তালিকাভুক্ত সব লক্ষ্য-ত্রুটি এটি থেকে inherit করে; গোপন তথ্য বাদ দেওয়া diagnostic রাখুন। |
import os
from fusionpointai_training import TrainingProject
from fusionpointai_training.errors import (
AuthenticationError, BudgetExceededError, CompatibilityError,
ConfigurationError, EvaluationFailedError, TrainingError,
)
try:
project = TrainingProject.from_file(
"./german-project/training.json",
api_key=os.environ.get("FUSIONPOINTAI_API_KEY", ""),
)
project.plan(dry_run=True)
project.run()
result = project.evaluate(split="test")
except (ConfigurationError, CompatibilityError):
print("Correct the configuration before starting a new run.")
except AuthenticationError:
print("Check access without logging the key.")
except BudgetExceededError:
print("Preserve the checkpoint. A larger approved budget requires a new plan.")
except EvaluationFailedError:
print("Preserve failed criteria; do not publish this model as accepted.")
except TrainingError:
print("Inspect redacted diagnostics; do not blindly repeat a write.")
# CancellationError, CheckpointError and ExportError also inherit TrainingError.
from fusionpointai_training import register_evaluator
def category_match(prediction, target, row):
return float(prediction.strip().casefold() == target.strip().casefold())
register_evaluator("category_match", category_match, version="1")
# Register before project.plan() in the same Python process.
# In rubric.json: "metric": "category_match", "minimum_score": 0.85
# This scorer measures category equality, not open-ended semantic correctness.