我使用R 4.1.2,网状1.22和文本0.9.50。
# install.packages("devtools")
devtools::install_github("oscarkjell/text")
library(text)
temp <- textEmbed("Hello!", model="anton-l/megatron-11b")
# Here comes an error message with traceback information.
# My guess is huggingface's internal error.
Error in py_call_impl(callable, dots$args, dots$keywords) :
KeyError: 'megatron'
9.
stop(structure(list(message = "KeyError: 'megatron'", call = py_call_impl(callable,
dots$args, dots$keywords), cppstack = structure(list(file = "",
line = -1L, stack =
c("/usr/local/lib/R/library/reticulate/libs/reticulate.so
(Rcpp::exception::exception(char const*, bool)+0x74) [0xffff9c3a97c4]",
"/usr/local/lib/R/library/reticulate/libs/reticulate.so
(Rcpp::stop(std::__cxx11::basic_string<char, std::char_traits<char>,
std::allocator<char> > const&)+0x28) [0xffff9c3a9838]", ...
8.
__getitem__ at configuration_auto.py#317
7.
from_pretrained at configuration_auto.py#600
6.
hgTransformerGetEmbedding at <string>#68
5.
hgTransformerGetEmbedding(text_strings = x[[i_variables]], model = model,
layers = layers, return_tokens = return_tokens, device = device,
tokenizer_parallelism = tokenizer_parallelism)
4.
force(expr)
3.
reticulate::py_capture_output(
hg_embeddings <- hgTransformerGetEmbedding(text_strings = x[[i_variables]],
model = model, layers = layers, return_tokens = return_tokens,
device = device, tokenizer_parallelism = tokenizer_parallelism),
type = "stderr")
2.
textEmbedLayersOutput(x, contexts = contexts, decontexts = decontexts,
model = model, layers = layers, return_tokens = FALSE, device = device,
print_python_warnings = print_python_warnings)
1.
textEmbed("Hello!", model = "anton-l/megatron-11b") 以下是我的环境:
R版本4.1.2 (2021-11-01)平台:aarch64-未知-linux-gnu(64位)在Ubuntu 18.04.6 LTS下运行
矩阵产品:默认BLAS: /usr/local/lib/R/lib/libRblas.so LAPACK: /usr/local/lib/R/lib/libRlapack.so
地区:1 LC_CTYPE=C.UTF-8 LC_NUMERIC=C 3 LC_TIME=C LC_COLLATE=C 5 LC_MONETARY=C LC_MESSAGES=C 7 LC_PAPER=C LC_NAME=C 9 LC_ADDRESS=C LC_TELEPHONE=C 11 LC_MEASUREMENT=C LC_IDENTIFICATION=C
附加的基本包:1个统计数据图形grDevices实用程序5个数据集方法库
其他附加包装:1 multilevel_2.7质量_7.3-54 3 nlme_3.1-153 stylo_0.7.4 5 magrittr_2.0.3 text_0.9.60 7 forcats_0.5.1 stringr_1.4.0 9 dplyr_1.0.9 purrr_0.3.4 11 readr_2.1.1 tidyr_1.2.0 13 tibble_3.1.6 ggplot2_3.3.5 15 tidyverse_1.3.1 reticulate_1.22 17 stringi_1.7.6
通过命名空间加载(未附加):1色空间_2.0-3 ellipsis_0.3.2 3类_7.3-19 fs_1.5.2 5 rstudioapi_0.13 proxy_0.4-26 7 listenv_0.8.0 furrr_0.2.3 9 dials_0.1.1 prodlim_2019.11.13 11 fansi_1.0.3 lubridate_1.8.0 13 xml2_1.3.3码器_0.2-18 15 splines_4.1.2 knitr_1.37 17 jsonlite_1.8.0 workflows_0.2.6 19 pROC_1.18.0 broom_0.8.0 21 cluster_2.1.2 dbplyr_2.1.1 23 png_0.1-7 yardstick_0.0.9 25 tune_0.2.0 compiler_4.1.2 27 httr_1.4.2 backports_1.4.1 29 fastmap_1.1.0 assertthat_0.2.1 31矩阵_1.3-4 cli_3.3.0 33 tcltk2 2_1.2-11 htmltools_0.5.2 35 tools_4.1.2 gtable_0.3.0 37 glue_1.6.2 tinytex_0.36 39 Rcpp_1.0.8.3 cellranger_1.1.0 41 DiceDesign_1.9 vctrs_0.4.1 43 ape_5.6-2 iterators_1.0.14 45 parsnip_0.2.1 timeDate_3043.102 47 xfun_0.30 gower_1.0.0 49globals_0.14.0 brio_1.1.3 51 testthat_3.1.4 rvest_1.0.2 53 lifecycle_1.0.1 future_1.25.0 55 scales_1.2.0 ipred_0.9-12 57 hms_1.1.1 parallel_4.1.2 59 yaml_2.2.1 rpart_4.1-1561 foreach_1.5.2 e 1071_1.7-9 63 lhs_1.1.5 hardhat_0.2.0 65 lava_1.6.10 rlang_1.0.2 67 pkgconfig_2.0.3 evaluate_0.15 69 rsample_0.1.1晶格_0.20-45 71 recipes_0.2.0 cowplot_1.1.1 73 tidyselect_1.1.2 parallelly_1.31.1 75 plyr_1.8.7 R6_2.5.1 77 generics_0.1.2 DBI_1.1.2 79 pillar_1.7.0 haven_2.4.3 81 withr_2.5.0 overlapping_1.7 83生存_3.2-13 nnet_7.3-16 85 future.apply_1.9.0TN0.1-3.1 87 modelr_0.1.8 crayon_1.5.1 89 pamr_1.56.1 utf8_1.2.2 91 rmarkdown_2.14 tzdb_0.2.0 93 grid_4.1.2 readxl_1.3.1 95 reprex_2.0.1 digest_0.6.2997 GPfit_1.0-8 munsell_0.5.0 99 tcltk_4.1.2
发布于 2022-05-14 07:08:22
我已经在网上搜索过这个问题,虽然没有时间尝试这些解决方案。
解决方案1:一个github问题页面提到了一个类似的模型名称问题。页面认为可以在HuggingFace中扩展autoconfig类。
https://huggingface.co/docs/transformers/main/en/model_doc/auto#extending-the-auto-classes
解决方案2:遵循作者anton-l:https://github.com/huggingface/transformers/pull/10301提到的步骤
https://stackoverflow.com/questions/72229828
复制相似问题