Instructions to use ganchengguang/USA-7B-instruction-incontext-learning with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Transformers
How to use ganchengguang/USA-7B-instruction-incontext-learning with Transformers:
# Use a pipeline as a high-level helper from transformers import pipeline pipe = pipeline("text-generation", model="ganchengguang/USA-7B-instruction-incontext-learning")# Load model directly from transformers import AutoTokenizer, AutoModelForCausalLM tokenizer = AutoTokenizer.from_pretrained("ganchengguang/USA-7B-instruction-incontext-learning") model = AutoModelForCausalLM.from_pretrained("ganchengguang/USA-7B-instruction-incontext-learning") - Inference
- Notebooks
- Google Colab
- Kaggle
- Local Apps Settings
- vLLM
How to use ganchengguang/USA-7B-instruction-incontext-learning with vLLM:
Install from pip and serve model
# Install vLLM from pip: pip install vllm # Start the vLLM server: vllm serve "ganchengguang/USA-7B-instruction-incontext-learning" # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:8000/v1/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "ganchengguang/USA-7B-instruction-incontext-learning", "prompt": "Once upon a time,", "max_tokens": 512, "temperature": 0.5 }'Use Docker
docker model run hf.co/ganchengguang/USA-7B-instruction-incontext-learning
- SGLang
How to use ganchengguang/USA-7B-instruction-incontext-learning 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 "ganchengguang/USA-7B-instruction-incontext-learning" \ --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": "ganchengguang/USA-7B-instruction-incontext-learning", "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 "ganchengguang/USA-7B-instruction-incontext-learning" \ --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": "ganchengguang/USA-7B-instruction-incontext-learning", "prompt": "Once upon a time,", "max_tokens": 512, "temperature": 0.5 }' - Docker Model Runner
How to use ganchengguang/USA-7B-instruction-incontext-learning with Docker Model Runner:
docker model run hf.co/ganchengguang/USA-7B-instruction-incontext-learning
Only for Japanese
Please use AutoTokenizer and AutoModelForCausalLM
And must use Unifine format to input and output. In-context Learning + Instruction Learning + Formated Input Text
This is a example of ICL + IL +Formater Converter :
incontext + instruction
"messages": [
{
"role": "system",
"content": f"""
キスク時代ではキーパーが取り上げれその後の2作の評価が良くないという事がありますがこれはかなり出来のいいアルバムです。疾走感は減りますが、その分メロディーの質が向上したという感じでしょうか。ハロウィンでは良い曲を書けなかったローランドグラポウもこのアルバムには名曲「The Chance」を提供しています。ボーナストラックも単に何か追加したという事だけではなく質の高い曲が入っていました。評価があまり良くないから聞かず嫌いという人は一度聞いてみて下さい。<積極><消極>キスク時代ではキーパーが取り上げれその後の2作の評価が良くないという事がありますがこれはかなり出来のいいアルバムです。疾走感は減りますが、その分メロディーの質が向上したという感じでしょうか。ハロウィンでは良い曲を書けなかったローランドグラポウもこのアルバムには名曲「The Chance」を提供しています。ボーナストラックも単に何か追加したという事だけではなく質の高い曲が入っていました。評価があまり良くないから聞かず嫌いという人は一度聞いてみて下さい。POS:ポジティブ;:中立;:ネガティブ;assistant:<積極>POS:中立;キス:ネガティブ;スト:ポジティブ;ボーナス:中立;感じ:ネガティブ;嫌:ネガティブ;嫌い:ポジティブ;向上:中立;事:ポジティブ;疾走感:ポジティブ;質:ポジティブ;出来:中立;人:中立;追加:ポジティブ;提供:中立;評:中立;評価:ポジティブ;名:ポジティブ;名曲:ポジティブ;良 以上は一つ例です。以下のテキストの感情は<積極>や<消極>ですか。そして、テキストの中にポジティブ、中立とネガティブの名詞を列挙してください。"""
},
{
"role": "user",
"content": f"{prompt}<積極><消極>{prompt}POS:ポジティブ;:中立;:ネガティブ;"
# "content": f"{prompt}"
}
]
Cite by paper @article{gan2023usa, title={USA: Universal Sentiment Analysis Model & Construction of Japanese Sentiment Text Classification and Part of Speech Dataset}, author={Gan, Chengguang and Zhang, Qinghao and Mori, Tatsunori}, journal={arXiv preprint arXiv:2309.03787}, year={2023} }
- Downloads last month
- 10