Seahorse

raw JSON →
1.2.3 verified Fri May 01 auth: no python

Seahorse is a Pytorch-based library for constructing and training large-scale transformer language models, providing tools for distributed training, model parallelism, and efficient memory usage. Currently at version 1.2.3, with active development.

pip install seahorse
error ImportError: cannot import name 'SeaModel' from 'seahorse'
cause Incorrect import path; seahorse exposes SeaModel at top level.
fix
Use: from seahorse import SeaModel
error ValueError: The argument `model_parallel` is not supported in this version.
cause Removed in v1.2.0; replaced by device_map.
fix
Use device_map='auto' instead of model_parallel=True.
error RuntimeError: CUDA out of memory.
cause Model too large for GPU; need memory optimization or CPU offloading.
fix
Enable CPU offloading with device_map='sequential' or reduce batch size.
error AttributeError: 'SeaModel' object has no attribute 'load_checkpoint'
cause load_checkpoint was removed from SeaModel instances; use class method.
fix
Use SeaModel.from_pretrained(path) instead.
error ModuleNotFoundError: No module named 'torch'
cause PyTorch not installed; required dependency.
fix
pip install torch
gotcha Breaking change: The 'model_parallel' argument was removed in v1.2.0. Use 'device_map' instead.
fix Replace model_parallel=True with device_map='auto'.
deprecated The 'load_checkpoint' function is deprecated in v1.2.0; use 'SeaModel.from_pretrained' instead.
fix Replace load_checkpoint('path') with SeaModel.from_pretrained('path').
gotcha Seahorse requires Python >=3.11; installing on older Python fails silently or with cryptic errors.
fix Verify Python version: python --version >= 3.11.

Load a pre-trained Seahorse model and run a forward pass.

import torch
from seahorse import SeaModel
model = SeaModel.from_pretrained('seahorse-base')
inputs = torch.randint(0, 1000, (1, 512))
outputs = model(inputs)
print(outputs.shape)