Integrations Overview
tensoris.lib.integrations ¶
Classes¶
HuggingFaceIntegration ¶
Hugging Face Hub helper for downloading datasets/models and pushing PyTorch checkpoints.
References
Hugging Face Hub Python SDK: https://huggingface.co/docs/huggingface_hub/
Source code in src/tensoris/lib/integrations/huggingface.py
Attributes¶
Methods:¶
__init__ ¶
Initialize Hugging Face Hub client.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
token
|
str | None
|
Optional Hugging Face User Access Token (defaults to HF_TOKEN env var). |
None
|
Source code in src/tensoris/lib/integrations/huggingface.py
download_file ¶
Download a single model weight file from Hugging Face Hub.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
repo_id
|
str
|
Source Hugging Face Hub repository ID. |
required |
filename
|
str
|
Target file name (e.g. 'pytorch_model.bin'). |
required |
local_dir
|
str | Path
|
Destination folder path. |
'inputs/models'
|
Returns:
| Type | Description |
|---|---|
Path
|
Path object pointing to downloaded file. |
Source code in src/tensoris/lib/integrations/huggingface.py
push_model ¶
Upload local model directory or checkpoint files to Hugging Face Hub repository.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
repo_id
|
str
|
Target Hugging Face Hub repo ID (e.g. 'username/model-name'). |
required |
local_dir
|
str | Path
|
Local folder path containing checkpoint weights and configs. |
required |
commit_message
|
str
|
Git commit message on Hub repo. |
'Upload model checkpoint'
|
Returns:
| Type | Description |
|---|---|
str
|
URL string of published Hugging Face repository. |
Source code in src/tensoris/lib/integrations/huggingface.py
KaggleIntegration ¶
Kaggle API Helper for downloading datasets and submitting competition predictions.
References
Kaggle API Documentation: https://github.com/Kaggle/kaggle-api
Source code in src/tensoris/lib/integrations/kaggle.py
Attributes¶
Methods:¶
__init__ ¶
Initialize Kaggle API client.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
api_key
|
str | None
|
Optional Kaggle API key (defaults to KAGGLE_KEY env var). |
None
|
username
|
str | None
|
Optional Kaggle username (defaults to KAGGLE_USERNAME env var). |
None
|
Source code in src/tensoris/lib/integrations/kaggle.py
download_dataset ¶
Download and unzip a Kaggle dataset.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
dataset_handle
|
str
|
Kaggle dataset identifier (e.g. 'zillow/zecon'). |
required |
output_dir
|
str | Path
|
Destination directory path. |
'inputs/datasets'
|
Returns:
| Type | Description |
|---|---|
Path
|
Path object pointing to the output directory. |
Source code in src/tensoris/lib/integrations/kaggle.py
submit_competition ¶
Submit a prediction CSV file to a Kaggle competition.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
file_path
|
str | Path
|
Path to submission CSV file. |
required |
competition
|
str
|
Kaggle competition handle. |
required |
message
|
str
|
Submission description message. |
required |
Source code in src/tensoris/lib/integrations/kaggle.py
RoboflowIntegration ¶
Roboflow Helper for downloading computer vision datasets in YOLO, COCO, or Pascal VOC formats.
References
Roboflow Python SDK Documentation: https://docs.roboflow.com/
Source code in src/tensoris/lib/integrations/roboflow.py
Attributes¶
Methods:¶
__init__ ¶
Initialize Roboflow client.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
api_key
|
str | None
|
Optional Roboflow API key (defaults to ROBOFLOW_API_KEY env var). |
None
|
Source code in src/tensoris/lib/integrations/roboflow.py
download_dataset ¶
download_dataset(
workspace,
project_id,
version,
model_format="yolov8",
output_dir="inputs/datasets",
)
Download dataset version from Roboflow Universe or Workspace.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
workspace
|
str
|
Roboflow workspace identifier. |
required |
project_id
|
str
|
Roboflow project ID. |
required |
version
|
int
|
Dataset version number integer. |
required |
model_format
|
str
|
Export format ('yolov8', 'coco', 'pascal_voc', 'tfrecord'). |
'yolov8'
|
output_dir
|
str | Path
|
Destination directory. |
'inputs/datasets'
|
Returns:
| Type | Description |
|---|---|
Any
|
Roboflow dataset download object containing dataset location. |
Source code in src/tensoris/lib/integrations/roboflow.py
UltralyticsIntegration ¶
Ultralytics YOLO model helper for object detection, segmentation, and classification workflows.
References
Ultralytics Documentation: https://docs.ultralytics.com/
Source code in src/tensoris/lib/integrations/ultralytics.py
Attributes¶
Methods:¶
__init__ ¶
Initialize Ultralytics YOLO model.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
model_name
|
str
|
Pretrained YOLO weight file or config path (e.g. 'yolov8n.pt', 'yolov8x-seg.pt'). |
'yolov8n.pt'
|
Source code in src/tensoris/lib/integrations/ultralytics.py
export ¶
Export trained YOLO model to deployment format (ONNX, TorchScript, Engine).
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
format
|
str
|
Output target format ('onnx', 'torchscript', 'engine', 'openvino'). |
'onnx'
|
Returns:
| Type | Description |
|---|---|
str
|
String path of exported model weight file. |
Source code in src/tensoris/lib/integrations/ultralytics.py
load_model ¶
Instantiate Ultralytics YOLO model class.
Source code in src/tensoris/lib/integrations/ultralytics.py
train ¶
Train YOLO model on dataset.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
data_yaml
|
str | Path
|
Path to dataset configuration YAML file. |
required |
epochs
|
int
|
Training epoch count. |
50
|
imgsz
|
int
|
Target image resolution size. |
640
|
batch
|
int
|
Training batch size. |
16
|
Returns:
| Type | Description |
|---|---|
Any
|
Training results object. |
Source code in src/tensoris/lib/integrations/ultralytics.py
WandbIntegration ¶
Weights & Biases Logger for metric tracking, artifact logging, and hyperparameter sweeps.
References
Weights & Biases Python SDK Documentation: https://docs.wandb.ai/
Source code in src/tensoris/lib/integrations/wandb.py
Attributes¶
Methods:¶
__init__ ¶
Initialize W&B run.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
project
|
str
|
W&B project name. |
'deep-learning-project'
|
entity
|
str | None
|
W&B username or team entity. |
None
|
config
|
dict[str, Any] | None
|
Hyperparameter configuration dictionary. |
None
|
name
|
str | None
|
Display name for the run. |
None
|
mode
|
str
|
Run mode ('online', 'offline', or 'disabled'). |
'online'
|
Source code in src/tensoris/lib/integrations/wandb.py
finish ¶
init ¶
Initialize W&B run context.
Source code in src/tensoris/lib/integrations/wandb.py
log ¶
Log metric key-value dictionary to W&B dashboard.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
metrics
|
dict[str, Any]
|
Dictionary of numerical metrics or media logs. |
required |
step
|
int | None
|
Optional global training step number. |
None
|
Source code in src/tensoris/lib/integrations/wandb.py
log_artifact ¶
Upload checkpoint file or artifact to W&B.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
file_path
|
str
|
Local file path to upload. |
required |
artifact_name
|
str
|
W&B artifact name identifier. |
required |
artifact_type
|
str
|
Artifact category ('model', 'dataset', 'checkpoint'). |
'model'
|