Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/p1atdev/dartrs
https://github.com/p1atdev/dartrs
Last synced: 6 days ago
JSON representation
- Host: GitHub
- URL: https://github.com/p1atdev/dartrs
- Owner: p1atdev
- License: apache-2.0
- Created: 2024-04-29T15:25:48.000Z (8 months ago)
- Default Branch: main
- Last Pushed: 2024-05-12T14:10:15.000Z (8 months ago)
- Last Synced: 2024-11-22T00:47:56.601Z (about 2 months ago)
- Language: Rust
- Size: 87.9 KB
- Stars: 2
- Watchers: 1
- Forks: 1
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# dartrs
> [!WARNING]
> wip## Python
```bash
pip install -U dartrs
``````py
from dartrs.dartrs import DartTokenizer
from dartrs.utils import get_generation_config
from dartrs.v2 import (
compose_prompt,
MixtralModel,
V2Model,
)
import time
import osMODEL_NAME = "p1atdev/dart-v2-moe-sft"
model = MixtralModel.from_pretrained(MODEL_NAME, dtype="fp16")
tokenizer = DartTokenizer.from_pretrained(MODEL_NAME)config = get_generation_config(
prompt=compose_prompt(
copyright="vocaloid",
character="hatsune miku",
rating="general", # sfw, general, sensitive, nsfw, questionable, explicit
aspect_ratio="tall", # ultra_wide, wide, square, tall, ultra_tall
length="medium", # very_short, short, medium, long, very_long
identity="none", # none, lax, strict
prompt="1girl, cat ears",
),
tokenizer=tokenizer,
seed=42,
)start = time.time()
output = model.generate(config)
end = time.time()print(output)
print(f"Time taken: {end - start:.2f}s")
# Output:
# cowboy shot, detached sleeves, expressionless, from side, hair ornament, halftone, hairclip, holding, limited palette, long hair, looking at viewer, miniskirt, necktie, pleated skirt, shirt, simple background, skirt, sleeveless, sleeveless shirt, straight-on, thighhighs, twintails, very long hair, zettai ryouiki
# Time taken: 0.22s
```