Quantifying the Carbon Emissions of Machine Learning
Paper • 1910.09700 • Published • 59
How to use flypg/DeepSeek-R1-Distill-Qwen-14B-Japanese-chat with Transformers:
# Use a pipeline as a high-level helper
from transformers import pipeline
pipe = pipeline("text-generation", model="flypg/DeepSeek-R1-Distill-Qwen-14B-Japanese-chat")
messages = [
{"role": "user", "content": "Who are you?"},
]
pipe(messages) # Load model directly
from transformers import AutoTokenizer, AutoModelForCausalLM
tokenizer = AutoTokenizer.from_pretrained("flypg/DeepSeek-R1-Distill-Qwen-14B-Japanese-chat")
model = AutoModelForCausalLM.from_pretrained("flypg/DeepSeek-R1-Distill-Qwen-14B-Japanese-chat")
messages = [
{"role": "user", "content": "Who are you?"},
]
inputs = tokenizer.apply_chat_template(
messages,
add_generation_prompt=True,
tokenize=True,
return_dict=True,
return_tensors="pt",
).to(model.device)
outputs = model.generate(**inputs, max_new_tokens=40)
print(tokenizer.decode(outputs[0][inputs["input_ids"].shape[-1]:]))How to use flypg/DeepSeek-R1-Distill-Qwen-14B-Japanese-chat with vLLM:
# Install vLLM from pip:
pip install vllm
# Start the vLLM server:
vllm serve "flypg/DeepSeek-R1-Distill-Qwen-14B-Japanese-chat"
# Call the server using curl (OpenAI-compatible API):
curl -X POST "http://localhost:8000/v1/chat/completions" \
-H "Content-Type: application/json" \
--data '{
"model": "flypg/DeepSeek-R1-Distill-Qwen-14B-Japanese-chat",
"messages": [
{
"role": "user",
"content": "What is the capital of France?"
}
]
}'docker model run hf.co/flypg/DeepSeek-R1-Distill-Qwen-14B-Japanese-chat
How to use flypg/DeepSeek-R1-Distill-Qwen-14B-Japanese-chat with SGLang:
# Install SGLang from pip:
pip install sglang
# Start the SGLang server:
python3 -m sglang.launch_server \
--model-path "flypg/DeepSeek-R1-Distill-Qwen-14B-Japanese-chat" \
--host 0.0.0.0 \
--port 30000
# Call the server using curl (OpenAI-compatible API):
curl -X POST "http://localhost:30000/v1/chat/completions" \
-H "Content-Type: application/json" \
--data '{
"model": "flypg/DeepSeek-R1-Distill-Qwen-14B-Japanese-chat",
"messages": [
{
"role": "user",
"content": "What is the capital of France?"
}
]
}'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 "flypg/DeepSeek-R1-Distill-Qwen-14B-Japanese-chat" \
--host 0.0.0.0 \
--port 30000
# Call the server using curl (OpenAI-compatible API):
curl -X POST "http://localhost:30000/v1/chat/completions" \
-H "Content-Type: application/json" \
--data '{
"model": "flypg/DeepSeek-R1-Distill-Qwen-14B-Japanese-chat",
"messages": [
{
"role": "user",
"content": "What is the capital of France?"
}
]
}'How to use flypg/DeepSeek-R1-Distill-Qwen-14B-Japanese-chat with Docker Model Runner:
docker model run hf.co/flypg/DeepSeek-R1-Distill-Qwen-14B-Japanese-chat
This model is finetuned on conversational data for chat in Japanese.
The model can be directly used for casual conversation in Japanese.
Below is a minimal example of how to load and use this model for inference in Python.
import torch
from transformers import AutoModelForCausalLM, AutoTokenizer
model_name = "flypg/DeepSeek-R1-Distill-Qwen-14B-Japanese-chat"
tokenizer = AutoTokenizer.from_pretrained(
model_name,
)
model = AutoModelForCausalLM.from_pretrained(
model_name,
trust_remote_code=True,
device_map="auto",
torch_dtype=torch.float16
)
model.eval()
prompt = "your prompt"
inputs = tokenizer(prompt, return_tensors="pt").to(model.device)
with torch.no_grad():
output_ids = model.generate(
**inputs,
max_new_tokens=100,
temperature=0.7,
top_p=0.9,
do_sample=True,
pad_token_id=tokenizer.eos_token_id
)
response = tokenizer.decode(output_ids[0], skip_special_tokens=True)
print(response)
Carbon emissions can be estimated using the Machine Learning Impact calculator presented in Lacoste et al. (2019).
If you use this model in your research or work, please cite it using the following BibTeX entry:
@misc{DeepSeek R1-Qwen Model for Chat in Japenese,
title={DeepSeek-R1-Distill-Qwen-14B-Japanese-chat: A Fine-Tuned Qwen-based Model for Chat in Japenese},
author={flypg},
year={2025},
howpublished={\url{https://huggingface.co/flypg/DeepSeek-R1-Distill-Qwen-14B-Japanese-chat}},
note={Accessed: YYYY-MM-DD}
}
## Contact
[kenkun091](https://github.com/kenkun091)
Please feel free to open an issue.
Base model
deepseek-ai/DeepSeek-R1-Distill-Qwen-14B