Run this model with HF Jobs
Run IndexTeam/Index-1.9B-Chat on Hugging Face's managed compute, monitor its progress, and retrieve the results when it's done.
Paste one of these prompts into your coding agent:
Fine-tune on my dataset
Use HF Jobs and TRL to fine-tune https://huggingface.co/IndexTeam/Index-1.9B-Chat. Ask me which dataset to train on, then push the fine-tuned model to a new model repo. Run `hf jobs --help` first to learn the CLI.
Run batch inference
Use HF Jobs to run batch inference with https://huggingface.co/IndexTeam/Index-1.9B-Chat on the inputs in a mounted HF Bucket. Ask me which Bucket to use, then write the outputs back to it and keep each input ID. Run `hf jobs --help` first to learn the CLI.
Evaluate on a benchmark
Use HF Jobs to evaluate https://huggingface.co/IndexTeam/Index-1.9B-Chat. Ask me which benchmark to run, then save the scores and the per-example results to a new dataset repo. Run `hf jobs --help` first to learn the CLI.
Quantize for lower memory use
Use HF Jobs to create a 4-bit version of https://huggingface.co/IndexTeam/Index-1.9B-Chat. Push it to a new model repo, then reload it from there and report its memory footprint. Run `hf jobs --help` first to learn the CLI.
Instructions to use IndexTeam/Index-1.9B-Chat with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Transformers
How to use IndexTeam/Index-1.9B-Chat with Transformers:
# Use a pipeline as a high-level helper from transformers import pipeline pipe = pipeline("text-generation", model="IndexTeam/Index-1.9B-Chat", trust_remote_code=True) messages = [ {"role": "user", "content": "Who are you?"}, ] pipe(messages)# pip install -U transformers accelerate # Load model directly from transformers import AutoModelForCausalLM model = AutoModelForCausalLM.from_pretrained("IndexTeam/Index-1.9B-Chat", trust_remote_code=True, device_map="auto") - Notebooks
- Google Colab
- Kaggle
- Local Apps Settings
- vLLM
How to use IndexTeam/Index-1.9B-Chat with vLLM:
Install from pip and serve model
# Install vLLM from pip: pip install vllm # Start the vLLM server: vllm serve "IndexTeam/Index-1.9B-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": "IndexTeam/Index-1.9B-Chat", "messages": [ { "role": "user", "content": "What is the capital of France?" } ] }'Use Docker
docker model run hf.co/IndexTeam/Index-1.9B-Chat
- SGLang
How to use IndexTeam/Index-1.9B-Chat 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 "IndexTeam/Index-1.9B-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": "IndexTeam/Index-1.9B-Chat", "messages": [ { "role": "user", "content": "What is the capital of France?" } ] }'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 "IndexTeam/Index-1.9B-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": "IndexTeam/Index-1.9B-Chat", "messages": [ { "role": "user", "content": "What is the capital of France?" } ] }' - Docker Model Runner
How to use IndexTeam/Index-1.9B-Chat with Docker Model Runner:
docker model run hf.co/IndexTeam/Index-1.9B-Chat
Update README.md
#4
by safufu - opened
25 unmodified lines262728293031323334353637383940414243441 unmodified line46474849505152535455565758596025 unmodified lines可通过以下代码加载 Index-1.9B-Chat 模型来进行对话:```pythonimport torchimport argparsefrom transformers import AutoTokenizer, AutoModelForCausalLM# 注意!目录不能含有".",可以替换成"_"parser = argparse.ArgumentParser()parser.add_argument('--model_path', default="", type=str, help="")args = parser.parse_args()tokenizer = AutoTokenizer.from_pretrained(args.model_path, trust_remote_code=True)model = AutoModelForCausalLM.from_pretrained(args.model_path, torch_dtype=torch.bfloat16, trust_remote_code=True, device_map='auto')model = model.eval()print('model loaded', args.model_path, model.device)system_message = "你是由哔哩哔哩自主研发的大语言模型,名为“Index”。你能够根据用户传入的信息,帮助用户完成指定的任务,并生成恰当的、符合要求的回复。"query = "续写 天不生我金坷垃"1 unmodified linemodel_input.append({"role": "system", "content": system_message})model_input.append({"role": "user", "content": query})inputs = tokenizer.apply_chat_template(model_input, tokenize=False, add_generation_prompt=False)input_ids = tokenizer.encode(inputs, return_tensors="pt").to(model.device)history_outputs = model.generate(input_ids, max_new_tokens=300, top_k=5, top_p=0.8, temperature=0.3, repetition_penalty=1.1, do_sample=True)# 删除</s>if history_outputs[0][-1] == 2:history_outputs = history_outputs[:, :-1]outputs = history_outputs[0][len(input_ids[0]):]print('User:', query)print('\nModel:', tokenizer.decode(outputs))```25 unmodified lines2627282930313233343536373839404142434445461 unmodified line484950515253545525 unmodified lines可通过以下代码加载 Index-1.9B-Chat 模型来进行对话:```pythonimport argparsefrom transformers import AutoTokenizer, pipeline# 注意!目录不能含有".",可以替换成"_"parser = argparse.ArgumentParser()parser.add_argument('--model_path', default="IndexTeam/Index-1.9B-Chat", type=str, help="")parser.add_argument('--device', default="cpu", type=str, help="") # also could be "cuda" or "mps" for Apple siliconargs = parser.parse_args()tokenizer = AutoTokenizer.from_pretrained(args.model_path, trust_remote_code=True)generator = pipeline("text-generation",model=args.model_path,tokenizer=tokenizer, trust_remote_code=True,device=args.device)system_message = "你是由哔哩哔哩自主研发的大语言模型,名为“Index”。你能够根据用户传入的信息,帮助用户完成指定的任务,并生成恰当的、符合要求的回复。"query = "续写 天不生我金坷垃"1 unmodified linemodel_input.append({"role": "system", "content": system_message})model_input.append({"role": "user", "content": query})model_output = generator(model_input, max_new_tokens=300, top_k=5, top_p=0.8, temperature=0.3, repetition_penalty=1.1, do_sample=True)print('User:', query)print('Model:', model_output)```
README.md+10-15