Instructions to use 2121-8/TinySlime-1.1B-v1.0 with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Transformers
How to use 2121-8/TinySlime-1.1B-v1.0 with Transformers:
# Use a pipeline as a high-level helper from transformers import pipeline pipe = pipeline("text-generation", model="2121-8/TinySlime-1.1B-v1.0")# Load model directly from transformers import AutoTokenizer, AutoModelForCausalLM tokenizer = AutoTokenizer.from_pretrained("2121-8/TinySlime-1.1B-v1.0") model = AutoModelForCausalLM.from_pretrained("2121-8/TinySlime-1.1B-v1.0") - Notebooks
- Google Colab
- Kaggle
- Local Apps Settings
- vLLM
How to use 2121-8/TinySlime-1.1B-v1.0 with vLLM:
Install from pip and serve model
# Install vLLM from pip: pip install vllm # Start the vLLM server: vllm serve "2121-8/TinySlime-1.1B-v1.0" # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:8000/v1/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "2121-8/TinySlime-1.1B-v1.0", "prompt": "Once upon a time,", "max_tokens": 512, "temperature": 0.5 }'Use Docker
docker model run hf.co/2121-8/TinySlime-1.1B-v1.0
- SGLang
How to use 2121-8/TinySlime-1.1B-v1.0 with SGLang:
Install from pip and serve model
# Install SGLang from pip: pip install sglang # Start the SGLang server: python3 -m sglang.launch_server \ --model-path "2121-8/TinySlime-1.1B-v1.0" \ --host 0.0.0.0 \ --port 30000 # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:30000/v1/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "2121-8/TinySlime-1.1B-v1.0", "prompt": "Once upon a time,", "max_tokens": 512, "temperature": 0.5 }'Use Docker images
docker run --gpus all \ --shm-size 32g \ -p 30000:30000 \ -v ~/.cache/huggingface:/root/.cache/huggingface \ --env "HF_TOKEN=<secret>" \ --ipc=host \ lmsysorg/sglang:latest \ python3 -m sglang.launch_server \ --model-path "2121-8/TinySlime-1.1B-v1.0" \ --host 0.0.0.0 \ --port 30000 # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:30000/v1/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "2121-8/TinySlime-1.1B-v1.0", "prompt": "Once upon a time,", "max_tokens": 512, "temperature": 0.5 }' - Docker Model Runner
How to use 2121-8/TinySlime-1.1B-v1.0 with Docker Model Runner:
docker model run hf.co/2121-8/TinySlime-1.1B-v1.0
TinySlime-1.1B-v1.0
TinySlime は日本語に特化した小規模言語モデルです。
モデルの一覧
このモデルのフルチューニングは、Axolotl を使用して行われました。
モデル概要
2121-8/TinySlime-1.1B-v1.0 は、TinyLlama/TinyLlama-1.1B-intermediate-step-1431k-3T をベースモデルとし、augmxnt/shisa-pretrain-en-ja-v1 の学習データを使用してトレーニングされたモデルです。本モデルは、5.5B のトークンで学習されました。 このモデルは、スマートフォン、NVIDIA Jetson などの組み込みで動かすことを想定し作成されました。
- ベースモデル: TinyLlama/TinyLlama-1.1B-intermediate-step-1431k-3T
- 学習データセット: augmxnt/shisa-pretrain-en-ja-v1
- 学習トークン: 55 億
使用方法
インストール
このモデルを使用するには、Hugging Face のtransformersライブラリをインストールする必要があります
pip install -U transformers
モデルの読み込み
transformersライブラリを使用してモデルを読み込むことができます
from transformers import AutoModelForCausalLM, AutoTokenizer
model_name = "2121-8/TinyLlama-v1.0"
tokenizer = AutoTokenizer.from_pretrained(model_name)
model = AutoModel.from_pretrained(model_name)
テキスト生成
以下の例では、読み込んだモデルを使用してテキストを生成する方法を示します
input_text = "西郷隆盛は明治時代の"
input_ids = tokenizer.encode(input_text, return_tensors='pt')
# テキストを生成
outputs = model.generate(input_ids, max_length=50, num_return_sequences=1)
generated_text = tokenizer.decode(outputs[0], skip_special_tokens=True)
print(generated_text)
謝辞
このモデルは、TinyLlama プロジェクトの成果に基づいて構築され、augmxnt/shisa-pretrain-en-ja-v1データセットを使用して学習されました。
また、このモデルの開発にあたり、Axolotl のサポートとツールを利用しました。
NLP コミュニティへの貢献に感謝します。
- Downloads last month
- 9