Skip to content

Commit

Permalink
MiniCpmModel类作为LlamaModel类的子类
Browse files Browse the repository at this point in the history
  • Loading branch information
cgli authored and TylunasLi committed Mar 2, 2024
1 parent 36be779 commit 0c52d0f
Show file tree
Hide file tree
Showing 2 changed files with 35 additions and 582 deletions.
23 changes: 2 additions & 21 deletions include/models/minicpm.h
Original file line number Diff line number Diff line change
Expand Up @@ -6,12 +6,13 @@
#define FASTLLM_MINICPM_H

#include "basellm.h"
#include "llama.h"
#include "cmath"

#include <iostream>

namespace fastllm {
class MiniCpmModel: public basellm {
class MiniCpmModel: public LlamaModel {
public:
MiniCpmModel(); // 构造函数

Expand Down Expand Up @@ -48,26 +49,6 @@ namespace fastllm {
const LastTokensManager &lastTokens = LastTokensManager(),
std::vector <std::vector <float>*> *logits = nullptr);

virtual std::string Response(const std::string& input,
RuntimeResult retCb,
const GenerationConfig &generationConfig = GenerationConfig()); // 根据给出的内容回复

virtual void ResponseBatch(const std::vector <std::string> &inputs,
std::vector <std::string> &outputs,
RuntimeResultBatch retCb,
const GenerationConfig &generationConfig = GenerationConfig());

virtual int LaunchResponseTokens(const std::vector <int> &inputTokens,
const GenerationConfig &generationConfig = GenerationConfig()); // 启动一个response任务,返回分配的handleId

virtual int FetchResponseTokens(int handelId); // 获取指定handle的输出, -1代表输出结束了

virtual void WarmUp(); // 预热

virtual std::string MakeInput(const std::string &history, int round, const std::string &input); // 根据历史信息和当前输入生成prompt

virtual std::string MakeHistory(const std::string &history, int round, const std::string &input, const std::string &output); // 根据当前回复更新history

private:
float embed_scale = 1.f;

Expand Down
Loading

0 comments on commit 0c52d0f

Please sign in to comment.