Use deepseek like ChatGPT with Chinese and English versions

MLBoy
2 min readMar 30, 2024

easy to use

Well, it’s like the Chinese version of ChatGPT.
It can be easily used with just the following Python code.

import torch
from transformers import AutoTokenizer, AutoModelForCausalLM, GenerationConfigmodel_name = "deepseek-ai/deepseek-llm-7b-chat"
tokenizer = AutoTokenizer.from_pretrained(model_name)
model = AutoModelForCausalLM.from_pretrained(model_name, torch_dtype=torch.bfloat16, device_map="auto")
model.generation_config = GenerationConfig.from_pretrained(model_name)
model.generation_config.pad_token_id = model.generation_config.eos_token_id
messages = [
{"role": "user", "content": "Who are you?"}
]
input_tensor = tokenizer.apply_chat_template(messages, add_generation_prompt=True, return_tensors="pt")
outputs = model.generate(input_tensor.to(model.device), max_new_tokens=100)result = tokenizer.decode(outputs[0][input_tensor.shape[1]:], skip_special_tokens=True)
print(result)

I took the opportunity to check out some cool spots in China.

中国时尚人士玩的时尚景点

A trendy place where stylish people in China play

There are many attractions that many fashion people in China. Here are some examples:

1. Shanghai Bund: This is one of the iconic attractions in Shanghai, with European -style buildings and beautiful night views.

2. Beijing 798 Art District: It was once an abandoned factory area. Now it has become a place full of artistic atmosphere. There are many galleries, art exhibitions and cafes.

3. Hangzhou West Lake: West Lake is one of the most famous lakes in China, with beautiful natural scenery and long history and culture.

4. Guangzhou Pearl River Night Tour: The Pearl River is the mother river of Guangzhou. The light show on both sides of the Pearl River at night is very popular.

5. Chengdu Kuanzhai Lane: This is a well -preserved Qing Dynasty street. There are many traditional Sichuan cuisine and handicraft shops.

6. Xi'an Ancient City Wall: This is a well -preserved ancient city wall that can ride a bicycle or walk to feel the charm of ancient cities.

7. Hongya Cave, Chongqing: This is a commercial district mainly based on the architectural style of hanging foot. The lights are bright at night and very beautiful.

These attractions not only attracted many tourists, but also became popular places for fashion people to take pictures and social.

Good in Chinese.

🐣

I’m a freelance engineer.
Work consultation
Please feel free to contact us with a brief development description.
rockyshikoku@gmail.com

I am creating applications using machine learning and AR technology.

I send machine learning / AR related information.

GitHub

Twitter
Medium

--

--